wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Java Problem on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Java Problem on Linux" Watch "Java Problem on Linux" New topic
Author

Java Problem on Linux

Reuben Cleetus
Ranch Hand

Joined: Jul 13, 2001
Posts: 50
Hello All,
I'm a Linux newbie, and only recently figured out how to install Java using an RPM package!
I have a wierd problem using Java -- when I try to import any swing packages (ex: javax.swing.*), the javac compiler complains and seems unable to find the swing libraries. However, I am able to import any awt libraries.
Is there anything special I have to do to get swing working in Linux? I thought swing was now part of the Java's standard library, so that no additional classpath needed to be set to use swing.
Any help would be greatly appreciated!
Regards,
Reuben Cleetus.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16067
    
  21

You're correct. From 1.3 onward, Swing is part of the bundle (actually, 1.2, but it's buggy in that release).
The easiest way to install Java in a RedHat-like (rpm-based) Linux is to download the JDK, run the download to unpack the rpm, do a "rpm -ivh" to install it and then set your JAVA_HOME environment variable to point to the installed JDK. Actually, I 'm not sure if JAVA_HOME is required, but many apps like to have one. For my latest JDK, it's
"JAVA_HOME=/usr/java/jdk1.1.3" or something like that.
Make sure your CLASSPATH isn't set to use any older Java installations, though!


Customer surveys are for companies who didn't pay proper attention to begin with.
Jason Kretzer
Ranch Hand

Joined: May 31, 2001
Posts: 280
when you type
java -version
from the command-line, what do you get?


Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
Reuben Cleetus
Ranch Hand

Joined: Jul 13, 2001
Posts: 50
Hi Jason,
When I type java -version, it tells me that my Java version is "1.4.0-beta3".
This is a fresh install of Linux (SuSE), and JDK 1.4 is the first and only JDK that I have installed on it. I'm unable to figure out just why any class with a swing import in it fails to compile.
Regards,
Reuben.
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
Type
which javac
and then
which java
and see if you're using the java compiler that was installed in the 1.4 installation. There are 2 bits of info that lead me to this:
1. I know that my Mandrake installation installs Kaffe directly into the /usr/bin directory. Kaffe uses a 1.1 implementation of java so the swing classes arn't there. Since /usr/bin is in your path first it picks up the javac program from there instead of from the 1.4 installation.
2. I know the 1.4 installation works on my Mandrake installation and a buddy of mine has it working on his Suse installation.
So this may be it. Hope it helps


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Problem on Linux