Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Import"-question

Posted on 2001-06-08
7
Medium Priority
?
324 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 600 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

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!

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

598 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