FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Java Problem





ncwdavid
Hey, I have installed the jdk in C: directory. I have changed the variables to point to the directory. When I type javac in the Run|command| it works fine. Now when I want to debug something or whatever its called it always comes up with one error found. Where do I save my files to get them to run?

This is what I do in command:
java c:\desktop\FirstProgram.java

and even if the file has no errors it comes up one error found or if it has 100s of errors it still comes up one error found. What do I do?
HoboBarticus
Make sure you're on the right desktop...
ncwdavid
I am. Im not that stupid
HoboBarticus
haha, just got to make sure. You'd be surprised how many people I have to deal with in College that do that.

Outside of that, yea, whats the error?
ncwdavid
It says:
Exception in thread "main" java.lang.NoClassDefFoundError: c:\desktop\FirstProgram\java

Thats the error. Even if there is more errors then one in program its always say one error found even if there is definetly none.
HoboBarticus
Theres something wrong with your paths somewhere. Couldnt tell ya which though
Nyizsa
ncwdavid wrote:
This is what I do in command:
java c:\desktop\FirstProgram.java

The extension must not be specified. Use this command instead:
Code:
java c:\desktop\FirstProgram
Stubru Freak
Quick guide to compiling and running a java program

Make your source code file. The name should be NameOfPublicClass.java

Then, use javac to compile it:
Code:
javac "/path/to/NameOfPublicClass.java"

(I'm using forward slashes because I'm on Linux. On Windows, use backslashes.)

After compilation, you will get some .class files. Those are the actual java executables.

Run them this way:
Code:
java "/path/to/NameOfClassWithMainFunction"

Note that even though the file would be called NameOfClassWithMainFunction.class, you should not write the .class in the java command.
yy1124
If you need an IDE, which you might since it makes things easier, you might wanna check JCreator out...

I used it all the time when I am doing Java few years ago, and its free~
Related topics
Internet crashes, getting the following error...
Java bufferedReader problem
problem z services.exe
Javascript problem...I think :S
just a java problem
Java classpath problem
problem with java script file
JAVA CLASSPATH
Problem with javax.sound.midi (Java)
Java/C++ helpers
java applet refresh problem
java problem
PHP inside HTML tags?
Java runtime problem
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.