Skip to content
  • Home
  • Search
  • Tools
  • About
  • Terms of Service Agreement
  • Log In
  • Guest

Java: Handling Java Installation on Debian/Ubuntu – Eclipse fails with exit code

Posted on January 5, 2021January 21, 2021 By Andre Dias
java

Table of Contents

  • Scenario
  • THE FLASH SOLUTION
  • How to handle java’s environment?
  • DISCOVERING YOUR ENVIRONMENT
  • INSTALLING FRESH JAVA
    • Using apt (apt-get) command
    • Manual installation
    • Framework With Installer
  • SET AND RESET JAVA ENV
    • #SWITCHING THE ENVIRONMENT’S JAVA VERSION
    • #MANUAL SWITCH
    • WHEN THINGS DON’T HAPPEN AND HOW TO FIX
      • NOTE:

Scenario

Suppose that you try to start an Eclipse installation, and it fails returning exit code 8, 13, etc. , something like “java terminated exit code 8“.

This is usually caused due to the version of Java used by the environment that it is incompatible with the version of the Eclipse installation.

Another situation comes to happen when the available java is that you wish.

 

THE FLASH SOLUTION

If you like things very fast, here is the summary (or follow below the detailed information):

– installs or fix cmds:
sudo apt-get install default-jdk
sudo update-alternatives –config java
sudo apt-get purge default-jdk

– reboot if necessary

– check with:
sudo apt-get install default-jdk
java -version
whereis java

 

 

How to handle java’s environment?

We shall think about two situations.

We may have no java installed or not.

If you have already install java, go to “SET AND RESET JAVA ENV” section.

 

DISCOVERING YOUR ENVIRONMENT

Type:

java -version

Check if there are other alternatives:

sudo update-alternatives –config java

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.
update-alternatives: warning: forcing reinstallation of alternative /usr/lib/jvm/java-11-openjdk-amd64/bin/java because link group java is broken
update-alternatives: warning: not replacing /usr/bin/java with a link

This output shows just one option, but If there are more options will return the a list.

 

INSTALLING FRESH JAVA

At least three options:

  1. Using apt, the default installation method on Debian distributions.
  2. Manually, by download of a tar file.
  3. If a framework like Eclipse, you may download it with an installer.

Using apt (apt-get) command

The apt command usually installs the Open-JDK java.
Command:
sudo apt-get install default-jdk

Sometimes it is necessary to use Oracle’s versions due to compatibilities issues.
I usually install them manually, but it may be used apt-get when you add the source into /etc/apt/sources.list.
In these cases, the documentation will lead you.
I rarely use this.

 

Manual installation

A very good solution and very flexible. Easy and fast that enables to work with many different types.
Download the tar file and extract its content.
Move its content to another directory, other than the “Download” dir.
Create the command to use that version. For instance:

nano myCmd
“$JAVA_PATH/bin/java” -jar myApp.jar

chmod 775 myCmd

To run:
./myCmd

 

Framework With Installer

The installer will do everything.
Just follow the instructions.

 

SET AND RESET JAVA ENV

Here comes when things get more interesting and where the issues happen.

The tools to discover your java env:

Which installation is working to run “java” command:
java -version

When you have no idea where the installations may be:
whereis java

Which options do the environment have?
sudo update-alternatives –config java

 

#SWITCHING THE ENVIRONMENT’S JAVA VERSION

When the comand

sudo update-alternatives –config java

works, it is easy. Just get the option you desire.

 

#MANUAL SWITCH

Sometimes, the environment has some issue and things don’t go as you expect requiring some radical procedures, they are:

Install the default java, even though you do not wish it.

sudo apt-get install default-jdk

 

Test using the commands:
java -version
sudo update-alternatives –config java

The 1st cmd must return the same version as default and the second shall show at least one option.

WHEN THINGS DON’T HAPPEN AND HOW TO FIX

 

Uninstall the default java previously installed:

sudo apt-get purge default-jdk

sudo apt update

 

Force removing the java appointment:

sudo rm /usr/bin/java

 

Reinstall java default:

sudo apt-get install default-jdk

 

Retest.
If it fails, try one more.
If it still fails, reboot the system and repeat the installation and uninstallation procedures and reboot again.

If successful, you shall get this:

sudo ls -al /usr/bin/java
lrwxrwxrwx 1 root root 22 Jan 5 19:45 /usr/bin/java -> /etc/alternatives/java

sudo ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Jan 5 19:45 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java

 

Well, and if still fails, there is still one workaround.
Use the absolut path to call java. Ex.:

JAVA_HOME/bin/java -version

NOTE:

WRONG: this way doesn’t work:

ln -s /home/portables_d/jdk1.6.0_30_64/bin/java java630
java630 -version

Returns:

java630 -version
java630: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
alsdias@vmvd20 $ /home/portables_d/jdk1.6.0_30_64/bin/java -java

 

RIGHT: this way works:

/home/portables_d/jdk1.6.0_30_64/bin/java -version

Returns:

Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

 

Andre Dias
Andre Dias

Brazilian system analyst graduated by UNESA (University Estácio de Sá – Rio de Janeiro). Geek by heart.

Post navigation

❮ Previous Post: Lenovo Yoga: restoring recue point, images, etc.
Next Post: Windows: Machine Hanging, Slow? Caution When Killing Processes- The HostAppServiceUpdater.exe Example Using Lenovo ❯

Search

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
angular
bootstrap
browser
computer science
container
data persistence
database
devops
editors
hardware
health
hosting
info
internet
it
java
javascript
network
node.js
play
protocol
security
self-help
selfhelp
server
services
soft
software engeneering
sql
support
Systems
techs
Uncategorized
versioning
web
web design
windows
wordpress

Recent Posts

  • Angular From Scratch Tutorial – Step 9: Modal
  • Angular From Scratch Tutorial – Step 8: Miscellany
  • Angular From Scratch Tutorial – Index
  • angular: Reading JSON files
  • NODE.JS: SEQUELIZE: MVC Project – 4TH STEP

Categories

  • angular (19)
  • bootstrap (6)
  • browser (4)
  • computer science (4)
  • container (1)
  • data persistence (2)
  • database (11)
  • devops (1)
  • editors (1)
  • hardware (4)
  • health (2)
  • hosting (1)
  • info (1)
  • internet (2)
  • it (1)
  • java (13)
  • javascript (32)
  • network (6)
  • node.js (1)
  • play (1)
  • protocol (1)
  • security (4)
  • self-help (1)
  • selfhelp (1)
  • server (2)
  • services (1)
  • soft (1)
  • software engeneering (1)
  • sql (1)
  • support (2)
  • Systems (1)
  • techs (3)
  • Uncategorized (2)
  • versioning (6)
  • web (1)
  • web design (5)
  • windows (3)
  • wordpress (4)

Copyright © 2025 .

Theme: Oceanly by ScriptsTown

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT