JAVA CODE
JAVA PROGRAMME
Java Basics
Working with Objects
Arrays, Conditionals, and Loops
Creating Classes and Applications in Java
More About Methods
Java Applet Basics
Graphics, Fonts, and Color
Simple Animation and Threads
More Animation, Images, and Sound
Managing Simple Events and Interactivity
Creating User Interfaces with the awt
Windows, Networking, and Other Tidbits
Modifiers, Access Control, and Class Design
Packages and Interfaces
Exceptions
Multithreading
Streams and I/O
Using Native Methods and Libraries
Under the Hood
Java Programming Tools
Working with Data Structures in Java
Advanced Animation and Media
Fun with Image Filters
Client/Server Networking in Java
Emerging Technologies
appendix A :- Language Summary
appendix B :- Class Hierarchy Diagrams
appendix C The Java Class Library
appendix D Bytecodes Reference
appendix E java.applet Package Reference
appendix F java.awt Package Reference
appendix G java.awt.image Package Reference
appendix H java.awt.peer Package Reference
appendix I java.io Package Reference
appendix J java.lang Package Reference
appendix K java.net Package Reference
appendix L java.util Package Reference

Configuring the JDK

If you’ve installed the JDK using the setup programs from the CD-ROM, chances are good that it has been correctly configured for you. However, because most common problems with Java result from configuration errors, I recommend that you double-check your configuration to make sure everything is right. And if you’ve installed the JDK from a source other than the CD-ROM, you’ll definitely want to read this section to make
sure you’re all set up.

Windows
The JDK needs two important modifications to your autoexec.bat file in order to work correctly: The JDK\bin directory must be in your execution path, and you
must have the CLASSPATH variable set up.

Edit your autoexec.bat file using your favorite editor (Notepad will do just fine). Look for a line that looks something like this:
PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\DOS; …

Somewhere in that line you should see an entry for the JDK; if you installed the JDK from CD-ROM, it’ll look something like this (the dots are there to indicate that there may be other stuff on this line):
PATH C:\WINDOWS; … C:\TEAchY~1\JDK\BIN; …

If you cannot find any reference to JDK\BIN or JAVA\BIN in your PATH, you’ll need to add it. Simply include the full pathname to your JDK installation to the end of that line, starting with C: and ending with BIN; for
example, C:\JAVA\BIN or C:\Java\JDK\BIN.

Note
The directories Teach Yourself Java and TEAchY~1 are actually the same thing; the former is how the directory appears in Windows 95, and the latter is how it
appears in DOS. Either one will work fine; there’s no need to change it if one or the other appears. Note, however, that if the pathname contains spaces, it must be in
quotes.

The second thing you’ll need to add to the autoexec.bat file (if it isn’t already there) is a CLASSPATH variable. Look for a line that looks something like this:
SET CLASSPATH=C:\TEAchY~1\JDK\lib\classes.zip;.;

The CLASSPATH variable may also have other entries in it for Netscape or Internet Explorer, but the one you’re most interested in is a reference to the classes.zip file in the JDK, and to the current directory (.). If
your autoexec.bat file does not include either of these locations, add a line to the file that contains both these things (the line shown above will work just fine).

After saving your autoexec.bat file, you’ll need to restart Windows for the changes to take effect.

Macintosh
The JDK for Macintosh should need no further configuration after installation.

Solaris
To configure the JDK for Solaris, all you need to do is add the java/bin or jdk/bin directory to your execution path. Usually a line something like this in your
.cshrc, .login, or .profile files will work:

set path= (~/java/bin/ $path)

This line assumes that you’ve installed the JDK (as the directory java) into your home directory; if you’ve installed it somewhere else, you’ll want to substitute that pathname.

Make sure you use the source command with the name of the appropriate file to make sure the changes take effect (or log out and log back in again):
source ~/.login

More Info

Configuring the Java Development Kit (JDK) involves setting up the necessary environment variables and ensuring that your system recognizes the JDK installation. Here’s a step-by-step guide:

1. **Download the JDK**: Go to the official Oracle website or another trusted source and download the JDK installer appropriate for your operating system (Windows, macOS, or Linux).

2. **Install the JDK**: Follow the installation instructions provided by Oracle or the distributor. Typically, this involves running the installer and accepting the license agreement.

3. **Set the JAVA_HOME Environment Variable**:
– **Windows**:
– Right-click on “My Computer” or “This PC” and select “Properties”.
– Click on “Advanced system settings” on the left side.
– In the System Properties window, click on the “Environment Variables…” button.
– Under “System variables”, click “New…” and enter `JAVA_HOME` as the variable name and the path to your JDK installation directory as the variable value (e.g., `C:\Program Files\Java\jdk1.8.0_281`).
– Click OK to save the variable.
– **macOS and Linux**:
– Open a terminal.
– Edit the `.bash_profile`, `.bashrc`, or `.profile` file in your home directory (depending on your shell and system configuration) using a text editor like `nano` or `vim`.
– Add the following line at the end of the file:
“`
export JAVA_HOME=/path/to/your/jdk
“`
– Replace `/path/to/your/jdk` with the actual path to your JDK installation directory.
– Save the file and exit the text editor.
– To apply the changes immediately, run:
“`
source ~/.bash_profile
“`
(or the corresponding file you edited).

4. **Add JDK’s bin directory to PATH**:
– **Windows**:
– In the same “Environment Variables” window, find the “Path” variable under “System variables” and click “Edit…”.
– Add `%JAVA_HOME%\bin` to the list of paths.
– Click OK to save the changes.
– **macOS and Linux**:
– Still in the terminal, edit the same file you edited for `JAVA_HOME`.
– Add the following line after the `export JAVA_HOME` line:
“`
export PATH=$JAVA_HOME/bin:$PATH
“`
– Save the file and exit the text editor.
– Again, to apply the changes immediately, run:
“`
source ~/.bash_profile
“`
(or the corresponding file you edited).

5. **Verify the Installation**: Open a new terminal or command prompt window and type `java -version`. You should see information about the JDK version installed on your system.

Once these steps are completed, your JDK should be correctly configured, and you can start developing Java applications.

prime number
Scroll to Top