For the "import" statement to work, of course, the classes you're importing have to be available somewhere, and the compiler has to be able to find them. This page from the JavaRanch FAQ talks about the "class path", which is Java's solution to this problem. Head over there and read it and see if that helps!
Note that "javabook.*" isn't something that comes with Java -- it must be a third-party thing you read about somewhere. Based on the name, it's probably be the sample code from a book, yes? You need to download that sample code onto your machine, and arrange to have it on the class path, before you can use it from your own code. The book probably includes details about where to download the code.
Originally posted by kap kumar: thats rite, it is from a book.
Can you tell me some standard package that i can try?
Well, that depends on what you want to do. There are several hundred standard packages. Here are some of the most common, at least from the Java coding I do:
java.lang - contains classes that Java uses under the hood (e.g. ClassLoader, Class, etc.) and some that are considered part of the language (e.g. String); you don't need to import this package java.util - contains the Collections Framework; this includes classes like Vector, ArrayList, HashMap, and TreeMap, to name a few javax.swing - classes for developing GUI applications with Swing java.awt - classes for developing GUI applications with the Abstract Windowing Toolkit (AWT)
There are so many more that I don't dare even try to list them here. However sun has documented them very well. As you learn how to program in Java, you should familiarize yourself with the Java API documentation. Use this link to find the docs for the version of Java that you are using. When you click on the link to the docs for the appropriate version, the available packages are listed in the frame in the top left corner.
I see you've been posting new threads on this same topic. I've closed them and redirected discussion to this thread.
Have you tried what I suggested in my very first reply? Have you read the FAQ about the CLASSPATH and added the .jar file you downloaded to your CLASSPATH?
Note that "tools.jar" almost certainly doesn't belong on your CLASSPATH; it contains the implementations of tools like javac, javah, anmd javap, and you shouldn't be using those classes in your own applications.