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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java stopped working" Watch "java stopped working" New topic

java stopped working

sharingan reddy

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.

you see my java suddenly failed
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41068
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 - my free Android networking tools app
I agree. Here's the link: http://aspose.com/file-tools
subject: java stopped working
Similar Threads
running a .class file from inside a jar
Basic package problems
what is the problem with this code
Interface - AbstractClass Collision