Search code examples
javaversion

Is it possible to change jdk 1.8.0_252 to jdk 1.8.0_251 in Ubuntu?


I have one project which I am trying to run using jdk 1.8.0_252 but I am facing problems in compilation so On other side Its working well in jdk 1.8.0_251.

Can anyone help to change jdk?


Solution

  • If you want to use a specific version of JAVA [JDK ] you can always install install it and point the JAVA_HOME to the newly installed version. You can have multiple versions of java installed in your system. Your environment variable should point to the Java version that you want to use.

    You need to edit bashrc and add the below :

    export JAVA_HOME=/usr/java/jdk1.8.0_251
    export PATH=${PATH}:${JAVA_HOME}/bin
    

    Verify the installation path for your Java version (example : /usr/java/jdk1.8.0_251).

    Restart your bash or start a new shell.