View previous topic :: View next topic |
Author |
Message |
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Wed Nov 06, 2002 11:08 pm Post subject: Java command-line tools? |
|
|
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 |
|
|
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Thu Nov 07, 2002 12:26 am Post subject: |
|
|
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 |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Thu Nov 07, 2002 12:28 am Post subject: |
|
|
How about:
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 |
|
|
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Thu Nov 07, 2002 12:52 am Post subject: |
|
|
rac, you've been so helpful with these things!!
thanks again! |
|
Back to top |
|
|
TheGaff n00b
Joined: 05 Oct 2002 Posts: 15
|
Posted: Thu Nov 07, 2002 2:09 am Post subject: |
|
|
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 |
|
|
Exci Apprentice
Joined: 12 Jul 2002 Posts: 265 Location: The Netherlands, Zoetermeer
|
Posted: Sat Nov 09, 2002 6:54 pm Post subject: |
|
|
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 |
|
|
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Sun Nov 10, 2002 12:30 am Post subject: |
|
|
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 |
|
|
|