Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating JAR File - Eclipse or otherwise

 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to create an executable JAR file in Eclipse. I'm getting this error:

Could not find the main class my1.first.package.Boot. Program will exit.

To simplify things I created a very basic 1 class program to try and find the problem and get the same result. If I try and do it with the following command line:

jar cf Test.jar Tester.java

I get a new error:

Failed to load Main-Class manifest attribute from C:\Users\Me\Desktop\Project\Test.jar

I'd really like to package this up with Eclipse but any help is much appreciated. I can't figure this one out alone!

Cheers.
 
Jay Orsaw
Ranch Hand
Posts: 356
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Finn wrote:Trying to create an executable JAR file in Eclipse. I'm getting this error:

Could not find the main class my1.first.package.Boot. Program will exit.

To simplify things I created a very basic 1 class program to try and find the problem and get the same result. If I try and do it with the following command line:

jar cf Test.jar Tester.java

I get a new error:

Failed to load Main-Class manifest attribute from C:\Users\Me\Desktop\Project\Test.jar

I'd really like to package this up with Eclipse but any help is much appreciated. I can't figure this one out alone!

Cheers.


In Netbeans when I set the main class it is PackageName.ClassName so if "Tester" is your class it would be Package.Tester.... If it's the same in Eclipse you have to find it and set it in the properties.... I right click my node and goto properties, then goto the run section and it says "Main Class." I'll try and find my Eclipse and see if I can help you out from there, but hopefully this helps out a bit. I'm not sure if this is your actual error though, but I know when I have my main set incorrectly, the Jar wont run, and that's what the error seems(I haven't run it from the cmd line...)
 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Tester class was made without a package so it really is just "Tester". The manifest file all seems in order so I don't understand why it can't find the Main class. I appreciate your help so far!
 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear god I'm stupid. My Java runtime environment was massively out of date. Runs perfect first time. Exasperatingly foolish.

Thanks for your help once again, glad I got there in the end.
 
Jay Orsaw
Ranch Hand
Posts: 356
Android Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Finn wrote:Dear god I'm stupid. My Java runtime environment was massively out of date. Runs perfect first time. Exasperatingly foolish.

Thanks for your help once again, glad I got there in the end.


Oh yeah I forgot that you have to make sure your version and the jvm version are the same... I use both 6/7 so yeah that happens too... Glad you figured it out.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Finn wrote:Dear god I'm stupid. . . .
I’m sure you are mistaken there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic