Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about runnable JARs

 
Silly Pants
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written some small programs and I am attempting to make my first runnable JAR file. The program will run fine within Netbeans and Eclipse. However, when I create my runnable JAR, the resultant JAR gives me an error saying that the program can't find my main class when I try and execute it. What I don't understand is how the compiler can find my main class to compile the program and yet the final executable code can't find it to run it? Is there some file I can open up and type my class locations into by hand?

Also, on a related not, I was hoping someone might be able to help me with something. So far, the books I have found about Java programming only talk about coding and not a lot about how to configure my settings in the IDE (which consume about 95% of my time spent on the subject). So far, I like coding and grinding out a solution in code and feel that I haven't struggled nearly as much on the material in the books I've worked through as I have on battling with configurations and IDE settings and such, yet I find it a lot easier to find reading material and instructional posts about coding than I do about the more difficult issues.

Can anoyone here recommend any good books on Eclipse or Netbeans?
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You would need to have a Manifest file with the following detail:



And then you can execute it using the command:



Raj.

 
Campbell Ritchie
Sheriff
Posts: 48394
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

If you are new to Java™, you would do better to forget IDEs and get a decent text editor (eg gedit, NotePad2, NotePad++). Set its options to automatic indentation (change 1 tab to 4 spaces), bracket and syntax highlighting. Use that to edit your Java™ text and run it from the command line. That way you won’t spend 95% of your time on the IDE.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic