• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

can't able to run java program

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems you have not set the classpath properly .
Also add '.' ( for current directory ) in the classpath .
 
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic