You can now test whether the environment variable has been set by executing the following command: echo $JAVA_HOME. Save and exit the file, and reload it: source /etc/environment. sudo subl /etc/environmentĪt the end of this file, add the following line, making sure to replace the highlighted path with your own copied path. Many programs, such as Java servers, use the JAVA_HOME environment variable to determine the Java installation location.Ĭopy the path from your preferred installation and then open /etc/environment using Sublime Text or your favourite text editor. sudo update-alternatives -config command Setting the JAVA_HOME Environment Variable You can use the following command, filling in the command you want to customize. This can also be done for other Java commands, such as the compiler ( javac), the documentation generator ( javadoc), the JAR signing tool ( jarsigner), and more. You can now choose the number to use as a default. Press to keep the current choice, or type selection number: * 0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto modeġ /usr/lib/jvm/java-6-oracle/jre/bin/java 1 manual modeĢ /usr/lib/jvm/java-7-oracle/jre/bin/java 2 manual modeģ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual modeĤ /usr/lib/jvm/java-8-oracle/jre/bin/java 3 manual modeĥ /usr/lib/jvm/java-9-oracle/bin/java 4 manual mode There are 5 choices for the alternative java (providing /usr/bin/java). The output will look something like the following. I have warned you :).You can configure which version is the default for use in the command line by using update-alternatives, which manages which symbolic links are used for different commands. So, any application that needs JRE/JDK to run will also be removed. For example: sudo apt-get autoremove gcj-4.6-jre-headless gcj-4.7-jre-headless openjdk-6-jre-headless openjdk-7-jre-headlessĭANGER! Pay attention on the list of package you are about to remove (you will see it before confirming the actual execution), because it will also remove packages that depend on the package in the list (parameters after sudo apt-get). If you are sure about what you do, just run the command without -s parameter and use sudo. It will do a simulation, so you can see what packages will be removed. This is the answer about how to uninstall (because the question is "How to uninstall JDK"), just ignore it if you have uninstalled it. Let's say that you have uninstall any JRE/JDK. if you run java -version or javac -version the version you have installed will be printed instead of a suggestion of package you need to install. If you install JRE/JDK by using package manager, I am sure that you can run java or javac, i.e. not using apt-get, aptitute, Software Center, Synaptic Package Manager, etc. This happens if you install JRE/JDK without using package manager, i.e. Maybe you have installed one, but you have not properly set it up. if this is still not it then this must be it : sudo apt purge oracle-java. if this is not a removable package (although it should be since that's what you installed) then run this instead : sudo apt purge openjdk. , it means you have not installed any JDK yet. Uninstall Java first (choose one of these three) : you can type the following into your terminal : sudo apt purge default-jre. When you run javac and the system says The program 'javac' can be found in the following packages. , it means you have not installed any JRE yet. When you run java and the system says The program 'java' can be found in the following packages. The openjdk-*-jre* is actually the JRE (Java Runtime Environment) of OpenJDK, the JDK of OpenJDK is something like openjdk-*-jdk. I see that you've already uninstalled the JDK (Java Development Kit) and JRE (Java Runtime Environment). I would like to remove JDK and JRE before install packages. If I run ls /usr/lib/jvm it says that there isn't such directory. The command javac -version gives this: `TThe program 'javac' can be found in the following packages: The command java -version gives: The program 'java' can be found in the following packages: The dpkg -list | grep -i jdk command gives nothing How can I uninstall it? I know that it is installed for the output of java -version and javac -version The guide that I follow for remove it is that answer, this and this. I have already installed JDK from the Ubuntu Software Center but I decide to remove it and reinstall it by command-line following these instruction. Please ensure JAVA_HOME points to JDK rather than JRE. 'tools.jar' seems to be not in Android Studio classpath. The below output shows that we have Oracle Java version 1.7.072 : java -version java version '1.7.072' Java (TM) SE Runtime Environment (build 1.7.072-b14) Java HotSpot (TM) 64-Bit Server VM (build 24. Today I installed Android Studio but when I opened it raised the error: 1) Checking current version of Java Installed Java version in Linux system can be verified using the following command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |