• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

java.lang.NoClassDefFoundError

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello evryone
i am running a class from commandline in linux environment but i am getting java.lang.NoClassDefFoundError when i run the class. I am very confused about packages when running in command line. please can you tell me how to declare correct packages when developing a program without using any IDE. when i use IDE it wont be a problem but if i use some editor then i am very confused about that. Below is my program. please help me how to run the program?

package is start from the root. that is current directory is /media/Movies/eshwar/myjava
And Am using below command to run the program.Even though UseCaseTracker.class file in the currect direcotory i can't execute that.
java UseCaseTracker
 
Marshal
Posts: 79716
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class is no longer called UseCaseTracker but media.Movies.eshwar.myjava.UseCaseTracker.
Look at the links in this old post. Some of them will be useful … and some not!
 
Eshwara Chaluvaiah
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi am still confuse about classes and packages while executing in command line. Below is my two simple classes which are in the same directory. namely Myclass.java and ClassUser.java.
Both the classes are in the directory /media/Movies/eshwar/myjava . and i have defined classes as follows(both are in separate file)
1)Myclass.java

2. ClassUser.java



i am compiling ClassUser.java in the directory myjava as follows
:/media/Movies/eshwar/myjava$ javac ClassUser.java

when i execute above command am getting symbol not found : myclass
according to me both are in same file, so it should compile but why its giving errror like this. even i used below command but got the same error

:/media/Movies/eshwar/myjava$ javac -cp . ClassUser.java

please help me to undestand packages and classes while executing in the command line
Advance thanks

 
Campbell Ritchie
Marshal
Posts: 79716
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eshwara Chaluvaiah wrote: . . .
i am compiling ClassUser.java in the directory myjava as follows
:/media/Movies/eshwar/myjava$ javac ClassUser.java

when i execute above command am getting symbol not found : myclass
according to me both are in same file, so it should compile but why its giving errror like this. even i used below command but got the same error

:/media/Movies/eshwar/myjava$ javac -cp . ClassUser.java

please help me to undestand packages and classes while executing in the command line
Advance thanks

Both methods are wrong. It is too late for me to go through the old posts now, I am afraid. Did you not find the -d option?
 
Eshwara Chaluvaiah
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone
after struggling to understand about the javac command finally it got worked using the following commands

/media/Movies/eshwar$ javac -d . myjava/ClassUser.java
/media/Movies/eshwar$ java myjava.ClassUser

 
Campbell Ritchie
Marshal
Posts: 79716
381
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done
 
Evacuate the building! Here, take this tiny ad with you:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic