Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

runtime error  RSS feed

 
rb guru
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay i thought i had finally found a solution to running the sourccode in the java book i am reading ,thinking in java 3rd edition but now i am boxed in another corner ,okay see my new problem the source code i am trying to run imports the simpletest .java file that was created to test all the code inthe book so now when ii compile the program it compiles but when i attempt to run it gives aruntime error"Exception in thread "main" java.lang.NoClassDefFoundError: Assignment"now i do not know what this means and from all i understand all the code in the book have been sufficiently tested so i doubt if code in chapter 3 could possibly be wrong.i need urgent help i have java 1.4.1 installed on my redhat linux system.
 
rb guru
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys i am desperate for an answer i. i just read a post on a similar problem saying one way to check for what is wrong is to try setting the classpath to the directory in which the class file is located. but i dont know how to achieve this i would love to have a step by step guide on how to do this on a linux system.
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is to include the classpath in the java command:

The dot represents the current directory.
You can also set a value for the environment variable CLASSPATH, using export. The following works under Cygwin bash:

-Jeff-
[ April 01, 2004: Message edited by: Jeff Langr ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have any CLASSPATH on my linux.
I just have 'JAVA_HOME=/opt/java' in my '/etc/profile'.
This will find the jars of the jdk/ jre.
'The directory where the class is located' isn't right.
Right is:
'The directory where the package is located'.
If you import an own (or 3rd party) package, your class must be defined to be in a package too.
PS: Your posting is very bad readable.
Try to use sentences in future.
Run a spellchecker.
And someone of the forum will come around - sooner or later, and tell you to use a real name (something, a rancher thinks, it looks like a real name in his culture).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!