Search code examples
upgradejavac

how to upgrade javac in Debian


could someone suggest elegant way to upgrade javac in Debian to version 8 ?!

javac -version

javac 1.7.0_261

java -version java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)


Solution

  • to those who needs elegant solution:

    1. download JVM from oracle: http://java.sun.com/products/archive/
    2. if you use Linux as I do, *.tar.gz file can be chosen (it has all related binaries)
    3. in Debian or other Linux untar it with command "tar xvzf PACKAGENAME.tar.gz", as a result all folders and subfolders will be created in related new folder, e.g. jdk-8u251-linux-x64. Related version of javac is in "dk-8u251-linux-x64/bin/" subfolder
    4. copy this all structure e.g. "jdk-8u251-linux-x64" e.g. to /home/user1
    5. modify PATH variable to allow system find related new javac: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user1/jdk1.8.0_251/bin/
    6. old javac can be renamed as a backup: mv /usr/bin/javac /usr/bin/javac_old

    verification of the result:

    javac -version

    javac 1.8.0_251

    Now javac on my system has the same version as java (as mentioned above, before they were quite different). In version 8 Java have several changes, e.g. some new ways how Time is handeling, which forced me to such changes.