Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Java command-line tools?
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
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Wed Nov 06, 2002 11:08 pm    Post subject: Java command-line tools? Reply with quote

Ok, I've got to whip up a simple java project for class, and I'm the only one, apparently, who runs linux.

I've looked through the "Java Development" thread, and Eclipse is mentioned. I've emerg'ed eclipse, but it just seems to be a massive tool I don't need.

My only needs are, I have to write multiple classes, and compile them together...exactly like I did for the identical project in C++.

It only outputs text to a command-line.... so there must be an extremely simple way to do this.... i hope i'm right....
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Thu Nov 07, 2002 12:26 am    Post subject: Reply with quote

Ok, I've been working all afternoon on this.

I've installed both Blackdown and Sun's VM's...and both are listed from the command java-config --list-available-vms.

I then chose to use Sun's, and set it with java-config (following the Gentoo Java Guide). Everything seems right. My ~/.gentoo/java-env-classpath file contains the "." or, current directory, so whenever I try to run java something.class, as long as I'm in the directory, it should work.

I've got an extremely simple "hello world" application written up...

Code:

class HelloWorld {

  public static void main (String args[]) {

    System.out.println("Hello World!");

  }

}


...which compiles just fine doing javac HelloWorld.java

However...when I try to run this file, I get:

Code:

odinsdream@p2c2e javaZoo $ java HelloWorld.class
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class
odinsdream@p2c2e javaZoo $


What does this mean? How can I correct it?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Thu Nov 07, 2002 12:28 am    Post subject: Reply with quote

How about:
Code:
$ java HelloWorld

EDIT: you can also use Makefiles to compile Java things just like C++.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Thu Nov 07, 2002 12:52 am    Post subject: Reply with quote

rac, you've been so helpful with these things!!

thanks again!
Back to top
View user's profile Send private message
TheGaff
n00b
n00b


Joined: 05 Oct 2002
Posts: 15

PostPosted: Thu Nov 07, 2002 2:09 am    Post subject: Reply with quote

I definatly suggest Forte 4 Java (Version 4 is available from Sun but 3 can be emerged). Its a full IDE and very intuitive as well as powerful. There are a lot of features that you may not think you need but come in very handy.

I highly recommend it.

Theres a program called Ant that is like make for Java files.
Back to top
View user's profile Send private message
Exci
Apprentice
Apprentice


Joined: 12 Jul 2002
Posts: 265
Location: The Netherlands, Zoetermeer

PostPosted: Sat Nov 09, 2002 6:54 pm    Post subject: Reply with quote

omg i feel so incredibly stupid ..
this is the second day i try to use the 'java' command
and i too included the .class..

thx:)
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Sun Nov 10, 2002 12:30 am    Post subject: Reply with quote

Exci wrote:
omg i feel so incredibly stupid ..
this is the second day i try to use the 'java' command
and i too included the .class..

thx:)


I didn't think it was so unreasonable, I mean... that's the full filename, after all.

I almost think java assumes too much... :?
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