wood burning stoves
The moose likes Beginning Java and the fly likes Compiling at MS Dos prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compiling at MS Dos prompt" Watch "Compiling at MS Dos prompt" New topic

Compiling at MS Dos prompt

LoryLee Moore

Joined: Jul 25, 2004
Posts: 1
I've been trying to compile my java programs at the MS Dos prompt.
I keep getting one of two errors....
"Can't determine application home" and
"Exception in thread "main" java.lang.NoClassDefFoundError: c:\Program"

Can you help me?
Thank you.
Darin Niard
Ranch Hand

Joined: Jun 08, 2004
Posts: 118
Which JDK do you have installed? What exactly are you typing into the prompt?

I think you may need to reinstall the JDK, but I'm not sure.
Aj Mathia
Ranch Hand

Joined: Apr 11, 2003
Posts: 478
Hi Lorylee
the problem is surely in your classpath or just path
try this in cmd prompt type
set classpath=%classpath%;c:/abc/

where abc is the dir where your compiled java class is located

there is a simpler way to ot and thats something like
set classpath=%classpath%;\.
i am not too sure if it is \. or /. or just . or somthing in this likes
try tese comb and u will get it
or someone else who is sure of this will post a msg

You think you know me .... You will never know me ... You know only what I let you know ... You are just a puppet ... --CMG
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
Perhaps you had a different version of the jdk installed previously?? According to Roedy Green, you should
"Uninstall all Java JDKs and JREs with the control panel. Use Microsoft's RegClean. Tidy up the registry with regedit. Reinstall just the latest JDK."

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Aj Mathia
Ranch Hand

Joined: Apr 11, 2003
Posts: 478
yes i had a quick check it should be set classpath=%classpath%;.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, LoryLee!

After following Marilyn's advice on reinstalling your Java development and runtime environment, you might still have a problem concerning your CLASSPATH setting. Unless you're regularly using some third party libraries during your development and running of Java applications, I'd suggest that you either don't explicitly specify a CLASSPATH, or set your CLASSPATH to only include the current working directory, specified by a period.

Take a look at our FAQ on setting the CLASSPATH for steps on just that.

If you've further problems and questions, don't hesitate to ask. It'll possibly also be useful for those trying to help you if you were to post the results of what happens when running the following command.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ken Okoli

Joined: Dec 19, 2003
Posts: 3
Hi Lorylee
the problem maybe in your classpath or just path
i guess your compiler does not know where you put your program
1. make sure u save your files in the "bin" directory
i mean for example:
"save as" locate where you installed JDK. Typically, on "C drive" then "jdk1.4.1" then "bin" then "save"
2."start" then "run" then type "sysedit" then add:
set classpath=%classpath%;c:\jdk1.4.1\bin and then save your work.
3. Test by going to dos prompt and typing "path"
you should see your path added......at least that's what i think.
N.B always save your programes with extension ".java"

I agree. Here's the link: http://aspose.com/file-tools
subject: Compiling at MS Dos prompt
It's not a secret anymore!