Debian installing java




















I manage the Write for DOnations program, write and edit community articles, and make things on the Internet. Where would you like to share this to? Twitter Reddit Hacker News Facebook. Share link Tutorial share link.

Sign Up. DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source. Not using Debian 10? Choose a different version or distribution.

Debian Prerequisites To begin this tutorial, you will need: One Debian 10 server with a non-root, sudo -enabled user. You can set this up by following our Debian 10 initial server setup guide. Java 11 is the current Long Term Support version of Java. About the authors. Brian Hogan. Brian Boucheron. As we have successfully downloaded the Oracle JDK, we can also verify the version installed by just giving the pathname.

So, by giving this path it would display the version name of the Java. What if, you want to check the files present in the JDK folder or you want to find the path of any file. Just mention the path to the folder and it would list all the files present in that particular directory. We have learned how to get the path to any file or directory.

You might be thinking that what is the use of creating alternatives. Basically, it helps to create symbolic links for default commands. Remember one thing, the command described below might show an error when you run it for the first time.

It would run successfully. Earlier we discussed the command to print the version name only. Here, this command used below will print the complete details of the Java version installed in the system. You can yourself check the difference between both the commands. Sometimes it happens that you might install various JDK versions on your system. In this situation, you need to select one JDK version to work upon.

Use update-alternatives command to print all the Java versions installed. Now, after getting the list, select the version you want to use. As of now, we have successfully installed the JDK on our system.

As it might be possible that you would many different Java versions installed on your system as I have discussed above. Select the path by running the following command as shown below:. Here, you need to paste the path in the file. The command to edit the file is as follows:. Once saved, run the below command to refresh the existing environment variables. Therefore, you have successfully set the path. If you want to verify the path, you can use the cat command to print the data. You will get to know that the changes you made have been successfully saved or not!

You can use any of the described commands below:. You now know how to install Java on Debian. If face any issues, then do let us know in the comment section. Skip to content. Table of Contents. Update the Packages. Install Default Jdk. While it may be worth investigating Oracle JDK 9, there may still be security issues and bugs, so you should opt for Oracle JDK 8 as your default version. There can be multiple Java installations on one server. 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.

The output will look something like the following. In this case, all Java versions mentioned above were installed. If we press the enter key in this case, Java 9 will be kept as the default. We can, for example, press 3 for Java 8 and receive the following output:. Now Java 8 would be the default.

Choose the default Java version that works best for your projects. The update-alternatives command can also be used for other Java commands, such as the compiler javac , the documentation generator javadoc , the JAR signing tool jarsigner , and more. You can use the following command, filling in the command you want to customize. To set this environment variable, we will first need to find out where Java is installed. You can do this by executing the same command as in the previous section:.

In this file, add the following line, making sure to replace the highlighted path with your own copied path. You can now test whether the environment variable has been set by executing the following command:.

You have now installed Java and know how to manage different versions of it. Where would you like to share this to?



0コメント

  • 1000 / 1000