File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting a java.lang.ClassNotFoundException on installing a setup file

 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a setup file containing a Jar files and that setup is working perfectly alright in some systems but in some other systems it is failing to install and showing the error -

C:\Program Files\Java\jre1.6.0_04\bin>"C:\Program Files\Java\jre1.6.0_04\bin\jav a.exe" -cp ..\config;console.jar gui/MainClass Exception in thread "main" java.lang.NoClassDefFoundError: gui/MainClass Caused by: java.lang.ClassNotFoundException: gui.MainClass
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)


I checked the JRE version and class path and it seems everything is fine .
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is gui.MainClass ?
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is under a jar named console.jar
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try with "C:\Program Files\Java\jre1.6.0_04\bin\java.exe" -cp ..\config;console.jar gui.MainClass
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Already tried but the same error.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you put console.jar ?
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a software named installed shield to create the setup and all the packages I am putting in the recommended directory
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which directory is console.jar ? Your java command line implies that the JAR is in the current directory (C:\Program Files\Java\jre1.6.0_04\bin)
 
buntha Choudhary
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No my jar is not in this directory but we map that to a recommended directory.
1 main question , If I am using the same set up in different system there I am not getting this error then why in other one I am getting an exception , so it means the setup is ok
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't give the fullpath of console.jar, the JVM will look for it in the current directory.
Why does it work in other configurations ?
1. console.jar is in the current directory
2. or, you have the gui.MainClass.class somewhere in the CLASSPATH
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why are you working in the Program Files directory in the first place. You should create a "java" folder somewhere (eg MyDocuments) and keep well clear of Program Files.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic