It's not a secret anymore!
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 REST with Spring (video course) this week in the Spring 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
^_^ cat

public class x {

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


^_^ javac
^_^ java x
Exception in thread "main" java.lang.NoClassDefFoundError: x
Caused by: java.lang.ClassNotFoundException: x
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
Could not find the main class: x. Program will exit.

you see my java suddenly failed
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
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.
I agree. Here's the link:
subject: java stopped working
It's not a secret anymore!