PDA

View Full Version : .Jars and Manifests




Wes
Jun 7, 2004, 02:34 PM
I'm testing a small java programa and I want to check compatability before I go further. I have two files in a package called EE. One is Viewer.java and the other is FileDisplay.java

I'm using Eclipse and have made a folder called META-INF with a text file inside with MANIFEST.MF with the contents
Manifest-Version: 1.2
Main-Class: Viewer
Specification-Title: "Extended Essay"
Created-By: 1.4 (Sun Microsystems Inc.)


When I try to run this program I get an error and in console it says:
Exception in thread "main" java.lang.NoClassDefFoundError: Viewer

I read the package could be messing this up, help?!



jeremy.king
Jun 7, 2004, 04:38 PM
Does the Viewer.java class have a method with the following signature?

public static void main(String[] args);

To execute, there must be a static main method.

Wes
Jun 7, 2004, 04:40 PM
public static void main(java.lang.String[] args) { That okay?

I removed java.lang and compiled but still the .jar will not run, I can run it as a .class, it's just making the executable .jar that fails.
Edit: Here are the files: http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/Magercises/M3/index.html
The seconds ones.
Thanks!

FritzTheWonderM
Jun 7, 2004, 05:33 PM
you need to specify the fully qualified name of the class. You said the package name was EE (should be lower case by the way) so you should have:

Main-Class: EE.Viewer

Wes
Jun 7, 2004, 05:53 PM
Still not working, you can see most of the settings on screen there. thanks so far!