GeeCON Prague 2014*
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


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can Watch "can New topic
Author

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 helloworld.java " .
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...
bye..
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'. http://www.javaranch.com/name.jsp

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
Greenhorn

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. - What truth? - That there is no spoon!!!
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Lakshmi,
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: http://aspose.com/file-tools
 
subject: can't able to run java program