Trouble incorporating swing on Linux
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   gavin_lubbe
Posted On:   Wednesday, May 16, 2001 11:36 AM

I'm running Red Hat 6.2 kernel 2.2.14. I have downloaded and installed j2sdk-1.3.0-RC1-linux-i386.tar.bz2 from Blackdown. I am new to java and have been attempting to learn java using O'Reilly's 'Learning Java'. When I try the examples in the book that seem to be utilising Swing components I get the following error $ javac HelloJava.java HelloJava.java:1: Can''t find type "javax/swing/JComponent" I have tried to find a javax directory without success. When I run the command line version of this example, it compiles and executes successfully, leading me to conclude that either my development environment isn't con   More>>

I'm running Red Hat 6.2 kernel 2.2.14. I have downloaded
and installed j2sdk-1.3.0-RC1-linux-i386.tar.bz2 from
Blackdown. I am new to java and have been attempting
to learn java using O'Reilly's 'Learning Java'. When
I try the examples in the book that seem to be utilising Swing
components I get the following error



$ javac HelloJava.java



HelloJava.java:1: Can''t find type "javax/swing/JComponent"




I have tried to find a javax directory without success.
When I run the command line version of this example,
it compiles and executes successfully, leading me to
conclude that either my development environment isn't
configured correctly ( environment variables ) or
I haven't got the JFC installed.



I apologise if the solution to this problem is obvious,
but I really need a little guidance.

   <<Less

Re: Trouble incorporating swing on Linux

Posted By:   Nathan_Meyers  
Posted On:   Wednesday, May 16, 2001 10:21 PM

Perhaps you also have Kaffe installed, and are running
that when you try things from the command line.
See this
FAQ entry
for more detail .

Re: Trouble incorporating swing on Linux

Posted By:   Anonymous  
Posted On:   Wednesday, May 16, 2001 01:35 PM

Download the latest Linux JDK (1.3.0_02) directly from Sun. It works really great on all our linux box and we haven't had any trouble at all.

Regards.

Re: Trouble incorporating swing on Linux

Posted By:   Christopher_Schultz  
Posted On:   Wednesday, May 16, 2001 01:33 PM

That sounds strange. In recent versions of the JDK, JFC is included. There's a JAR file included with your JDK called rt.jar which contains the whole sha-bang.



Try using 'jar' on that file to verify that javax/swing/JComponent.class exists (it really should).



Above and beyond that, check your CLASSPATH environment variable (type 'echo $CLASSPATH') to see that it includes rt.jar.



Most modern VM's already include this file in their 'implicit' or 'boot' classpath, so you really shouldn't have to do this.



Can you give more information about your setup (specifically, your CLASSPATH as well as your analysis of the rt.jar file -- i.e. does it contain javax/swing/JComponent.class)?



Just a few (somewhat-related) notes on your installation:




  • IBM has a helluva JDK distribution for Linux, and it's AWT/Swing support is the best I've seen for Linux (sorry, can't comment on Blackdown's distro 'cause I haven't used it in a while)
  • RedHat 6.2 has a 'rootkit' available so crackers can hack your box without too much trouble if you aren't keeping up with OS patches. Consider upgrading to RedHat 7.1


Good luck,
-chris
About | Sitemap | Contact