简体   繁体   中英

How do I bind 2 java files so they both open when I run the jar file

I think this can be done in eclipse? But how.

Basically what I want is to turn 2 java jars into 1 jar file and when I run it they both run.

There may be other ways, but one way to do this is by running the second jar file through the first file. You can run the second file as:

String cmd = "java -jar "+getClass().getResource("secondFile.jar").getPath().substring(1);
Runtime.getRuntime().exec(cmd);

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