GoDaddy VPS is a shared server that provides computational services, databases, storage space, automated weekly backups, 99% uptime, and much more. It’s a cheaper alternative to some other popular cloud-based services such as AWS, GPC, and Azure.Java is a high-level, class-based, object-oriented programming language created by James Gosling in 1995. The JDK (Java Development Kit) is a development environment for building applications in the Java programming language. To know more please visit Java Tutorial. In this article, we will discuss how to install the latest version of JDK and JRE on GoDaddy VPS (Ubuntu).
Installing JRE and JDK on Godaddy Server
Step 1: Open your terminal and ssh into the Godaddy server.
$ ssh [username]@[ip]
Step 2: Update and upgrade the server by running.
$ sudo apt update -y $ sudo apt upgrade -y
Step 3: Install the default Java Runtime Environment (JRE) from APT software repositories.
$ sudo apt install default-jre
Step 4: Verify the installation by performing a version check
$ java -version
Step 5: Now install Java Development Kit (JDK) to use JRE to compile and run s Java-based programs and software.
$ sudo apt install default-jdk
Step 6: Verify the installation by performing a version check
$ javac -version
Compiling and executing Java Program
Step 1: Create a basic Java program that outputs ‘Geeks For Geeks’.
$ nano GFG.java
GFG.java:
import java.io.*;
class GFG {
public static void main (String[] args) {
System.out.println( "Geeks For Geeks" );
}
} |
Step 2: Use the java compiler to compile the GFG program.
$ javac GFG.java
Step 3: Finally, use JVM to execute the newly created class file.
$ java GFG