getting javax.swing.* to appear
On the unix labs at my university all of the java running performs without flaws - gui's included. Here is a simple java file that i try to run on both systems:
Code:
/** Code:
$ javac simple.java When i type "java simple" on my machine, i get this: Code:
$ java simple thanks in advance |
Have you installed java in /etc/java?
That's strange. Because java is usually installed in /usr/java. I think that it's trying to use the GNU gcc java instead of Sun Java and that's where the error occurs. |
so.. how would I fix it?
|
As a quick fix try calling java using the full path like in
Code:
/etc/java/j2sdk1.4.2/bin/java simple Or if you want to fix the whole problem, then make symbolic links to all the Sun java executables in your /usr/bin directory. PS. I just tried your program on my system and it works fine. |
or u can set the JAVA_HOME variable and export it on the cmd line. Another method is set the above variable in ur .bash_profile. That should do the trick.
|
It sounds more like a CLASSPATH problem. try adding . (current dir) to your CLASSPATH
|
I'm sorry, i meant the path /usr/java! I somehow miss-typed that. Apologies. Anyway
I have /usr/java/j2re1.4.2_05/bin/java /usr/java/j2sdk1.4.2_05/bin/java /usr/java/j2sdk1.4.2_05/bin/javac and take a look at this: Code:
$ whereis java Either of the /usr/bin/j2*/bin/java work on my other programs that use javax.swing.JFrame, but somehow javax.swing.JOptionPane isn't working.. maybe i don't have it? *edit, ok.. here's what i found out: I compiled it with javac which is in the same path above (doing the 'whereis'), and when i recompiled the .java file (any) with the javac found in the /usr/java/j2sdk--/bin/javac and then ran it with the java in the same folder it worked! so my other java thing must just not be... good? Anyway thank you for all of your help (i would not have been able to get it myself)! :-D I will redo the links in /etc/bin when i have time later (for now i have bash aliases set). -alex |
Quote:
Quote:
|
arg! yes, /usr/bin... sorry. /etc/ will die
|
All times are GMT -5. The time now is 10:12 AM. |