javaeclipsejar

Eclipse conversion to .jar not working


I have written a program in eclipse that has several linked libraries. Inside of my src folder I have the package file with the .java file inside then 3 files inside of the src file. When I run the program from eclipse it works fine. However when I try to export it as a jar or try compiling it to a jar file from cmd I get an error saying "Failed to load Main-Class manifest attribute from Remote.jar" When I run the jar wizard in Eclipse I choose my manifest.text that contains "Main-Class: HelloWorld " Which is the name of my main class....Any ideas what can be going on?

Thanks


Solution

  • The name of your main class, is the class with the main(String[] args) method that starts your program. You can have more than one in a jar, therefore you must state which one to use.

    You may want to study the "executable jar" format a bit more as there are a few things that must be done right for this to work. See http://download.oracle.com/javase/tutorial/deployment/jar/appman.html for details, and consider reading the whole trail.