![]() In this post, you have learned how to install Java on Debian 11 using the official repositories which is the most recommended and secure way to do it. So, Java is installed and ready for you to play with. ![]() To apply the changes you need to run source /etc/environment sudo nano /etc/environmentĪnd add the following line JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" In the case of Java 11 installed via OpenJDK, the path is /usr/lib/jvm/java-11-openjdk-amd64/bin/java. So we have to add this path as a Java variable for applications and configuration to be done properly. The PATH column refers to the path where it is installed. When you ran the command sudo update-alternatives -config java Now it’s time to set the environment variable. OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing) OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) Just type in the number associated with the version. And then we are asked which version we want to be the default. Where each installed Java version is identified with a number. If you have a single version of Java installed, then you will see an output screen like this There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/javaīut if like me you have installed several versions of Java then you will see the following screen Java on Debian 11 So, run sudo update-alternatives -config java Of course, if you have only one version of Java installed, then there is not much of a trick here. There is a command that allows us to define a Java version as the default version on the system. Configuring the system before using Java on Debian 11 So there is no problem if you have two or more versions of Java installed, but you need to configure your system. Or if you just want the JRE sudo apt install openjdk-17-jre So, to install it, just run sudo apt install openjdk-17-jdk This can also be found in the official Debian repository. However, if you are an enthusiast of the language and you like to try its new features, you can install version 17 which is the latest version available. Then you can install Java version 11 like this sudo apt install default-jdkĪlthough the command does not specify it, the default-jdk package refers to Java 11 which is the latest LTS version of this language.Īlso, this package installs not only the JDK (libraries, compiler, and other tools to develop with the language) but also the JRE (JVM and other tools to run Java applications) so the installation is quite complete.Īlthough if all you need is the JRE and only run JAVA applications then you have to execute the following command sudo apt install default-jre ![]() So first you have to open in terminalĪfter that, update Debian 11 as follows sudo apt update Java is owned by Oracle but thanks to the free OpenJDK implementation we can install it from the official Debian 11 repositories. Java is a versatile programming system with a multitude of applications since its scope of application is so wide that Java is used in both mobile phones and household appliances. When Java is combined with other powerful tools, it allows us to create complete, robust, scalable, portable, and distributed applications. To achieve this, Java has a JVM that does the translations and implementations. It was born with the goal that programmers would only have to write the code for a program once, and that the program would run on any device. Java is a class-based, object-oriented programming language. Or you need to run a program that uses this technology that is still in use today. So it is necessary to learn how to install Java on Debian 11 if you plan to make use of this language. Debian 11 is quite popular among developers and professionals using Java. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |