• Post Reply Bookmark Topic Watch Topic
  • New Topic

Run Eclipse Java Project from batch file  RSS feed

 
Ahsan Bagwan
Ranch Hand
Posts: 254
1
Java MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a Java Project made in Eclipse. But I'm required to execute this project via batch file.

I'm having the 4 packages in src folder as:

com.companyname.dao
com.companyname.main
com.companyname.util
com.companyname.vo

While also having the bin folder that is output the compiled class files (the usual Eclipse thing I believe). The jars are put into the root directory.

So my question is do I compile all the individual files? Does handling all classpath issues worth it? Or could I create the JAR of the project before adding it to the .bat file?

I hope this is the correct forum to post this question.

Posting the .classpath





 
Gourav Gupta
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure but you can try this way.... As you are using eclipse. First, export the whole program as a executable jar. You can do this by going to Files>Export and then in the pop up go to Java>Runnable Jar. Then follow the required steps.

Next you need to make a .bat file and write the below code:
start javaw -jar NameOfJar.jar

Make sure that you put the file in the same directory as your jar. Now you should be able and click on the .bat and execute the program.
 
Vyacheslav Petc
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use build tools like gradle, maven, ant etc
You will be able comile all your classes, build jar and war files, set up your eclipse projects etc

I suggest you investigate it tools
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!