Save the changes and exit the text editor. Open the bash configuration file using the command: nano ~/.bashrcĪdd the following lines at the end of the file: export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 To ensure the proper execution of Java applications, it is essential to set up the necessary environment variables. Execute the following commands to install OpenJDK: OpenJDK, an open-source alternative to Oracle JDK, is recommended for its compatibility and security. Sudo apt-key adv -keyserver -recv-keys 8B48AD6246925553 ![]() Now import the repository’s key, and run: sudo sh -c 'echo "deb $(lsb_release -sc) main contrib non-free" > /etc/apt//debian.list' Execute the following commands in your terminal: sudo apt install curl dirmngr gnupg To benefit from a well-maintained Java installation, it is recommended to add the official Debian repository. This command will refresh the repository, allowing you to install the latest versions of software packages. Sudo apt install apt-transport-https lsb-release ca-certificates curl dirmngr gnupg Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal: sudo apt update We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root. A non-root sudo useror access to the root user.You’ll need an internet connection to download the necessary packages and dependencies for Java. SSH access to the server (or just open Terminal if you’re on a desktop).It’s recommended that you use a fresh OS install to prevent any potential issues.A server running one of the following operating systems: Debian 12 ( Bookworm).I will show you the step-by-step installation of Java programming language on a Debian 12 ( Bookworm). The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘ sudo‘ to the commands to get root privileges. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. As of the time of writing, the latest JDK version is Java 17. Consider your project requirements and compatibility factors when making this decision. Selecting the appropriate JDK version is crucial. The JDK facilitates Java application development, while the JRE allows you to run Java applications. ![]() The installation of Java involves two key components: the Java Development Kit (JDK) and the Java Runtime Environment (JRE). For those of you who didn’t know, Java is a versatile programming language, that finds its application in numerous software solutions. Please feel free to share your thoughts and feedback in the comment section below.In this tutorial, we will show you how to install Java on Debian 12. Users may assure a successful installation and verification of Java 17 on their Debian system by following the step-by-step instructions provided, allowing them to take advantage of its features and capabilities. Run the following command to validate the JAVA_HOME environment variable:Īlso read: You might also find useful our guide on How to Install MongoDB on Debian 11 Conclusionįinally, installing Oracle Java 17 on Debian entails downloading the relevant package, extracting the files to the desired location, and configuring the necessary environment variables. If you do not wish to source it right now, the modifications will be applied the next time you launch a new terminal session. The environment variables in your current terminal session will be modified when you source the file. To implement the changes instantly, you must source the.bashrc file. These commands will append the export lines to the end of the.bashrc file. Echo 'export PATH=$JAVA_HOME/bin:$PATH' > ~/.bashrc
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |