This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

NoClassDefFoundError  RSS feed

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set path variable as "C:\glassfish3\jdk\bin\java" but its not working. SO I am giving complete path on command line. WHen I compile as "C:\>c:\glassfish3\jdk\bin\javac C:\Users\Admin\Desktop\jsp\ReadAndWriteFromFile.java" File is getting compiled and class file getting generated in jsp dir.

Now when I try to run this class file as follows, I am getting error.
Why am I getting such an error ? Why is path variable not getting set ? Whats this glassfish ? Can I not download jdk6 without glassfish ?

Thanks
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're confusing the path and the classpath variables. I would advise you to read about them and not to use the classpath environment variable.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does the question of PATH and CLASSATH arise, when I am giving complete path on command line for the class file ?
 
Java Cowboy
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\>glassfish3\jdk\bin\java Users\Admin\Desktop\jsp\ReadAndWriteFromFile
Exception in thread "main" java.lang.NoClassDefFoundError: Users\Admin\Desktop\jsp\ReadAndWriteFromFile (wrong name: ReadAndWriteFromFile)


You're using the java command in the wrong way.

With the java command, you have to specify the fully-qualified class name of the class you are running, and not a file path. Use the classpath to specify which directories and JAR files Java must look in to find your class. Try this:

java -cp Users\Admin\Desktop\jsp ReadAndWriteFromFile

Glassfish is Oracle's reference implementation of the Java EE standard. Ofcourse you can download JDK 6 without Glassfish. But if you want to run JSPs, you do need a web container (you can't run JSPs with Java SE 6 alone).
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I installed Java EE from sun.java.com with glassfish and then I was trying to open a page which required Java. I was getting error "Java is not installed". I clicked on the link that came alongwith message and it led me to java.com. I installed java from that link again and it started working. SO whats going on over here ? Why is Java EE not getting installed ? If its not getting installed, why am I not getting an error message and instead I am getting message "installation successful" ? How can I install Java EE , if its not working from java.sun.com ?

Thanks
 
What's that smell? I think this tiny ad may have stepped in something.
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!