• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLS Error in Linux  RSS feed

 
Craig Gaffney
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I have encountered a real interesting error trying to use Java on Mandrake 9.2 running KDE 3.2. I have an "out of the box" install, and I have installed the j2sdk1.4.2_04 rpm which appears to have installed correctly. I have set up the path to include the java binaries.
I can run command line apps, but if I try to do any GUI, I get an error that includes the following
cannot find <java class>, [JLS 8] (I am not at the machine that generates this error message - I will regenerate the error message and post it here)
Does anyone have any ideas?
Thanks in advance for the help
Craig.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your path is picking up the JDK you installed? There may have been a preinstalled copy of Kaffe or some such -- many Linux distros come with one of these open-source Java clones. Try "java -version" to make sure.
I'm moving this to the Linux/UNIX forum for followups.
[ May 07, 2004: Message edited by: Ernest Friedman-Hill ]
 
Craig Gaffney
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'Day Ernest,
After posting to the forums, I found out someone else who hada similar problem on another site. So I checked, and yes, there was Kaffe. So, I uninstalled both the Sun SDK & Kaffe, and reinstalled the SDK.
I can now run Java apps, however, I cannot compile anything using swing! I have checked that the packages exist, which they do, and they are in the proper spot in relation to the base Java install.
I need to check the details on the machine in question (I don't have access to it right now), but I have the following environment variables set
JAVA_HOME=/usr/java/j2sdk1.4.2_04
CLASSPATH=.
Thanking you for you help,
Craig.
PS - to the moderators - sorry about posting to the wrong spot initially. I hadn't explored the site well enough.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, when you try, what error messages do you get? And when you type
javac -J-version
(there's no space between the J and the '-'), what does it say?
 
Craig Gaffney
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'Day Ernest,
Well, when I try to comile the code, this is what I get.
org/games/wod/CharacterGenFrame.java:5: cannot resolve symbol
symbol : class JFrame
location: class org.games.wod.CharacterGenFrame
public class CharacterGenFrame extends JFrame {
^
Also, when I try the other command you suggested, this is the response
[****]$ javac -J-version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
So, any other suggestions? I'm a bit baffled by all of this.

Thanks for your help so far Ernest. I really appreciate it.

Cheers,
Craig.
 
Craig Gaffney
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'Day Ernest,
Damn... the ^ on the last line was under the "J" in JFrame. Otherwise, everything is as it appeared in the console.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Craig Gaffney:
org/games/wod/CharacterGenFrame.java:5: cannot resolve symbol
symbol : class JFrame
location: class org.games.wod.CharacterGenFrame
public class CharacterGenFrame extends JFrame {

At the top of CharacterGenFrame.java (below any package statement but above the start of any class) you need to have either
import javax.swing.*;
or
import javax.swing.JFrame;
or javac will report precisely the error you've shown.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
either that or there's a problem with the permissions on some of the libraries.
If the user running the compiler doesn't have read permission on a jar or two it could well be that the compiler won't be allowed to read them either.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:

If the user running the compiler doesn't have read permission on a jar or two it could well be that the compiler won't be allowed to read them either.

This is true, although Sun's JDKs (which he's installed) put javax.swing inside the same rt.jar that contains all the other JDK classes; the compiler, which itself is written in Java, couldn't even start if this file wasn't readable.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is that. Didn't know if it applied to linux as well...
 
Craig Gaffney
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'Day Ernest,
Originally posted by Ernest Friedman-Hill:

At the top of CharacterGenFrame.java (below any package statement but above the start of any class) you need to have either
import javax.swing.*;
or
import javax.swing.JFrame;
or javac will report precisely the error you've shown.

Well, I feel like an idiot.... I checked the code, just in case. Well, the import was there, but it had been commented out!
Well, sorry for potentially wasting people's time, but thanks for the help all the same. Another few things to add to the pre-call for help book.
Cheers,
Craig.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!