Google Answers Logo
View Question
 
Q: Compiling and working with Java ( No Answer,   2 Comments )
Question  
Subject: Compiling and working with Java
Category: Computers > Programming
Asked by: qwertypoiuy-ga
List Price: $4.50
Posted: 16 Jul 2004 13:01 PDT
Expires: 16 Jul 2004 18:02 PDT
Question ID: 375094
I have recently installed Java(TM) 2 SDK, Standard Edition 5.0 Beta 2
on my Windows XP to C:Java5, I am using a book to learn java named'
Java(TM) 2 For Dummies, I'm in the second chapter and I have altered
my system path to have C:Java5\bin  and I can get the javac command to
work fine with MortgageText.java. I cannot however to get the java
command to work in the command prompt. I am in the right folder with
the MortgageText.class(C:JavaPrograms), have set the path, spelt the
new file, MortgageText.class in every way and I still get this error
when i type java MortgageText (.class or not)... Exception in thread
"main" java.lang.NoClassDefFoundError: MortgageText.... the dir
command insists the file MortgageText.class is there, but i get the
error i get when i put in a bogus file name when i put
MortgageText.class. I will post a screenshot of all the commands i
have done from scratch if you want me to, I'll also cut/paste the
MortgageText.java text if requested. Question is, what can I do to
make this work? 5$ Tip if you can get it to work corretly.

Clarification of Question by qwertypoiuy-ga on 16 Jul 2004 18:01 PDT
thanks guys
Answer  
There is no answer at this time.

Comments  
Subject: Re: Compiling and working with Java
From: macabre-ga on 16 Jul 2004 14:27 PDT
 
You say you altered your "system path." Assuming that's not a typo,
what you need to do is setup your "class path." In Java, any class
that you care to execute has to be in your classpath, which is sort of
like the system's path variable but specific to the Java runtime. You
can do this at the command line by typing "set
CLASSPATH=C:\JavaPrograms" (without the quotes) or by creating a new
environmental variable in the System control panel, "Advanced" tab.
Subject: Re: Compiling and working with Java
From: macabre-ga on 16 Jul 2004 14:30 PDT
 
I should add that you can accomplish the same thing by using the
"-classpath" parameter when you run the java runtime, as in "java
-classpath C:\JavaPrograms MortgageText"

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy