473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Package javax.swing not found in import.

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\pdjdbc 12.jar;C:\Program
Files\Sybase\EAServer\EAServer\java\lib\jagtool.ja r;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\l ib\
I am running Windows 2000 and JDK 1.4.1_05

Thank you very much
Rui
Jul 17 '05 #1
2 11212
> 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\pdjdbc 12.jar;C:\Program
Files\Sybase\EAServer\EAServer\java\lib\jagtool.ja r;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\l ib\


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
Jul 17 '05 #2
my*******@yahoo.com (Doyle) wrote in message news:<73**************************@posting.google. com>...
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\pdjdbc 12.jar;C:\Program
Files\Sybase\EAServer\EAServer\java\lib\jagtool.ja r;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\l ib\


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.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: LornaJane | last post by:
I've not done very much Java before and now I'm working on a j2me application, however I think the trouble I have is generic java. I can compile, preverify and jar everything fine, but the...
1
by: Tony Johansson | last post by:
Hello! I'm reading in a document about "Graphical user Interface Programming" and it says the following. "The Java "Swing" toolkit is implemented on top of the Java 2D graphics package, which...
3
by: Sherrod Faulks | last post by:
I'm using Jython and in the python script I do: from javax import swing result = javax.swing.JOptionPane.showInputDialog(wC, cmd,"Prompt from " + client.serverName, JOptionPane.PLAIN_MESSAGE) ...
0
by: Raquel | last post by:
I downloaded UDB PE8.1.3 on Win XP. JDK gets downloaded along with it (Java version 1.3.1). However, when I am trying to compile a java program which uses DataSource interface for Connections (by...
8
oll3i
by: oll3i | last post by:
it worked but suddenly when i run it and click a button it throws exception ? D:\SR>java Producent queue1 queue2 queue3 queue4 queue1,queue2,queue3,queue4...
1
by: CodeTilYaDrop | last post by:
Hello, I am trying to show a shape in the Javax.swing.JFrame package. I am using a frame to show it, but I can not get the add method to work. Can someone give me a good example of adding...
2
by: minuji | last post by:
hello everybody, To compile my program I write, javac -classpath "../../.." BeerSelect.java package com.example.web; import com.example.model.BeerExpert; import javax.servlet.*; import...
2
by: HaifaCarina | last post by:
i have this unfinished java program and i can't figure out what is the problem.. please help... /** * @(#)Answer3.java * * * @author * @version 1.00 2008/1/17
1
by: poopsy | last post by:
hi all, i'm trying out some examples on java..and i found this code where there is board and i cant find out what package to import to make this work, im getting error where there is "board".. i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.