Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
little help with java path needed... [solved]
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
f.kater
Guru
Guru


Joined: 23 May 2002
Posts: 342
Location: Berlin

PostPosted: Tue Jul 08, 2003 3:46 pm    Post subject: little help with java path needed... [solved] Reply with quote

Hi,
I can't get my HelloWorldApp.class (java) to run - even though I followed the Gentoo Java Doc.
So, let me explain what happens:
(1) This is my java programm / class:
Code:
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}

I've compiled it successfully with
Code:
javac test.java
to
Code:
~/HelloWorldApp.class

(2) However,
Code:
javac -cp ~/. HelloWorldApp.class
shows this error message:
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/class

(3) Some information about my system:
Code:
echo $CLASSPATH
/opt/sun-j2sdk-1.4.1/jre/lib/:/opt/sun-j2sdk-1.4.1/lib/tools.jar

Code:
java-config --list-available-vms
[01;37m [blackdown-jdk-1.4.1] Blackdown JDK 1.4.1 (/etc/env.d/java/20blackdown-jdk-1.4.1) ()
[01;33m [sun-j2sdk-1.4.1] Sun JDK 1.4.1 (/etc/env.d/java/20sun-j2sdk-1.4.1) (*)

Do you have any idea why HelloWorldApp.class isn't executed?


Last edited by f.kater on Tue Jul 08, 2003 4:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Tue Jul 08, 2003 4:08 pm    Post subject: Reply with quote

Code:

java -cp ~/. HelloWorldApp

will work (note: no .class at the end).
Back to top
View user's profile Send private message
f.kater
Guru
Guru


Joined: 23 May 2002
Posts: 342
Location: Berlin

PostPosted: Tue Jul 08, 2003 4:26 pm    Post subject: Reply with quote

cool! Thanks
Back to top
View user's profile Send private message
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