3

did a fresh Ubuntu 17.10 installation a while ago and needed to install Java to build react-native apps on my PC. So I was able to install Java 9 in the manual way by downloading it from the Oracle official site.

Now when I run java --version I get

java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

and when I run javac --version I get

javac 9.0.4

And then I followed official react docs and created a react app. Then when I try to run it on an android emulator I got an error and I opened a github issue

Seems like it's an issue with Java 9 . So now I need to completely remove java 9 from my PC and install Java 8. How can I completely remove Java 9 from my Ubuntu 17.10 .

P.S :

When I ran sudo dpkg --list | grep -i jdk it showed Java 9. Then I followed this and ran sudo apt-get remove oracle-java9-* and now there's nothing shows when I run sudo dpkg --list | grep -i jdk

  • 1
    You can have multiple Java versions installed alongside each other and select which Java version to use from the terminal. Why did you remove Java 9 because it didn't work with React instead of installing Java 8 alongside Java 9 and then selecting Java 8 as the default Java version by following the instructions at How to set default Java version? – karel Jan 22 '18 at 01:52
  • 1
    Thanks @karel . Anyway I followed this and installed Java 8 and set it as default. – Thidasa Pankaja Jan 22 '18 at 02:43

1 Answers1

1

You can run below snippet to completely remove Java 9. You will need only one java (10, 9 or 8 whatever you like). Simply, purge everything about java and install fresh one later.

 sudo apt purge java*

You might want to look at this thread as I uninstalled Java 9 and installed new Java 10. https://stackoverflow.com/questions/49507160/how-to-install-jdk-10-under-ubuntu/50452313#50452313