This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes can't able to run java program 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 » Beginning Java
Bookmark "can Watch "can New topic

can't able to run java program

Priya Sri
Ranch Hand

Joined: Mar 30, 2004
Posts: 84
hello friends,
I am a begginner to learn java.I am able to compile the program using

executable file by giving " javac " .
Its worked fine and created a class file in the same directory.
But, when tried to run using the statement " java helloworld " ,
I am repeatedly getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
I think u can understand my problem.
Help me to learn java..

Waiting for ur replies..
thank u...
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Hi 'Java Gal'.

Your display name doesn't match our naming guidelines. Please change it to a 'real name'.

And this is a Servlet Forum. Your program is well.. "hello world". So I'll move this to Java In General - Beginner's Forum. You'll find plenty of help there.
Kishore Shewani

Joined: Jan 23, 2004
Posts: 14
It seems you have not set the classpath properly .
Also add '.' ( for current directory ) in the classpath .

Toil and see your dreams coming true. <br />:-)
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
It doesn't seem like a path problem to me, perhaps you want to double check your main method signature, it should be

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Note that we require display names of the format First Name(s) + SPACE + Last Name.
Thanks Pardner! Hope to see you 'round the Ranch!
As suggested above, your problem likely stems around the CLASSPATH value.
If you use the following command, does the program run?
java -classpath . helloworld

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: can't able to run java program
Similar Threads
Calling java from C
running HelloWorld
Why does my java program only run with -debug in my parameters
JNI Program RunTime Exceptions
java on command