[英]Where to put scripts/executables that will be called in the application
I have a vbscript that my Windows-only application uses. 我有一个仅Windows应用程序使用的vbscript。 I call it using Runtime
exec
我使用Runtime
exec
称呼它
wscript my_script.vbs
And it works. 而且有效。
Now I want to distribute the application as a jar. 现在,我想将应用程序分发为jar。 Where should I put the script?
我应该把脚本放在哪里?
您可能想考虑一个名为resources
或scripts
的文件夹,该文件夹与src
或bin
文件夹处于同一级别。
Include the file in your JAR. 将文件包含在您的JAR中。 The first time you need it, copy it from the JAR:
第一次需要它时,请从JAR中复制它:
this.getClass().getResourceAsStream("my_script.vbs");
And store it in the Application Data directory: 并将其存储在Application Data目录中:
File file = new File(System.getProperty("user.home") + "/Application Data/MyApp/my_script.vbs");
Run it as needed from there. 从那里根据需要运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.