File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Won't load class from JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Won Watch "Won New topic
Author

Won't load class from JAR

Chris Masters
Greenhorn

Joined: Apr 13, 2001
Posts: 21
This problem is a continuation of a problem I submitted several days ago. I am using Java 1.1.x development evironment in particular I am using JBulider2. Anyhow, I am having an issue with an application I have just finished designing. I have made a jar that contains all the project files, but when I run the jre it fails. It issues the error "unable to load CAPExp.AppMain class". I have confirmed that all the classpath references are correct, and that they match in case. I have also opened up the JAR and confirmed that the class is in the archive. I don't know where to go from here any ideas?
Mark Savory
Ranch Hand

Joined: Feb 08, 2001
Posts: 122
Is your jar file declared explicitly by file name in the classpath?
[This message has been edited by Mark Savory (edited April 18, 2001).]
Chris Masters
Greenhorn

Joined: Apr 13, 2001
Posts: 21
Yes I do have the jar explictly expressed in the classpath.
Magesh Lakshmi
Greenhorn

Joined: Nov 09, 2000
Posts: 7
1. Try recompiling all your classes once again as there could be chances that one of ur main class is corrupted.
2. Check the main class whether it has a static main method for the jvm to load the main class.
3. Check the package name and class name for any typos.
Chris Masters
Greenhorn

Joined: Apr 13, 2001
Posts: 21
Checked Checked and Checked. I tried disabling all but the absolute most essential code and it loaded. I now going through and reactivating it in parts. Do you have any idea why it would compile in my deevelopment environment and then not work once I put it in a jar?
Chris Masters
Greenhorn

Joined: Apr 13, 2001
Posts: 21
After experimenting a bit more its seems it won't load because I am using a JFrame class to hold my application. When I change it too a normal Frame class it loads. There are compiling erros though when I use the Frame class implementation. Is there away to call them JFrame from the Frame class?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
JFrame is part of the SWING stuff that came out with Java2. The 1.1.X versions had various amounts of beta classes for swing, but for the most part do not allow you to use it.
So you either need to upgrade the version of the SDK/JRE that you are using to at least 1.2 or use the AWT components exclusively.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Won't load class from JAR