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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

just getting back into java, have easy question 1

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
import java.io.*;

public class lab
{
public static void main (String[] args)
{
System.out.print("Hello");
}
}

Above is my nothing of a program. It compiles, but when i run it, i keep getting:

Exception in thread "main" java.lang.NoClassDefFoundError: lab/java

Whats the deal with this.
 
You get the message 'No class Def found: "lab/java"' - so you must have called:
java lab.java

but you first have to compile your class.
Note, by convience, 'Lab' would be an appropriate class-name, which must be reflected in the filename: 'Lab.java' too.

compile it:
javac Lab.java

run it:
java Lab

(You run the .class-File, but here you omit the extension).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top