Install java

Install java Print E-mail
Contributed by Joe   
Monday, 03 July 2006

Java Version history- install java

Java 1.0: The original release of Java in 1996. Most of the language itself
is still pretty much the same as it was in version 1.0, but the API has
changed a lot since this release.

Java 1.1: This version was the first upgrade to Java, released in 1997.
This release is important because most Internet browsers include builtin
support for applets based on Java 1.1. To run applets based on later
versions of Java, you must, in most cases, download and install a current
JRE.

Java 1.2: This version, released in late 1998, was a huge improvement
over the previous version. So much so, in fact, that Sun called it “Java 2.”
It included an entirely new API called Swing for creating graphical user
interfaces, as well as other major features.

Java 1.3: This version, released in 2000, was mostly about improving
performance by changing the way the runtime system works.
Interestingly, Java 1.3 is actually called Java 2 version 1.3.

Java 1.4: Released in 2001, this version offered a slew of improvements.
As you might guess, it is called Java 2 version 1.4.

Java 1.5: Released in 2004, this version of Java is the latest and greatest.Both version numbers “1.5.0” and “5.0” are used to identify this
release of the Java 2 Platform Standard Edition. Version “5.0” is the
product version, while “1.5.0” is the developer version.”

Install Java and Use Java Tools

Java development environments have two basic approaches. On the one
hand, you can use a sophisticated Integrated Development Environment
(IDE) such as eclipse  or netbeans. These tools combine
a full-featured source editor that lets you edit your Java program files with
integrated development tools, including visual development tools that let
you create applications by dragging and dropping visual components onto a
design surface.

At the other extreme, you can use just the basic command-line tools that are
available free from Sun’s Java Web site (java.sun.com). Then you can use
any text editor you wish to create the text files that contain your Java programs
(called source files), and compile and run your programs by typing
commands at a command prompt.


Download the JDK

To get to the download page, point your browser to: http://java.sun.com/javase/downloads/index.jsp. Then follow the appropriate links to download the J2SE 5.0 JDK (now is JDK 5.0 Update 7) for your operating system.

When you get to this page, you find links to download the JDK or the JRE. Follow the JDK link; the JRE link gets you only the Java Runtime Environment, not the complete Java Development Kit.

The JDK download comes in two versions: an online version that requires an active Internet connection to install the JDK, and an offline version that lets,you download the JDK installation file to your disk, then install it later. I recommend you use the offload version. That way, you can reinstall the JDK if you need to without downloading it again.


The exact size of the offline version depends on the platform, but they’re all between 40MB and 50MB. As a result, the download takes a few hours if you don’t have a high-speed Internet connection. With a cable, DSL, or T1 connection,the download takes less than five minutes.


Install the JDK

After you download the JDK file, you can install it by running the executable file you downloaded. The procedure varies slightly depending on your operating system, but basically you just run the JDK installation program file after you download it:

  • On a Windows system, open the folder you saved the installation program to and double-click the installation program’s icon.
  • For a Linux or Solaris system, use console commands to change to the directory you downloaded the file to, and then run the program. After you start the installation program, it asks any questions it needs to know to properly install the JDK. You’re prompted for information such as which features you want to install and what folder you want to install the JDK to. You can safely choose the default answers for each of the options.

Perusing the JDK folders (install java)

When the JDK installs, it creates several folders on your hard drive. The location of these folders vary depending on your system, but in most cases the JDK root folder is found under Program Files\Java on your boot drive.

The name of the JDK root folder also varies, depending on the exact Java version you’ve installed. For version 1.5, the root folder is named jdk1.5.0.

Folder Description

  • bin The compiler and other Java development tools.
  • demo Demo programs you can study to learn how to use various Java features.
  • docs The Java API documentation.
  • include This library contains files needed to integrate Java with programs written in other languages.
  • jre The runtime environment files.
  • lib Library files, including the Java API class library.
  • src The source code for the Java API classes. This folder is only created if you unpack the src.zip file (this file may be named src.jar). After you get your feet wet with Java, looking at these source files can be a great way to learn more about how the API classes work.
