aspose file tools*
The moose likes Java in General and the fly likes getting a java.lang.ClassNotFoundException on installing a setup file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting a java.lang.ClassNotFoundException on installing a setup file" Watch "getting a java.lang.ClassNotFoundException on installing a setup file" New topic
Author

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

buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Where is gui.MainClass ?

[My Blog]
All roads lead to JavaRanch
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

It is under a jar named console.jar
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Try with "C:\Program Files\Java\jre1.6.0_04\bin\java.exe" -cp ..\config;console.jar gui.MainClass
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

Already tried but the same error.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Where did you put console.jar ?
buntha Choudhary
Ranch Hand

Joined: Jul 03, 2009
Posts: 136

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Jul 03, 2009
Posts: 136

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Oct 13, 2005
Posts: 36508
    
  16
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
 
subject: getting a java.lang.ClassNotFoundException on installing a setup file
 
Similar Threads
log4j:ERROR Could not instantiate class
Trying to run my first program: java.lang.NoClassDefFoundError
Test class cannot find other class
PATH & CLASSPATH?
java compile trouble