• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Run Eclipse Java Project from batch file

 
Ranch Hand
Posts: 254
1
MySQL Database Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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





 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic