Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-09-2003, 06:18 PM
|
#1
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Rep:
|
Having trouble compiling/running java on linux
I installed all the sdk's and what not, but I am still having trouble running my java programs on linux.
I get the error
Exception in thread "main" java.lang.NoClassDefFoundError: MyOS
on all my files, MyOS being the name of the class where main is located.
It works on my windows machine, or if I use telnet to connect to a unix server to run it.
If anyone has any idea what may be wrong I would appreciate the help.
thanks
|
|
|
11-09-2003, 07:16 PM
|
#2
|
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032
Rep:
|
You might have conflicting packages installed. I have had a lot of problems running Sun java (j2se javac and java) when I had gcj installed. If that's the case you should note some non-Sun java classes mentioned in the error message.
Håkan
|
|
|
11-09-2003, 07:48 PM
|
#3
|
Member
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189
Rep:
|
Yep, I've ran into the same thing with gcj and Sun's JDK. The only way I've found to completely solve the problem is to remove gcj.
|
|
|
11-09-2003, 08:55 PM
|
#4
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
How do I check if gjk is installed, I don't remember adding it, so I don't think it is.
I know that Suns sdk is though.
Also, how would I remove it if it is installed.
thanks
|
|
|
11-09-2003, 09:26 PM
|
#5
|
Member
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189
Rep:
|
If you have a rpm based distro you should be able to run rpm -q gcj. If it's installed you can remove it by running rpm -e gcj.
|
|
|
11-09-2003, 09:41 PM
|
#6
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
nope, its not installed
i have j2re installed along with the j2sdk
does that matter?
|
|
|
11-10-2003, 01:42 PM
|
#7
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
anyone have any other suggestions
when I do echo $PATH
this is what I get:
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/user/java/j2sdk1.4.2_02/bin:/home/joe/bin:/usr/java/j2sdk1.4.2_02/bin
|
|
|
11-10-2003, 03:15 PM
|
#8
|
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032
Rep:
|
It would be helpful if you could provide the full error message...
Håkan
|
|
|
11-10-2003, 03:21 PM
|
#9
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
this is the full error:
Exception in thread "main" java.lang.NoClassDefFoundError: (name of class goes here)
|
|
|
11-10-2003, 09:48 PM
|
#10
|
Member
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189
Rep:
|
Hmm.., okay what is your classpath set to? Because, that's the only other thing that I can think of. Somehow it's not finding your class.
|
|
|
11-10-2003, 11:53 PM
|
#11
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
/usr/java/j2sdk1.4.2_02/lib
is the classpath
|
|
|
11-11-2003, 12:22 AM
|
#12
|
Member
Registered: Jan 2003
Location: Georgia, US
Distribution: RHEL WS4
Posts: 189
Rep:
|
Okay, that is probably your problem. You need to include the directory or jar file that contains the class you are trying to run.
i.e java -cp ~/java/<DirName> MyClass
|
|
|
11-11-2003, 01:38 AM
|
#13
|
LQ Newbie
Registered: Nov 2003
Posts: 10
Original Poster
Rep:
|
thank you so much, finally got it to work
all i had to add was the -cp ./
|
|
|
All times are GMT -5. The time now is 11:49 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|