Setting the path  (install java)

After you install the JDK, you need to configure your operating system so that it can find the JDK command-line tools. To do that, you must set the Path environment variable. This variable is a list of folders that the operating system uses to locate executable programs. To do this on Windows XP,follow these steps:

  1. Open the Control Panel and double-click the System icon. The System Properties dialog box comes up.
  2. Click the Advanced tab, and then click the Environment Variables button. The Environment Variables dialog box.
  3. In the System Variables list, select Path, and then click the Edit button.A little dialog box comes up to let you edit the value of the Path variable.
  4. Add the JDK bin folder to the beginning of the path value.Use a semicolon to separate the bin folder from the rest of the information that may already be in the path. Note: The exact name of the bin folder may vary on your system. For example:
    c:\Program Files\Java\jdk1.5.0\bin;other directories...
  5. Click OK three times to exit.The first OK gets you back to the Environment Variables dialog box. The second OK gets you back to the System Properties dialog box. And the third OK closes the System Properties dialog box.

For earlier versions of Windows (such as ancient Windows 98 or Me), you set the path by adding a Path statement to the AutoExec.bat file in the root directory of your C drive. For example:
path c:\Program Files\Java\jdk1.5.0\bin;other directories...

For Linux or Solaris, the procedure depends on which shell you’re using.

Using Java’s Command-Line Tools (Install java)

Java comes with several command-line tools you can run directly from a command
prompt. The two most important are javac, the Java compiler used to
compile a program, and java, the runtime used to run a Java program. These
tools work essentially the same no matter what operating system you’re
using. The examples in this section are all for Windows XP.

Compiling a program (Install java)

You can compile a program from a command prompt by using the javac command. Before you can do that, however, you need a program to compile.
Using any text editor, type the following text into a file and save it as HelloApp.java:


public class HelloApp
{
public static void main(String[] args)
{
System.out.println(“Hello, World!”);
}
}


Save the file in any directory you wish.

Open a command prompt and use a cd command to change to the directory

you saved the program file in. Then enter the command javac HelloApp.
java. This command compiles the program (javac) and creates a class file
named HelloApp.class.
Assuming you typed the program exactly right, the javac command doesn’t
display any messages at all. If the program contains any errors, one or more
error messages display. For example, if you type Public instead of public,
the compiler displays the following error message:

C:\java\samples>javac HelloApp.java
HelloApp.java:1: ‘class’ or ‘interface’ expected
Public class HelloApp
^
1 error

Using Java compiler options  (Install java)
  • -classpath or -cp: Use this option if your program makes use of class files that you’ve stored in a separate folder.
  • -deprecation: Use this option if you want the compiler to warn you whenever you use API methods that have been deprecated. (Deprecated methods are older methods that were once a part of the Java standard API but are now on the road to obsolescence. They still work, but may not in future versions of Java.)
  • -source: Use this option to limit the compiler to previous versions of Java. Note, however, that this option only applies to features of the Java language itself, not to the API class libraries.
  • -help: Use this option to list the options
Running a Java program (Install java)

When you successfully compile a Java program, you can then run the program by typing the java command followed by the name of the class that contains the program’s main method. The Java Runtime Environment loads, along with the class you specify, and then runs the main method in that
class. For example, to run the HelloApp program, type this command:

C:\java\samples>java HelloApp
The program responds by displaying the message “Hello, World!”.

Other Java command-line tools (install java)
  1. applet viewer: Runs a Web applet application.
  2. javadoc: Automatically creates HTML documentation for your Java
    classes.
  3. jar: Creates Java archive files, which store classes in a compressed
    similar to a Zip file.

java install on Mac OS X Tiger

 Mac OS X Tiger includes the full version of J2SE 1.4.2, preinstalled with the Java Development Kit (JDK) and the HotSpot virtual machine (VM), so you don't have to download, install, or configure anything

 

Last Updated ( Sunday, 09 July 2006 )

  home              contact us

 

©2006-2014 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground