• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

NoClassDefFoundError

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I looked at all the other posts re this topic but still don't have an answer. And this is too simple to be in anything other than beginner.

My application is not finding a class file enclosed in a jar file. Specifically, I use com.ibm.as400.access.as400.class from jt400.jar (which is in my classpath. I'm not familiar enough with this type of directory structure (com.ibm.as400.access) to solve this problem. But I think the issue is with the classpath.

The specific error looks like this:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/access/as400 at .....

Your help is appreciated.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by tony maro:
...My application is not finding a class file enclosed in a jar file. Specifically, I use com.ibm.as400.access.as400.class from jt400.jar (which is in my classpath...


Welcome to JavaRanch!

How exactly is this specified in your classpath? If the class is in a jar, then it's not enough to specify just the directory that contains the jar -- you need to include the jar itself in the classpath. That is, all the way through (including) "...jt400.jar".
[ May 18, 2006: Message edited by: marc weber ]
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by tony maro:
I looked at all the other posts re this topic but still don't have an answer. And this is too simple to be in anything other than beginner.

My application is not finding a class file enclosed in a jar file. Specifically, I use com.ibm.as400.access.as400.class from jt400.jar (which is in my classpath. I'm not familiar enough with this type of directory structure (com.ibm.as400.access) to solve this problem. But I think the issue is with the classpath.

The specific error looks like this:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/access/as400 at .....

Your help is appreciated.




Great, to see the problem again.

There are 3 possiblities.

1) you might not have included the jar file in the classpath. first verify whether you have included the jar file in the path. then try to run it.

if still you get the problem then proceed to step 2.

2) another problem is the access rights of the jar file. please verify whether you have read and execute rights for that particular jar file. if not then modify the access permissions then try to run it.

if still you get the problem then procees to step 3.

3) check the java policy file of that particular jar file. whether it is compitable to your java version or not.

if still you get the problem the post the java file to ranch surface.

Thank you.
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the API documentation. The class name is "AS400" with uppercase letters.
 
Tony Maro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all (3) for your responses. Here's more details I'm using a .bat file to execute this. MyJar.jar is located in "subdirectory". Obviously some names changed to protect the innocent. My .bat looks something like this.

cd \program files\java\subdirectory
java -cp .;c:\prog~01\java\jt400.jar -jar MyJar.jar

DOS execution window follows;

C:\>cd \program files\java\subdirectory

C:\Program Files\Java\subdirectory>java -cp c:\prog~01\java\jt400.ja
r -jar MyJar.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/as400/access/
AS400
at subdirectory(MyJar.java:86)
at subdirectory.MyJar.main(MyJar.java:70)

The issue seems to be that the class AS400 is embedded in the directory structure "com.ibm.as400.access" within the jar file. Regarding the reply to check access rights and stuff, I don't know how to do that.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

The folder structure in the jar is correct, as it reflects the package structure of the class. So if I created a jar with a class called com.myapp.KillerApp.class, the KillerApp class would have to be in a folder called myapp, which was in a folder called com.

Ramen
 
Good night. Drive safely. Here's a tiny ad for the road:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic