Oracle ADF Faces Cookbook
上QQ阅读APP看书,第一时间看更新

Installing JDK

Java Development Kit (JDK) is the engine that runs everything from JDeveloper to the application server. The latest version of the JDK is JDK 7u25 at the time of writing, but if you find a newer version, don't hesitate to use it instead.

How to do it…

  1. Download the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.

    You should download the latest JDK and it should work just fine, but you have to select the JDK suitable for your Operating System and its architecture

    Tip

    You will need an oracle account. This is also important when installing the Oracle Database and JDeveloper, so you should get one now if you don't already have one, and it's free too!

    Depending on the operating system, the installation should be straightforward, as for each operating system, there should be an installer with it, for example, for Windows an exe installer, for Mac you will have a dmg, and an rpm for Linux

  2. Change the JDK installation directory to be inside APPS_HOME.
    How to do it…

    I chose the location to be C:\Users\amr\dev\apps\jdk\jdk7_25 (jdk 7 update 25) in Windows or /Users/amr/dev/apps/jdk/jdk7_25 in Nix-based systems

    Tip

    You will be prompted to install the public JRE (Java Runtime Environment); you can create a directory for the JRE as well under C:\Users\amr\dev\apps\jdk\jre7_25 or /Users/amr/dev/apps/jdk/ jre7_25.

  3. Create a JAVA_HOME environment variable, and update the PATH environment variable to look at the bin folder inside our jdk7_25 directory. This will help you greatly if you use the Java command line often.
  4. If you are using Windows, you should add the following environment variable:
    JAVA_HOME=%APPS_HOME%\jdk\jdk7_25
    

    You should change the PATH environment variable to the following:

    PATH=%JAVA_HOME%\bin;
    

    Tip

    Alternatively, you can achieve the same result as previous by opening the command prompt without going to your environment variable settings and using the set command as set PATH=%JAVA_HOME%\bin;%PATH%.

    Make sure you put %JAVA_HOME%\bin inside PATH and not %JAVA_HOME% as we want the path to reference all the Java executable files such as java and javac

    Tip

    I put it in the front because some software, when installed, can edit this and put it in the end without inserting a semicolon at the start. So, it's safer to put it in the front of the PATH environment variable.

  5. If you are using Mac or any other Nix-based system, you should edit the .bash_profile file to be the following:
    export JAVA_HOME=$APPS_HOME/jdk/jdk7_25
    export PATH=$JAVA_HOME/bin:$PATH
    

    Notice that in Nix-based systems editing a .bash_profile is little bit different as the separator is a colon and not a semicolon

How it works…

Installing the JDK is the main part. JDeveloper runs on top of the Java Virtual Machine (JVM), which requires the JDK installed. The application server also uses the JDK to run.

Defining environment variables such as JAVA_HOME and putting them inside the PATH variable is crucial as we might need to start applications using the command line and these variables will become handy during such circumstances. Also, we will need this in order to start the installer of JDeveloper after installing the database.

Now that you have finished the installation of JDK, close any terminals (command prompts) opened and start installing the database.