Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't able to run java program

 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems you have not set the classpath properly .
Also add '.' ( for current directory ) in the classpath .
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't seem like a path problem to me, perhaps you want to double check your main method signature, it should be
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic