-
May 10th, 2003, 04:21 AM
#1
Junior Member
Java compiler error - Linux
Hello. I'm having a problem trying to compile Java apps in Linux. Code is below:
import javax.swing.*;
public class test {
public static void main( String[] args ) {
JFrame frame = new JFrame( "Hello, Java" );
JLabel label = new JLabel( "this is a JLabel", JLabel.CENTER );
frame.getContentPane().add( label );
frame.setSize( 300, 300 );
frame.setVisible( true );
}
}
I'm getting "test.java:5: error:Cannot find class "JFrame" [JLS 8]
I have j2sdk1.4.0 installed, which is supposed to include swing. I'm a bit stumped & was wondering if anyone here could give me some direction.
Many, many thanks in advance.
ea
-
May 10th, 2003, 05:25 AM
#2
I just tested your program out on my computer and it compiled fine, I'm on Windows 2000 using version 1.4.1 though. When I installed it I had to fix up my PATH environment variable to ensure that it could find all the Java programs (java, javac etc.), you might also have to fix up your path settings.
[edit]
Found page which goes through setting up Java on a Linux platform, maybe worth double-checking to ensure that everything is in working order.
% su -
# cd /usr/local/
# chmod +x j2sdk-1_4_1_02-linux-i586.bin
# ./j2sdk-1_4_1_02-linux-i586.bin
Now test Java:
# /usr/local/j2sdk1.4.1_02/bin/java -version
Set the PATH environent variable: (/etc/profile or .bashrc).
PATH="$PATH:/usr/local/j2sdk1.4.1_02/bin:."
export PATH
http://www.dougsparling.com/comp/howto/linux_java.html
[/edit]
-
May 10th, 2003, 12:57 PM
#3
Junior Member
You are very cool. Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|