aspose file tools*
The moose likes Beginning Java and the fly likes Cannot get simple java file to run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot get simple java file to run" Watch "Cannot get simple java file to run" New topic
Author

Cannot get simple java file to run

Hui Ge
Greenhorn

Joined: Mar 11, 2005
Posts: 25
i created Test.java in directory tryout:

package tryout;

class Test {
public static void main(String[]args) {
System.out.println("testing...");
}
}

compiled and run the file "java Test" and got this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Test (wrong name: tryout/Test)

What could be wrong?
Surasak Leenapongpanit
Ranch Hand

Joined: May 10, 2002
Posts: 341
Try ..
javac tryout/Test.java
java tryout.Test
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Try making the Test class public.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: Cannot get simple java file to run