Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Package javax.swing not found in import

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I installed jdk1.3.1_02 in d:\jdk1.3.1_02.
It is working fine to compile java program, but got a problem in compile swing. I got "Package javax.swing not found in import". I guess it must be something wrong in environment variables.
CLASSPATH=d:\jdk1.3.1_02\lib;C:\Program Files\JavaSoft\JRE\1.3.1_02\lib;

Could anyone tell me what I miss?

thanks a lot
 
have you included the javax.swing libraries at the top of your code with an import statement?

e.g.
import javax.swing.*;
bruce21.jpg
 
Ugh. I hate classpath problems.

I've put all my build and launch commands in scripts. I'll answer you question directly below, but I thought I'd share a build script for one of my recent applications:
Code:
set JAVA_HOME=c:\jdk1.3.1_01
set APP_HOME=C:\BILLManager\source
set LIB_HOME=C:\BILLManager\lib\acq
set DEST=C:\BILLManager\release
set SOURCE=%APP_HOME%\com\bprocess\mail

set MYCLASSPATH=%DEST%
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\acquisition3.2.jar
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\classes12.zip
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\ftp.jar
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\log4j.jar
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\mail.jar
set MYCLASSPATH=%MYCLASSPATH%;%LIB_HOME%\nls_charset12.zip

%JAVA_HOME%\bin\javac -g -deprecation -classpath %MYCLASSPATH% -d %DEST% %SOURCE%\*.java

pause
Notice in particular that I have to specifically import jars that are in the same directory, or javac won't look inside them. My guess is that's what's preventing you from compiling. Hope that helps!
 
Ant works great with these types of problems since you can tell Ant to include all jars within a given directory in the CLASSPATH. Nothing beats Ant for building.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top