Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compiler Question 1

Status
Not open for further replies.

IronRocket

Technical User
Dec 28, 2005
74
US

I'm new to Java.

I downloaded J2SE and am trying to compile a simple program by using javac on the command line of dos. It doesn't work. Just wondering how I can compile and run a program using J2SE. Remember, Java is a whole new world to me.

 
You're probably running afoul of some path defaults. Try fully qualifying the path to javac as well as to your .java. Then you'll probably want to make sure you're looking in the right folder for the class files.

_________________
Bob Rashkin
 
After I wrote the message, I put the file in the bin and it compiles. Now, I'm trying to run the thing by typing java Howdy (Howdy is the name of my class). It's giving me this message: "Exception in thread 'main' java.lang.NoClassDefFoundError: Howdy"

My code looks like this:

public class Howdy {
public static void main(String arg[]) {
System.out.println("Howdy Y'all!");
}
}

I don't see any problem w/ this. Am I missing something?
 
Check out the FAQs for this forum. There are some articles for beginners which will help you.

Tim
 
Thanks guys for the help.

What I did was did a "Set Classpath=c:\j2sdk1.4.2_11\jre\bin". I then put my java file and class in that directory and the program worked. Took me over 3 hours, but it finally worked out in the end.
 
@IronRocket:
A working, but bad decision.
If you update to java-1.6, you'll have to find out what is your code, and what is SUNs.

Make a development-folder and put that in your classpath.
Lern about your systems way to handle paths and directories.

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top