This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 136
Android Eclipse IDE Windows XP
  • 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 .
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is under a jar named console.jar
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Already tried but the same error.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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
  • 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
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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
  • 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
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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
 
Marshal
Posts: 70351
283
  • 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.
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic