[英]Invoke exe file from spring boot application
I have somefile.exe in my local and i am currently invoking this exe using process builder by giving absolute path like below我的本地有 somefile.exe,我目前正在使用进程生成器通过提供如下所示的绝对路径来调用此 exe
ProcessBuilder builder = new ProcessBuilder();
builder.command("C:\\path\\to\\the\\somefile.exe","other commands");
I am using spring boot and i dont want to hardcode the absolute path to local, instead i want to make the exe available in project folder.我正在使用 spring 启动,我不想硬编码到本地的绝对路径,而是想让 exe 在项目文件夹中可用。
Where should i put the exe in project folder?我应该将exe放在项目文件夹中的哪个位置? I tried placing the exe file in resources folder but does not work.
我尝试将 exe 文件放在资源文件夹中,但不起作用。
put the exe file in src/main/resources
folder.将 exe 文件放在
src/main/resources
文件夹中。 then you can access it from root of the class path.然后您可以从 class 路径的根目录访问它。 see this guide for accessing files in your classpath.
请参阅本指南以访问类路径中的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.