• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Running the java program

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam trying to run the java program which i have written in notepad, it is compiling properly, but it is not running when i gave the command as

java filename

The error message it is showing as

Exception in thread "main"java.lang.NoClassDefFoundError: customer

customer is the file name

for any other java program also it is showing like the same error.

kindly help me out to run my java programs, as what might be the problem.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at this from Sun's Tutorial. The section "Runtime Problems" may help you solve the problem.
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I hope you are doing okay.

Such errors are given, if the class is a driver class or it
doesnt have a main method. Does your class contains the main
method or when you are invoking the classes from the Driver program
are you doing the instantiations properly?

 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's more likely that this is a classpath issue. The Tutorial section Barry linked to probably explains that.
 
Greenhorn
Posts: 26
Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take this example

if your file location is
c:\fol1\filename.java and use classpath as
----> java -classpath "c:\fol1" filename

I think this will solve your problem
 
Sireesha ikkurthi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Gaunt:
Take a look at this from Sun's Tutorial. The section "Runtime Problems" may help you solve the problem.



Thankyou for helping me with the sun tutorials to solve the problem.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
acutally the problem is on the classpath that is the JVM cant able to find the class before compling any java program you have to set classpath for the JVM in dos console

the command is c:>set classpath=%classpath%;.;

after giving this and type javac filename.java and run the java command

By
Arun
maild id:eeearun@gmail.com


 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Arun Gokul:
acutally the problem is on the classpath that is the JVM cant able to find the class before compling any java program you have to set classpath for the JVM in dos console

the command is c:>set classpath=%classpath%;.;

after giving this and type javac filename.java and run the java command

By
Arun
maild id:eeearun@gmail.com




The problem has already been solved
 
A wop bop a lu bop a womp bam boom! Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic