Install Java on Debian 8

Updated , by Angel Guarisma

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.

Java is a powerful programming language. Software written in Java can be compiled and run on any system. Unlike Python or C, Java does not come pre-installed on Linode distribution images. This guide installs the OpenJDK 7 runtime environment and development kit in Debian 8. OpenJDK is the free and open-source implementation of the Java SE Development Kit.

Before You Begin

  1. Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

  2. This guide will use sudo wherever possible.

  3. Update your system:

    sudo apt update && sudo apt upgrade
    

Install Java Runtime Environment (Java JRE)

If you don’t plan on using Java to write programs, the JRE is all you need. In Debian the JRE metapackage is called default-jre, this metapackage pulls several packages needed to run headless Java applications.

sudo apt install default-jre

After the installation finishes, you can verify that the JRE was installed by running dpkg -s default-jre. The output will contain information about the Java installation, including a status line confirming that Java is installed:

Package: default-jre
Status: install ok installed

Install Java Development Kit (Java JDK)

If you plan on using Java to write or edit programs on your Linode, install the JDK.

sudo apt install default-jdk

After the installation finishes, verify that the JDK was installed with dpkg -s default-jdk. The command outputs a status line confirming that Java is installed:

Package: default-jdk
Status: install ok installed

You can also check by running javac, the Java compiler. If you need to compile a java application on your Linode, run javac foobar.java. Javac will compile the program, given no compilation errors. You can run the program using java foobar.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on

Try this guide to receive $100 at signup on a new account.

Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.