Package javax.swing not found in import.

R

Rui Pacheco

Hi
I am developing an Swing applet. I am using Eclipse as my IDE and I am
compiling the classes through the command line. Everything went ok, but
suddenly it started to give the error "Package javax.swing not found in
import."
I searched Google groups and found that it's a classpath problem, but I
can't seem to get it right. Can anyone help me? And why did it break all of
a sudden, without any changes to the system?

This is my classpath:
C:\Sybase\ASEP\Monclass.zip;C:\Sybase\ASEP\3pclass.zip;C:\Program
Files\Sybase\EAServer\EAServer\PowerBuilder\pdjdbc12.jar;C:\Program
Files\Sybase\EAServer\EAServer\java\lib\jagtool.jar;C:\Program
Files\Sybase\Shared\Sun\jdk118\lib\classes.zip;.; C:\Program
Files\Java\j2re1.4.1_05\lib\;C:\j2re1.4.1_05\jre\lib\


I am running Windows 2000 and JDK 1.4.1_05

Thank you very much
Rui
 
D

Doyle

I am developing an Swing applet. I am using Eclipse as my IDE and I am
compiling the classes through the command line. Everything went ok, but
suddenly it started to give the error "Package javax.swing not found in
import."
I searched Google groups and found that it's a classpath problem, but I
can't seem to get it right. Can anyone help me? And why did it break all of
a sudden, without any changes to the system?

This is my classpath:
C:\Sybase\ASEP\Monclass.zip;C:\Sybase\ASEP\3pclass.zip;C:\Program
Files\Sybase\EAServer\EAServer\PowerBuilder\pdjdbc12.jar;C:\Program
Files\Sybase\EAServer\EAServer\java\lib\jagtool.jar;C:\Program
Files\Sybase\Shared\Sun\jdk118\lib\classes.zip;.; C:\Program
Files\Java\j2re1.4.1_05\lib\;C:\j2re1.4.1_05\jre\lib\

You need to think of your jar files as separate directories. As such
the last two entries in your classpath don't do anything (unless you
have a set of class files in your lib directory). You have to specify
explicitly what jars you want to include in your classpath. Just
referring to a directory in which jar files might be found is not good
enough.

Using a tool like Winzip you can open the jar files and find the jar
file in which the javax.swing package is found. I think the Windows
Explorer will be able to find the jar file that the package is in.
Once you have determined which jar file the package is in, specify
that jar files explicitly in your classpath and it'll start working.

Good luck.

mypetrock
 
R

Rui Pacheco

You need to think of your jar files as separate directories. As such
the last two entries in your classpath don't do anything (unless you
have a set of class files in your lib directory). You have to specify
explicitly what jars you want to include in your classpath. Just
referring to a directory in which jar files might be found is not good
enough.

Using a tool like Winzip you can open the jar files and find the jar
file in which the javax.swing package is found. I think the Windows
Explorer will be able to find the jar file that the package is in.
Once you have determined which jar file the package is in, specify
that jar files explicitly in your classpath and it'll start working.

Good luck.

mypetrock

I finally solved my problem. There was nothing wrong with my PATH or
CLASSPATH vars, they were just declared in the wrong place.
Both variables should be declared under "System Variables" in Windows
2000.

I'm posting this just in case someone has the same problem as me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top