Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Won't load class from JAR

 
Chris Masters
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I do have the jar explictly expressed in the classpath.
 
Magesh Lakshmi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic