Solved

"Import"-question

Posted on 2001-06-08
7
291 Views
Last Modified: 2010-03-31
Hello!

I need to use sun-classes in my work, e.g. sun.tools.java etc. But if i just write import sun.tools.java.*, I get an error message "Package not found". What is a problem there?

Thanx.
0
Comment
Question by:shtern
7 Comments
 

Expert Comment

by:MichaelSonny
ID: 6167382
Set the Environment Variable CLASSPATH to the directory where classes of sun are stored!
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6167470
Use declarations in your code like :

sun.tools.java.'a class' member = new sun.tools.java.'a class'(params);
0
 
LVL 3

Expert Comment

by:falter
ID: 6167605
Did you get the problem during compile time or runtime?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 9

Expert Comment

by:mmuruganandam
ID: 6167804
Hello shtern,

  It might be a problem with your environment settings.  Search for the appropriate jar files which can be opened in the winzip.  Check for the classes to import.  Put that jar file in the classpath.  It will do the needful for you.

All the best

Cheers,
Muru
0
 

Author Comment

by:shtern
ID: 6168859
Falter,
I get the problem by compiling.

Muru,
how should I put the file into classpath? With the name of .jar-file, or just path?
0
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 6169848
Were are the sun classes located on your system.
If they are in a jar then you'll need to include this jar in your classpath.
If they (the classes) are in a directory on your system then you'll need to include the parent directory that contains the 'sun' directory in your classpath. eg. if the files are in /stuff/classes/sun/tools/java then you'll need to include '/stuff/classes' in your classpath.

Hope this helps :)
0
 
LVL 92

Expert Comment

by:objects
ID: 6172110
Thanks for the points :)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question