如果是这样,这个能力有没有限制?具体来说,我需要定位到Mac OSX。可信1.5小程序是否可以执行系统命令?
4
A
回答
4
事实证明,他们可以。
5
我已经使用过这个在Windows系统上启动的东西从来没有在Mac上尝试过它。
public void launchScript(String args)
{
String cmd = null;
try
{
cmd = getParameter(PARAM_CMD);
System.out.println("args value : = " + args);
System.out.println("cmd value : = " + cmd);
System.out.println("Full command: = " + cmd + " " + args);
if (cmd != null && !cmd.trim().equals(""))
{
if (args == null || args.trim().equals(""))
{
final String tempcmd = cmd;
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try
{
Runtime.getRuntime().exec(tempcmd);
}
catch (Exception e)
{
System.out.println("Caught exception in privileged block, Exception:" + e.toString());
}
return null; // nothing to return
}
});
System.out.println(cmd);
}
else
{
final String tempargs = args;
final String tempcmd1 = cmd;
AccessController.doPrivileged(new PrivilegedAction() {
public Object run()
{
try
{
Runtime.getRuntime().exec(tempcmd1 + " " + tempargs);
}
catch (Exception e)
{
System.out.println("Caught exception in privileged block, Exception:" + e.toString());
}
return null; // nothing to return
}
});
System.out.println(cmd + " " + args);
}
}
else
{
System.out.println("execCmd parameter is null or empty");
}
}
catch (Exception e)
{
System.out.println("Error executing command --> " + cmd + " (" + args + ")");
System.out.println(e);
}
}
0
唯一相关的问题我知道的是,使用Internet Explorer在Windows Vista上的老“经典”插件,小程序是在一个“低诚信”的过程,这停止了是特别有用的运行。
和往常一样,我平常的建议是在签署任何代码之前知道你在做什么。
相关问题
- 1. 是否可以从applet执行命令?
- 2. 是否可以从Grails应用程序执行Git命令?
- 3. 我们可以从sqlite3执行操作系统命令吗
- 4. perl系统命令执行
- 5. 是否可以在DOS系统下运行Java-GUI程序
- 6. 执行shell命令编程android系统
- 7. 是否可以从CentOS命令行执行数据库插入?
- 8. 是否可以从刀执行命令中运行chef-client?
- 9. 是否可以创建命令行JDT应用程序?
- 10. 是否可以从命令行
- 11. 是否有可能作为子线程执行命令行应用程序?
- 12. 是否可以对Apache Spark中的所有worker执行命令?
- 13. Caliburn Micro - 是否可以拦截调用来执行命令?
- 14. 是否可以在控制台中执行两条命令MongoDB
- 15. 如何检查命令是否可以执行?
- 16. 是否可以避免执行某个命令?
- 17. Bash:是否可以在执行前更改命令
- 18. 是否可以跨多行分割一系列熊猫命令?
- 19. Visual Studio命令窗口2010命令是否可以在脚本中执行
- 20. 在bash中是否有命令检查程序是否可以运行
- 21. 是否可以远程执行SSIS包?
- 22. 我们可以从oracle10g程序执行unix命令
- 23. php如何检查系统命令是否可用?
- 24. 在Java应用程序中执行系统命令
- 25. 在/系统中执行命令的应用程序
- 26. Java小程序是否可以盗链?
- 27. 可以用SAS执行Linux命令吗?
- 28. 从mysql执行系统命令
- 29. 流星执行系统命令同步
- 30. 为什么不执行系统命令?
是的。我需要明确地定位mac,所以这不是问题。不过很高兴知道。 – 2009-08-21 02:06:56
想想吧,OS X的“安全带”可能会应用于浏览器并导致问题。我不完全确定苹果在采用PlugIn 2方面的表现。 – 2009-08-21 02:37:16