aspose file tools*
The moose likes Java in General and the fly likes java stopped working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java stopped working" Watch "java stopped working" New topic
Author

java stopped working

sharingan reddy
Greenhorn

Joined: Feb 14, 2010
Posts: 8
hey guys i did a simple hello world in x.java
^_^ cat x.java

public class x {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hi vishu");
}

}

^_^ javac x.java
^_^ java x
Exception in thread "main" java.lang.NoClassDefFoundError: x
Caused by: java.lang.ClassNotFoundException: x
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: x. Program will exit.
0_o

you see my java suddenly failed
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
You need to set the classpath properly. Try "java -classpath . x" (note the dot in there, which means "use the current directory as classpath").

In case you're using the CLASSPATH environment variable, I generally advise not to use it; it's more trouble than it's worth.


Ping & DNS - updated with new look and Ping home screen widget
 
 
subject: java stopped working
 
Similar Threads
Interface - AbstractClass Collision
Basic package problems
what is the problem with this code
java.util.regex?
running a .class file from inside a jar