This tutorial exists for these OS versions
- Debian 11 (Bullseye)
On this page
Prerequisites
- A server running Debian 11 with a working Internet connection.
- Enough RAM (memory) to run your system smoothly. At least 3.5 GB should be available.
- A non-root user with sudo privileges.
Step 1. Update the System
Before you can install anything, you will need to make sure that your system is up-to-date. You can do this by running the following command in the terminal.sudo apt update && sudo apt upgrade -yThe above command may take a few minutes, depending on the speed of your Internet connection.
Step 2. Installing Java JDK 17 on Debian 11
It's recommended to check if Java is already installed on your system. To do so, run the following command in the terminal.java -versionIf Java isn't installed yet, you will get an output similar to this one. The output shows that no Java installation has been found on the system. Otherwise, if it is installed, you should get a version number. The easiest method of installing the JDK is by using the apt package manager. Debian 11’s default repository included Java 17, as shown in the screenshot below.
sudo apt-cache search openjdk | grep 17Run the following command to install Java 17 on Debian 11. We will install both JDK and JRE in order to run Java applications and applets.
sudo apt install openjdk-17-jdk
sudo apt install openjdk-17-jreOnce the installation is completed, run the following command in order to check if it works properly. If everything works fine, you should get an output similar to the one shown below.
java -versionTo verify if the JDK is installed properly, we will check the version of javac, which is the Java compiler.
javac -version
Step 3. Configuring the Environmental Variable
Some Java applications require the JAVA_HOME environmental variable in order to run properly. Some programs are very specific in how they are executed. If JAVA_HOME isn't set, you'll get an error. Setting JAVA_HOME will prevent this problem from arising. First, let's determine the path of Java where Java is installed using the update-alternatives command.sudo update-alternatives --config javaThis command will output the installation path of Java as you can see in the screenshot below.
- /usr/lib/jvm/java-11-openjdk-amd64/bin/java is the installation path of path of OpenJDK 11
- usr/lib/jvm/java-17-openjdk-amd64/bin/java is the installation path of path of OpenJDK 17
sudo nano /etc/environmentYou have to paste the path that you've copied at the end of the line export JAVA_HOME=... into the file, like this. Advertisement This file will set the JAVA_HOME path of OpenJDK 17 as environmental variables for all users in the system. Save and exit the file by pressing CTRL+X, Y, and Enter. To apply the change, run the following command.
sudo source /etc/environmentTo verify that the path variable has been applied, run the following command.
echo $JAVA_HOMEThe path should be set to the path of OpenJDK 17, which you have copied above. From now on, you don't have to set the JAVA_HOME path every time when using Java programs. Also, if you want to use other OpenJDK versions instead of 17, adapt the path accordingly.
Step 4. Testing the Java Installation
In this step, we will test if Java was installed properly on your system by creating a simple helloworld Java application, compile, and execute it using the JRE. First, run the following command to create a new directory called helloworld and navigate into it. Here, we will store all our files related to our first Java application.mkdir helloworld && cd helloworldNext, create a new file named helloworld.java using your favorite text editor.
sudo nano helloworld.javaNow, populate the file with the following content.
public class helloworld{
public static void main(String[] args) {
System.out.println("Netcloud24-Hello World");
}
}
Save and exit the file by pressing CTRL+X, Y, and Enter. Now that we have created our program, we need to compile the Java source code into bytecode (class file) using the javac compiler.
javac helloworld.javaYou will get a new file called helloworld.class, which is the compiled Java class file. The command above will only compile the Java source code into bytecode. In order to run the program, we run the java command with the name of our class file as an argument.
java helloworldIf everything works well, you'll see a message "Netcloud24-Hello World" on the screen. You have successfully installed Java. For further reading on the Java language, refer to its official documentation.
Conclusion
Windows VPS
Windows VPS UK
Windows VPS
VPS Windows
Serwer VPS Windows
VPS Windows Deutschland
Windows VPS Hosting
VPS Windows España
Windows VPS Nederland
VPS Windows Italia
VPS Windows Portugal
VPS Windows Россия
VPS Windows Украина
VPS Windows 日本
VPS Windows Sverige
VPS Windows Norge
VPS Windows عربى
VPS Windows Türkiye
Remote Desktop Services (RDS)
RDS CAL (Client Access License)
Remote Desktop VPS
Keywords: windows vps uk, windows vps, uk windows vps, windows vps hosting uk, vps windows server, uk vps windows, vps windows, servidor vps windows, vps uk windows, vps with windows, virtual private server windows, windows virtual private server, windows vps server uk, vps for windows, servidores vps windows, vps windows uk, windows vps hosting, vps windows hosting, windows vps server, windows virtual private servers, vps on windows, vps windows servers, cheap windows vps uk, windowsvps, windows desktop vps, buy vps windows, windows server vps, windows 10 vps uk, rds services, rds cal, remote desktop services, remote desktop hosting
#windowsvps #vpshosting #ukvps #virtualserver #windowsvpsuk #vpsserver #hostingvps #cloudvps #windowsvpshosting #cheapvps #vpswithwindows #windowsserver #servervps #vpssolutions #vpswindows #rdscal #remotedesktop #remotedesktopvps #rds #windowsrds
vps windows