我想使用javascript運行java文件。因此藉助了批處理文件。嘗試下面的代碼,它被賦予的時候,無法顯示頁面...可以請你儘早幫助...如何使用javascript和batchscript運行java文件
<html>
<head>
<script type="text/javascript">
function compression(str)
{
try{
alert("welcum");
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run (str,1,true);}
catch(e)
{
document.write("erro has occured ");
}
}
</script>
</head>
<body>
<a href="compression('explorer file:///C:\\Documents and
Settings\\test.bat')">batch File</a>
</body>
</html>
--------test.bat file------
@echo off
cls
javac *.java
java LzwTut
pause
不能使用已經構建的java小程序,因爲您似乎沒有將任何新參數傳遞給該類並編譯它。 – 2013-03-18 11:20:53
整個gui已經在javascript和html中完成。這些文件將在運行時被選中,這些文件將作爲參數傳遞給java文件LzwTut。目前我通過lzwTut – user2159239 2013-03-18 11:25:20