Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo - Java Question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Alex Jongman
Guest





PostPosted: Fri Apr 19, 2002 9:13 am    Post subject: Gentoo - Java Question Reply with quote

Hi,

I'm not sure if this question belongs here, but since I believe that the problem might be caused due to configuration issues I post it anyway. So here is my problem:

Starting to learn Java by a book I just wrote the following HelloWorld program:
Code:

public class HelloWorld extends Object {
   public static void main (String args[]) {
      System.out.print ("Hello World");
   }
}

saved it as HelloWorld.java, compiled it without problems using blackdown-jdk-1.3.1.
But when I start the program with java HelloWorld I get the following message:

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

In case that the CLASSPATH has something to do with it, an echo $CLASSPATH returns:

/opt/blackdown-jdk-1.3.1/lib/rt.jar:/opt/saxon/saxon.jar:/opt/xalan-j_2_3_1/bin/xercesImpl.jar:/opt/xalan-j_2_3_1/bin/xalan.jar:/opt/xalan-j_2_3_1/bin/xalansamples.jar:/opt/xerces-1_4_4/xerces.jar:/opt/xerces-1_4_4/xercesSamples.jar

Any suggestion to help me out with this problem is welcome,

Alex
Back to top
toastkid
n00b
n00b


Joined: 18 Apr 2002
Posts: 3

PostPosted: Fri Apr 19, 2002 9:20 am    Post subject: Reply with quote

If the .class file is in your current directory then you need the current directory in the classpath

e.g.

export CLASSPATH=.:$CLASSPATH

then try again
Back to top
View user's profile Send private message
Alex Jongman
Guest





PostPosted: Fri Apr 19, 2002 9:25 am    Post subject: Reply with quote

Thanks,

that indeed did the trick,

Alex
Back to top
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum