简体   繁体   中英

How can i run two java applications using a batch file?

I want to run two java applications located in two different projects in eclipse at the same time automatically , I guess using a batch file is the best way to do this. Is that correct? or there are better ways?

If it's the best way, what would be the syntax for the batch file? Do I need to have jar files for the projects? Does batch files work only on windows?

start java path\of\first\class
start java path\of\second\class

This will launch both at the same time, assuming that's what you're looking for. The applications don't have to be packed in a jar, you can also pass the path of the class containing the Main you'd like to run. You might have to pass a few more arguments (such as classpath), depending on your setup.

And yes, this will only work on Windows (and possibly on Dos).

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