如何使用 Wscript Exec 运行 Java 文件
正如 Wscript:String value 的描述,指示用于运行脚本的命令行:命令行应该与在命令提示符下键入它时完全相同。
我可以使用以下命令运行我的 java 文件命令 "java test http://www.bbc.co .uk/news/world-us-canada-12116778"
但当我编写下面的 JavaScript 时它不起作用。有人可以告诉我为什么吗? 谢谢或者可以告诉我当我打开 html 文件时还有其他方法来调用我的 Java 文件吗?
<script type="text/javascript">
funciton {}
var WshShell = new ActiveXObject("WScript.Shell");
var oExec= WshShell.Exec(""java test http://www.bbc.co.uk/news/world-us-canada-12116778"");
while (oExec.Status == 0)
{
WScript.Sleep(100);
}
</script>
As the description of Wscript:String value indicating the command line used to run the script: The command line should appear exactly as it would if you typed it at the command prompt.
I can run my java file using the command "java test http://www.bbc.co.uk/news/world-us-canada-12116778"
but it is not working when I wrote the JavaScript below. Can someone can tell me why?
Thank you or can tell me there is some other method to call my Java file when I open a html file?
<script type="text/javascript">
funciton {}
var WshShell = new ActiveXObject("WScript.Shell");
var oExec= WshShell.Exec(""java test http://www.bbc.co.uk/news/world-us-canada-12116778"");
while (oExec.Status == 0)
{
WScript.Sleep(100);
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 WSHSell 对象的运行方法 。以下代码对我有用:
run 方法有一个等待 java 程序返回的选项。
希望这有帮助。
Take a look at the WSHSell object's run method. The following code works for me:
The run method has an option to wait for the java program to return.
Hope this helps.