Solved

"Import"-question

Posted on 2001-06-08
7
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

695 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