Kategori arşivi: Java

Difference between java/javaw/javaws

  1. The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class’s main method.
    1. Display output/errors
  2. The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don’t want a command prompt window to appear.
    1. No display of output/errors. Can be used to silently push the output/errors to text files. Mostly used to launch GUI based applications.
  3. javaws: (java web start) to download and run the distributed web applications. again No console is associated.

All are part of JRE and use same JVM

Install Java 1.8 on Ubuntu 14.04 LTS

Source: http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux

  1. Download the Oracle Java JDK/JRE for Linux to your home directory eg (/home/somebody/java/jre-8u40-linux-x64.gz) (DOWNLOAD: http://www.oracle.com/technetwork/java/javase/downloads/index.html):
  2. Check if you have Java installed on your system:
    java -version
  3. Copy the Oracle Java binaries into the /usr/local/java directory
    First: cd ~
    JDK: sudo cp --parents java/jdk-8u40-linux-x64.gz /usr/local
    JRE: sudo cp –parents java/jre-8u40-linux-x64.gz /usr/local
  4. Unpack the compressed Java binaries:
    First: cd /usr/local/java
    JDK: sudo tar xvzf jdk-8u40-linux-x64.gz
    JRE: sudo tar xvzf jre-8u40-linux-x64.gz
  5. Edit the system PATH file /etc/profile and add the following system variables to your system path:
    First: sudo nano /etc/profile

    • If you are installing the JDK then Type/Copy/Paste:
      JAVA_HOME=/usr/local/java/jdk1.8.0_40
      JRE_HOME=$JAVA_HOME/jre
      PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
      export JAVA_HOME
      export JRE_HOME
      export PATH
    • Or if you are installing the JRE then Type/Copy/Paste:
      JRE_HOME=/usr/local/java/jre1.8.0_40
      PATH=$PATH:$JRE_HOME/bin
      export JRE_HOME
      export PATH

    Save the /etc/profile file and exit

  6. Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located:
    • If you are installing the JDK then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jdk1.8.0_40/jre/bin/java” 1
    • Or if you are installing the JRE then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jre1.8.0_40/bin/java” 1
      • this command notifies the system that Oracle Java JRE is available for use
    • Only if you are installing the JDK then Type/Copy/Paste: sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/local/java/jdk1.8.0_40/bin/javac” 1
      • this command notifies the system that Oracle Java JDK is available for use
  7. Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java:
    • If you are installing the JDK then Type/Copy/Paste: sudo update-alternatives –set java /usr/local/java/jdk1.8.0_40/jre/bin/java
    • Or if you are installing only the JRE then Type/Copy/Paste: sudo update-alternatives –set java /usr/local/java/jre1.8.0_40/bin/java
      • this command will set the java runtime environment for the system
    • If you are installing only the JDK then Type/Copy/Paste: sudo update-alternatives –set javac /usr/local/java/jdk1.8.0_40/bin/javac
      • this command will set the javac compiler for the system
    • If you are installing the JDK then Type/Copy/Paste: sudo update-alternatives –set javaws /usr/local/java/jdk1.8.0_40/bin/javaws
    • Or if you are installing the JRE then Type/Copy/Paste: sudo update-alternatives –set javaws /usr/local/java/jre1.8.0_40/bin/javaws
      • this command will set Java Web start for the system
  8. Reload your system wide PATH /etc/profile by typing the following command:
    . /etc/profile
  9. Test to see if Oracle Java was installed correctly on your system:
    java -version
    javac -version
  10. reboot