I'm a first time Java programmer and I'm having trouble compiling/running code. I installed jdk and I'm using windows XP MCE. I can get javac.exe to create a .class file but when I try running it with java.exe I get an error

Please help. Thanks!


http://img121.imageshack.us/img121/6788/javanowork.jpg

Recommended Answers

All 7 Replies

You type java Hi , there is no need to specify the ".class" to run your program. Also, you will need a main method in that class to run the program.

Try run it without the .class extension:
> java Hi

Then post the error that you will get :)

commented: snap +3

Please mark as solved.

java extension are file.java

perhaps you should try to use eclipse to make your java codes

I'm a first time Java programmer and I'm having trouble compiling/running code. I installed jdk and I'm using windows XP MCE. I can get javac.exe to create a .class file but when I try running it with java.exe I get an error

Please help. Thanks!


http://img121.imageshack.us/img121/6788/javanowork.jpg

java extension are file.java

perhaps you should try to use eclipse to make your java codes

This thread has already been solved and you added no additional information.
Also using eclipse will not solve the problem but it will make it bigger because the user will not have learned a thing about java. Now he knows that compiled files end with .class and he knows how to execute them. And I assume he knows how to set the classpath.
If he had gone with eclipse, he would be running the code without knowing how .class files work or how to run a single java file. That is not learning.

why ?
Are you jealous because somebody else besides you tried to help?

Eclipse is a good tool, and it is well used in many environments, like universities,(Stanford, BYU, MIT, UCLA) and companies like IBM. HSBC, and many others.

what you said it no sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.