Welcome To Java !Java
SETUP JRE , Packages , Library |
|
ITS training programs up to-date - Emily Dickinson :-) on the |
What is |
|
1. . . . . . |
Java looks up its system classes in a default location. If the classes
are not in the default location, Java will look them up relative to the
directories specified by the Classpath. It looks up user-defined classes in
areas relative to the CLASSPATH environment variable. Java looks up the classes
in the order specified by the Classpath.
In the case you prefer manual setup instead of using a
wizard-installer:
Setup for UNIXLines in the setup
file: $HOME/.profile PATH=.:$PATH:/jdk/bin |
Setup for Windows XP/Vista/Windows7Lines in the setup
file: c:\autoexec.bat PATH=%PATH%;c:\jdk\bin |
In the JDK, there are three search paths that
are used to find classes: The first place where java looks for classes is the
bootstrap classpath. The value of this path can be examined by calling System.getProperty("sun.boot.class.path").
Note that the prefix "sun." shows that, at least for now,
this property is specific to Sun's implementation.
The second place where java looks for classes is the extension directories. The
list of directories can be examined by calling System.getProperty("java.ext.dirs").
The third and last place where java looks for classes is the application
classpath. The value of this path can be examined by calling System.getProperty("java.class.path").
2. Download and Install Eclipse JEE: http://Eclipse.org – Eclipse
Indigo JEE – Unzip it directly to C:\
A Java package is a collection of related classes. When you are creating a Java applet or application, it is a good practice to put it into its own package. If the application is large, the package can be broken down to several smaller packages.
The example below displays an itschool package that has several smaller, more manageable packages. Using classes from these packages is simple.
itschool.gui
itschool.graph
itschool.data
itschool.misc
You can tell the compiler to import a whole package or just one class from the package.
If you only need one or two classes from a package, importing only the specific class is more efficient.
If you are using several classes from a package, importing the whole package is easier.
Which ever way you choose will only impact compile time and not run time efficiency.
The first example below tells the compiler that all of the classes in the itschool.gui package are candidates for use.
The second statement says only to look at the UtDate.class in the itschool.misc package.
import itschool.gui.*;
import itschool.misc.UtDate;
Creating a package is simple. Create a directory with the same name and path as your package name. Each dot separating a word in the package name is a directory in the path. The first executable line of code in the class needs to start with the keyword package and then the package name.
package itschool.gui;