简体   繁体   中英

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

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.

Where should i put the exe in project folder? I tried placing the exe file in resources folder but does not work.

put the exe file in src/main/resources folder. then you can access it from root of the class path. see this guide for accessing files in your classpath.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM