Hot questions for Using Ubuntu in install



Presuming that you are running the 64bit Ubuntu, the fix suggested for "Issue 82711" should solve your problem.

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Update: For Ubuntu 15.10 & 16.04 sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6


How do I install Java Development Kit (JDK) 10 on Ubuntu?

The installation instructions on Oracle's help center only explain how to download and extract the archive on Linux platform, without any system setup.


Update: JDK 11 Now Available
sudo apt-get install openjdk-11-jdk

For JDK 10
Option 1: Easy Installation (PPA)
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer

Then set as default with:

sudo apt-get install oracle-java10-set-default

And finally verify Installation with:

$ java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

Source: Linux Uprising

Option 2: Manual Installation
  • Download OpenJDK 10 binaries for Linux.

  • Untar the downloaded archive:

    tar xzvf openjdk-10_linux-x64_bin.tar.gz
  • Move the extracted archive to where your system keeps your installed JDKs:

    sudo mv jdk-10 /usr/lib/jvm/java-10-openjdk-amd64/
  • Add the new Java alternative:

    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-10-openjdk-amd64/bin/java 1
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-10-openjdk-amd64/bin/javac 1
  • Update your system's java alternatives and choose JDK 10:

    $ sudo update-alternatives --config java
    here are 3 choices for the alternative java (providing /usr/bin/java).
      Selection    Path                                            Priority   Status
      0            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      auto mode
    * 1            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1         manual mode
      2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
      3            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode
    Press <enter> to keep the current choice[*], or type selection number: 


    $ sudo update-alternatives --config javac
    There are 3 choices for the alternative javac (providing /usr/bin/javac).
      Selection    Path                                          Priority   Status
    * 0            /usr/lib/jvm/java-9-openjdk-amd64/bin/javac    1091      auto mode
      1            /usr/lib/jvm/java-10-openjdk-amd64/bin/javac   1         manual mode
      2            /usr/lib/jvm/java-8-openjdk-amd64/bin/javac    1081      manual mode
      3            /usr/lib/jvm/java-9-openjdk-amd64/bin/javac    1091      manual mode
    Press <enter> to keep the current choice[*], or type selection number: 1
    update-alternatives: using /usr/lib/jvm/java-10-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in manual mode
  • Verify your installation with:

    $ java --version
    openjdk 10 2018-03-20
    OpenJDK Runtime Environment 18.3 (build 10+46)
    OpenJDK 64-Bit Server VM 18.3 (build 10+46, mixed mode)


    $ javac --version
    javac 10
  • Done

If you prefer Oracle's JDK, download it and follow the installation steps as shown above.


I'm new to Ubuntu and Linux in general. I want to code in Java on my computer, but I'm having problems installing IntelliJ IDEA on Ubuntu. I have downloaded and extracted the file and for some reason renamed the folder to idea. I tried moving the folder to /usr/share/applications or something but I didn't have permission. I used sudo -i in terminal to gain permission but didn't manage to get out of root folder. Can anyone help me with a step by step way to move the folder, create a shortcut in the search bar or whatever it's called and install it properly?


Note: This answer covers the installation of IntelliJ IDEA. For an extended script, that covers more JetBrains IDEs, as well as help for font rendering issues, please see this link provided by brendan. Furthermore, a manual Desktop Entry creation is optional, as newer versions of IntelliJ offer to create it on first startup.

I have my intellij int /opt folder. So what I do is:

  • Download Intellij
  • Extract intellij to /opt-folder: sudo tar -xvf <intellij.tar> -C /opt/ (the -C option extracts the tar to the folder /opt/)
  • Create a Desktop Entry File called idea.desktop (see example file below) and store it anywhere you want (let's assume in your home directory)
  • Move the idea.desktop from your home directory to /usr/share/applications: sudo mv ~/idea.desktop /usr/share/applications/

Now (in a lot) Ubuntu versions you can start the application after the GUI is restarted. If you don't know how to do that, you can restart your PC..

idea.desktop (this is for community edition version 14.1.2, you have to change the paths in Exec= and Icon= lines if the path is different for you):

[Desktop Entry]                                                                 
Name=IntelliJ IDEA
Comment=IntelliJ IDEA

Edit I also found a shell script that does this for you, here. The given script in the link installs Oracle Java 7 for you and gives you the choice between Community and Ultimate Edition. It then automatically downloads the newest version for you, extracts it and creates a desktop entry. I have modified the scripts to fulfill my needs. It does not install java 8 and it does not ask you for the version you want to install (but the version is kept in a variable to easily change that). You can also update Intellij with it. But then you have to (so far) manually remove the old folder! This is what i got:

Edit2 Here is the new version of the script. As mentioned in the comments, breandan has updated the script to be more stable (the jetbrains website changed its behavior). Thanks for the update, breandan.


echo "Installing IntelliJ IDEA..."

# We need root to install
[ $(id -u) != "0" ] && exec sudo "$0" "$@"

# Attempt to install a JDK
# apt-get install openjdk-8-jdk
# add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install oracle-java8-installer

# Prompt for edition
#while true; do
#    read -p "Enter 'U' for Ultimate or 'C' for Community: " ed 
#    case $ed in
#        [Uu]* ) ed=U; break;;
#        [Cc]* ) ed=C; break;;
#    esac

# Fetch the most recent version
VERSION=$(wget "" -qO- | grep -P -o -m 1 "(?<=[^/]+(?=/)")

# Prepend base URL for download

echo $URL

# Truncate filename
FILE=$(basename ${URL})

# Set download directory

echo "Downloading idea-I$ed-$VERSION to $DEST..."

# Download binary
wget -cO ${DEST} ${URL} --read-timeout=5 --tries=0

echo "Download complete!"

# Set directory name

echo "Installing to $DIR"

# Untar file
if mkdir ${DIR}; then
    tar -xzf ${DEST} -C ${DIR} --strip-components=1

# Grab executable folder

# Add permissions to install directory
chmod -R +rwx ${DIR}

# Set desktop shortcut path

# Add desktop shortcut
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application" -e > ${DESK}

# Create symlink entry
ln -s ${BIN}/ /usr/local/bin/idea

echo "Done."  

Old Version


echo "Installing IntelliJ IDEA..."

# We need root to install
[ $(id -u) != "0" ] && exec sudo "$0" "$@"

# define version (ultimate. change to 'C' for Community)

# Fetch the most recent community edition URL
URL=$(wget "${ed}&os=linux" -qO- | grep -o -m 1 "*gz")

echo "URL: ${URL}"
echo "basename(url): $(basename ${URL})"

# Truncate filename
FILE=$(basename ${URL})

echo "File: ${FILE}"

# Download binary
wget -cO /tmp/${FILE} ${URL} --read-timeout=5 --tries=0

# Set directory name

# Untar file
if mkdir /opt/${DIR}; then
    tar -xvzf /tmp/${FILE} -C /opt/${DIR} --strip-components=1

# Grab executable folder

# Add permissions to install directory
chmod 755 ${BIN}/

# Set desktop shortcut path

# Add desktop shortcut                     
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application" > ${DESK}

echo "Done."    


So Java 11 is out. Does anybody know how to install it (OpenJDK from Oracle) from the command line?

I would like to see something like it was before for Oracle Java 10:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer

P. S. In the similar question proposed instruction:

sudo apt-get install openjdk-11-jdk

doesn't work.


Now it is possible to install openjdk-11 this way:

sudo apt-get install openjdk-11-jdk

(Previously it installed openjdk-10, but not anymore)


Since yesterday, I've been trying to install the JDK8 on my Ubuntu machine, but it has been failing constantly.

I've been trying to run the commands:

sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

But I can't continue because when running the command sudo apt-get install oracle-java8-installer all I get is:

Connecting to (||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-18 11:07:34 ERROR 404: Not Found.

download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1

My Setup is a 64-bit Ubuntu 14.04.


After a lot of googling around I found a answer on the Ubuntu forum.

Basically, the problem seems to be that there is a new version of java and the installer wasn't updated to reference it.

If your machine is a Linux x64 with an AMD64 processor, you need the latest Java8 version, and you previously installed version 8u212, this can be easily fixed by running these commands (Credit for the original version goes to g1zmo2):

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u212|JAVA_VERSION=8u221|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=|PARTNER_URL=|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ=.*|SHA256SUM_TGZ="15ad4f7260d2416ac1558341d9d0a0ec5b83904e4ac4a22c8a3242e4e217649b"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_212|J_DIR=jdk1.8.0_2221|' oracle-java8-installer.*

And then running the JDK 8 installer commands like you normally would =):

sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

If your machine is not a Linux x64 AMD64, your previous version wasn't 8u212 or you are looking for Java 9, well, you are in luck. Today is the day you'll learn to fix your java installer for your own needs.

For the purposes of this tutorial, we'll assume you want Java 8u181 and you had previously installed Java 8u171 (because that's what I have).

First, I need you to go to Java's JDK Downloads page (For Java8, go here, click the "Downloads" tab, and then the "Java SE 8u181" link).

Now, look up the JDK version you need based on your machine. In my case, my machine is running on Ubuntu 14.04 64-bit, so I need "Linux x64".

Copy the link that takes you to the download you need. Don't forget to accept the license agreement. In my case (Linux x64), I need:

For the purposes of this tutorial, we only need the link's path: Keep it safe; we'll need it later.

Now look up the checksum link in the page and click it.

This should take you to a plain html table page. Just look for the sha256 that fits your machine.

Again, my machine is a "Linux x64" so I need 1845567095bfbfebd42ed0d09397939796d05456290fb20a83c476ba09f991d3, like in the picture. Copy the value, and keep it safe; we'll need it later too.

Now, open a terminal on your machine and enter the folder where the java installer file are:

cd /var/lib/dpkg/info

Great, now execute this:

sudo grep --color -P "JAVA_VERSION=[a-z0-9]+" oracle-java8-installer.config

The output should look something like this:

This tells us what is the java version that the installer is configured to install. So to change those values easily we would run something like this:


For our case, we are upgrading from 8u171 to 8u181, so we would execute:

sudo sed -i 's|JAVA_VERSION=8u171|JAVA_VERSION=8u181|' oracle-java8-installer.*

Ok, now we need to update the download url.

sudo grep --color -P "PARTNER_URL=[^ ]+" oracle-java8-installer.config

To update it, we should execute a command like this:

sudo sed -i 's|PARTNER_URL=<INSTALLER CURRENT JAVA URL HERE>|PARTNER_URL=<NEW URL HERE>|' oracle-java8-installer.*

Remember that URL I told you to save at the start? Well, we'll need it now. Place it as your new url, like this:

sudo sed -i 's|PARTNER_URL=|PARTNER_URL=|' oracle-java8-installer.*

After that, we need to update the checksum. So please execute this command:

sudo grep --color -P '[^#]SHA256SUM_TGZ="[^"]+"' oracle-java8-installer.config

This prints out a couple different SHA256:

Notice that they are all different. We'll get back at that in a second. So, to update the SHA256, we would need to execute this command:

sudo sed -i 's|SHA256SUM_TGZ="<INSTALLER CURRENT JAVA HASH HERE>"|SHA256SUM_TGZ="<NEW JAVA HASH>"|' oracle-java8-installer.*

But how do we know which of the current Java hashes to replace? Well, we need to find out our processor's architecture:

dpkg --print-architecture

In my case, this will output amd64. This means I should grab the second link. How do I know this? Well, I read the source code (sudo gedit oracle-java8-installer.config), so trust me on this:

  • If your architecture is i386, i586 or i686, grab the first one.
  • If amd64, grab the second one.
  • If armv7l or armv6l, grab the third one.
  • If armv8l, arm64 or aarch64, grab the fourth one.
  • If none of the above, you are out of luck...

So, as mine is amd64, using the new hash we obtained from Java's website, I would execute:

sudo sed -i 's|SHA256SUM_TGZ="b6dd2837efaaec4109b36cfbb94a774db100029f98b0d78be68c27bec0275982"|SHA256SUM_TGZ="1845567095bfbfebd42ed0d09397939796d05456290fb20a83c476ba09f991d3"|' oracle-java8-installer.*

Finally, we need to modify the installers JDK directory name, so execute this to find the current one:

sudo grep --color -P "J_DIR=[^ ]+" oracle-java8-installer.config

In my case this printed:

So we would execute something like this:

sudo sed -i 's|J_DIR=<INSTALLER CURRENT JDK VERSION HERE>|J_DIR=<NEW JDK VERSION>|' oracle-java8-installer.*

Being my current version jdk1.8.0_171, I execute:

sudo sed -i 's|J_DIR=jdk1.8.0_171|J_DIR=jdk1.8.0_181|' oracle-java8-installer.*

And... that's it. We are ready to call the java installer, yay. (phew... this took longer to type that I thought at first).


Gradle builds run forever and I can't figure out why.

I have installed Android Studio on Ubuntu 15.04. It is set up with all of the default options from the wizard.

I have created an empty project and I have not added any code. When I attempt to build the project a gradle process starts up but never terminates. I have tried letting it run for an hour but there was no progress. I end up having to manually kill gradle in order to close Android Studio. (via "ps aux | grep gradle; kill -9 ")

I am using open-jdk 1.7, but I have also tried using oracle java (with the same results).

My desktop has 32 GB ram. I have attempted increasing the amount of memory allocated to Android Studio to no effect.

My CPU has AMD-64 architecture. Although I couldn't find anything on google suggesting this was the cause of my woes, could it be responsible?

There are no error messages that appear in the terminal when I run manually. Below is the terminal output (annotated by me):

#starting Android Studio
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Starting process 'command '/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java''. Working directory: /home/cody/Documents/AndroidStudio/MyApplication Command: /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -version
Successfully started process 'command '/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java''

#gradle starts up, this never terminates unless I terminate it myself
Starting daemon process: workingDir = /home/cody/.gradle/daemon/2.4, daemonArgs: [/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8,, -Duser.language=en, -Duser.variant, -cp, /home/cody/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 2.4, /home/cody/.gradle, /home/cody/.gradle/daemon, 10800000, fb6e1111-7ac5-4afc-9630-890712f3195f, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8,, -Duser.language=en, -Duser.variant]Starting process 'Gradle build daemon'. Working directory: /home/cody/.gradle/daemon/2.4 Command: /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.variant -cp /home/cody/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4/lib/gradle-launcher-2.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 2.4 /home/cody/.gradle /home/cody/.gradle/daemon 10800000 fb6e1111-7ac5-4afc-9630-890712f3195f -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.variant
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 0.99 secs.
Connected to daemon DaemonInfo{pid=9307, address=[98dcf537-f8f6-4e74-ad4d-c57a86d4a6c1 port:48946, addresses:[/0:0:0:0:0:0:0:1%1, /]], idle=false, context=DefaultDaemonContext[uid=fb6e1111-7ac5-4afc-9630-890712f3195f,javaHome=/usr/lib/jvm/java-7-openjdk-amd64,daemonRegistryDir=/home/cody/.gradle/daemon,pid=9307,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=0ec396f9-4092-4fd1-93c4-0837d861cb85.1, currentDir=/home/cody/Documents/AndroidStudio/MyApplication}.

#I manually kill gradle
The message received from the daemon indicates that the daemon has disappeared.


Try sudo apt-get install lib32z1 as in this post. I had the same problem on Lubuntu and fixed it this way.


I am trying installl jave 8 (jre/jdk) in my ubuntu 14.0.4

sudo apt-get update

sudo apt-get install oracle-java8-installer

I get below error

Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2017-10-17 16:42:09--
Resolving (,
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [following]
--2017-10-17 16:42:10--
Resolving (, 2600:141b:13:28c::2d3e
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: [following]
--2017-10-17 16:42:10--
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-10-17 16:42:11 ERROR 404: Not Found.

download failed
Oracle JDK 8 is NOT installed.

looks like it is looking for 8u144 which is not available.

How can i make it look for 8u151?

I did this sudo add-apt-repository ppa:webupd8team/java -> no luck


This has been an issue as of today (we hit the webupd8team ppa once a day for oracle-8-installer). From past experience it's probably due to the fact that Oracle released their quarterly Java updates overnight (8u151 and 8u152), and moved or deleted 8u144. If you dig into the ppa you'll see it only references 8u144.

I'm not that knowledgable on how the webupd8team ppa is managed, but presumably it requires some manual intervention on the maintainer's part to fix the issue.


I already have java8 working but when I try to install java9 this is what happens everytime:

sudo apt-get install oracle-java9-installer

Reading package lists... Done Building dependency tree Reading state information... Done Package oracle-java9-installer is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'oracle-java9-installer' has no installation candidate


It seems Oracle stopped supporting Java 9 so the PPA does not contain Java9 installer anymore. There is nothing wrong on your end, with your machine.

It looks like Java9 is a short-term support version, and so will java 10 be too. Java 11 will be a LTS support. For more details on the new Java release approach see this answer.

Because this, you can't install Java9 using the ppm anymore, you have to do it manually. You will have to go to the java 9 archive downloads, log in with an Oracle account, download the .tar.gz, extract the .tar.gz and copy it to the install location.


I have the very common problem that rJava does not install correctly on Ubuntu. This problem has been dsicussed in multiple places here, here, here, to name a few.

The basic problem is that on installing the rJava package, the following error message is produced

configure: error: Unable to run a simple JNI program. Make sure you have configured R with Java support (see R documentation) and check config.log for failure reason.
Warning in system(cmd) : error in running command
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/jonno/R/x86_64-pc-linux-gnu-library/3.6/rJava’

There are various closely related solutions to this problem. Most of them use sudo R CMD javareconf to configure Java for R (also a -e variant). Some suggest setting the JAVA_HOME path in the environment variables (others say not to). Others suggest uninstalling and re-installing R whilst others suggest installing rJava from cran. There are several who reccomend update alternatives. There are other variants of these solutions.

I have tried combinations of all of the above, and have got nowhere, so am clearly doing something wrong.

entering echo $JAVA_HOME returns


my etc/environment looks like this


When I run R CMD javaconf, it looks like this

Java interpreter : /usr/lib/jvm/java-11-openjdk-amd64/java
Java version     : 11.0.4
Java home path   : /usr/lib/jvm/java-11-openjdk-amd64
Java compiler    : /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/lib/jvm/java-11-openjdk-amd64/bin/jar

trying to compile and link a JNI program 
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-uuRxut/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.o -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/java-11-openjdk-amd64
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib/R

What am I doing wrong and how do I get rJava to install properly?


having managed to successfully install rJava using sudo apt-get install r-cran-rjava I know get the following error

Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/usr/lib/R/site-library/rJava/libs/': cannot open shared object file: No such file or directory


I've investigated with the original poster (we work at the same place) and the problem is that in OpenJDK11 they moved around some of the .so files that the JVM lives in, specifically which in the Ubuntu package is now in /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server/.

This means that even if you install the Ubuntu package for rJava with apt install r-cran-rjava it fails when you try to library(rJava).

The solution is to add /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server/ to your $LD_LIBRARY_PATH by adding:

export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server:$LD_LIBRARY_PATH

to the end of your ~/.bashrc and starting a new shell (or source ~/.bashrc).

This is something we had to fix for our central installs of OpenJDK e.g. here:

If you want to make this work with Rstudio launched from Gnome, you need to add that directory to ldconfig.

As root (or with sudo) create a file in /etc/ which you should call something with a .conf extension e.g. java.conf which contains the line:


And then as root run

ldconfig -v

This should add the directory to the locations that executables launched through GNOME search for. This particular part of the problem (GNOME ignoring settings in bashrc) has been a problem in Ubuntu since at least 9.04 (


I would like to install the Java JDK on Ubuntu Desktop 16.04 that will never have access to the internet, but can have a file transferred from another computer with internet access. I looked at multiple guides, but none of them worked for me fully. What would be the steps to install the Java JDK offline?


I downloaded the oracle jdk from another computer, put it on a thumb drive and transferred it over to my offline system. Then I ran these commands:

  sudo mkdir /usr/local/java
  sudo tar xvzf jdk-8u121-linux-x64.tar.gz
  sudo mv jdk1.8.0_121 /usr/local/java/
  sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_121/bin/javac" 1
  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_121/bin/java" 1
  sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_121/bin/javaws" 1
  sudo chmod a+x /usr/bin/java
  sudo chmod a+x /usr/bin/javac
  sudo chmod a+x /usr/bin/javaws
  sudo chown -R root:root /usr/local/java/jdk1.8.0_121
  sudo update-alternatives --config java

I am open to suggestions if it isn't the best way to go about this, but this worked. My solution referenced this video. However, I had to make some changes, mainly going a folder deeper than bin in the update alternatives step, and the addition of the chmod, chown steps.


sudo apt-get install groovy provides me with:

groovy -v

Groovy Version: 1.8.6 JVM: 1.8.0_150

However, this version of Groovy is very old. How do I get the newest one installed?


You can use SDKMAN to install it:

curl -s "" | bash
source "$HOME/.sdkman/bin/"

And then run the install command for Groovy:

sdk install groovy

You will find further information on the SDKMAN website.


I use ubuntu 18.04, when I launch

sudo apt install openjdk-9-jdk 

I get the following message

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openjdk-9-jdk

how do I install it correctly?




Tested with Ubuntu 18.04 docker image:

It did not have a package openjdk-9-jdk it only provides openjdk-8-jdk and openjdk-11-jdk. The 9 version is superseded by the 11 version (see So it is recommended to use the openjdk-11-jdk if possible.

Check with:

sudo apt-cache search openjdk

If you really need the 9er version get it manually via


I'm trying to install SBT on a fresh Ubuntu 16.04 machine on AWS. I've never had a problem installing (following instructions) before, but I am now.

I get this error... "The java installation you have is not up to date requires at least version 1.6+, you have version 1.8"

Seems confusing, since 1.8 seems to satisfy the 1.6+ requirement.


scala -

sbt -

sudo apt-get update 

java -version
# The program 'java' can be found in the following packages:
#  * default-jre
#  * gcj-5-jre-headless
#  * openjdk-8-jre-headless
#  * gcj-4.8-jre-headless
#  * gcj-4.9-jre-headless
#  * openjdk-9-jre-headless
# Try: sudo apt install <selected package>

sudo apt-get install openjdk-8-jdk -y

java -version
# openjdk version "1.8.0_151"
# OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
# OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp:// --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

# /usr/share/sbt/bin/sbt-launch-lib.bash: line 207: bc: command not found

# The java installation you have is not up to date
# requires at least version 1.6+, you have
# version 1.8

# Please go to and download
# a valid Java Runtime and install before running .


Looking at the source of the setup, it is using bc to do the arithmetic check on the java version number and is unable to run bc.

You can install bc with apt install bc.


I installed Emscripten through the steps shown below:

1.) Download the emsdk-portable version for Linux/MacOSX
$ ./emsdk update
$ ./emsdk install latest
$ ./emsdk activate latest
$ source (To update your environment variables)

I believe everything installed correctly, however I am unable to run emscripten anywhere outside of the emsdk folder.

I need to be able to run em++ in my: Documents/project3/dataviz/graphiti folder.

Also, when I run em++ -v in my emsdk folder, I get the following message I have been unable to resolve:

Java does not seem to exist, requierd for closure compiler,
which is optional (define JAVA in /home/bryce/.emscripten if you want it) 

I attempted to define the java path in the folder, but I'm not sure how it should look.

Any help resolving these two issues would be very much appreciated.


The first problem sounds like the PATH isn't being set correctly. Type echo $PATH after running source and check that the path to your emscripten installation has been added.

Note that you have to export the PATH for each terminal session you're using (it might be an idea to put source <path to emsdk dir>/ in your .bashrc file so this gets done automatically).

Could this link help with the second problem?


How to setup a Java development environment for the Z3 SMT solver?

Note: Written and answered by the author, see Can I answer my own question?.


  • Z3 is a C++ application with Java bindings. Start by downloading the native distribution, Ubuntu in our case (similar approach should work for macOS), from , for example:

  • Unzip the build to a Z3_DIR . To simplify things, have the following exports:

 export Z3_DIR=<some_path>/z3-4.8.7-x64-ubuntu-16.04
  • Download the Java example that matches your Z3 version, compile and run it:
$ curl >
$ javac -cp $Z3_DIR/bin/
$ java -cp $Z3_DIR/bin/ JavaExample

If all is well, you should see the example executing without errors.

  • To use the Z3 jar with Maven, install it into the local maven repository:
$ mvn install:install-file \
   -Dfile=$Z3_DIR/bin/ \ \
   -DartifactId=z3 \
   -Dversion=4.8.7 \
   -Dpackaging=jar \

A jar named z3-4.8.7.jar will be created in <mavenrepo>/repository/com/microsoft/z3/4.8.7/. It can be added to a maven project as dependency:

  • It is nice to have the Z3 API Java sources handy, these are available on Github: . Note that the folder structure doesn't match the package name so you may want to copy the files to com/microsoft/z3 before registering them with an IDE.

EDIT - macOS Unfortunately setting library path (DYLD_LIBRARY_PATH) on macOS doesn't work, for some details and a solution see here:


I've recently tried to install GeoServer with Tomcat7 on a Lubuntu 14.04 server, and had a lot of problems doing so, because Tomcat7's Java default version was set to 1.7. I've struggled a lot with this last night and I'd like to document how to fix it.

I installed GeoServer in my Lubuntu 14.04 machine following these steps:

1) Install Java 8, as documented here

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

After that, running java -versionreturned:

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

2) Install Tomcat 7

sudo apt-get install tomcat7 tomcat7-admin

3) Install GeoServer's "Web Archive" version

cd ~/Downloads
unzip geoserver.war
sudo mv geoserver.war /var/lib/tomcat7/webapps/
sudo service tomcat7 restart

After that, I could not access localhost:8080/geoserver. Trying to do so returned the HTTP Status 404 - /geoserver error, with "The requested resource is not available." as a description.

Trying to deploy the .war file through Tomcat's /manager page also did not work, returning the following error: Application at context path /geoserver could not be started.

I've looked in the error logs to see what was going wrong, and found the following exception:

Apr 29, 2017 12:32:49 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.geoserver.platform.GeoServerHttpSessionListenerProxy
java.lang.UnsupportedClassVersionError: org/geoserver/platform/GeoServerHttpSessionListenerProxy : Unsupported major.minor version 52.0 (unable to load class org.geoserver.platform.GeoServerHttpSessionListenerProxy)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(
        at org.apache.catalina.loader.WebappClassLoader.findClass(
        at org.apache.catalina.loader.WebappClassLoader.loadClass(

Despite what the error message says, echoing $JAVA_HOME returned /usr/lib/jvm/java-8-oracle, so I was sure I had the necessary Java version.


Apparently Tomcat 7 ships with 1.7 JVM as the default. This can be checked on Tomcat Web Application Manager (usually at localhost:8080/manager), at the bottom of the page there is a table with the JVM version.

|        Tomcat Version         |  JVM Version  | [...] |
| Apache Tomcat/7.0.52 (Ubuntu) | 1.7.0_121-b00 | [...] |

Since GeoServer requires Java 1.8, this explains the UnsupportedClassVersionError. We must explicitly tell Tomcat to use JVM 1.8. This was documented here and the steps are the following:

First of all we need to find where JVM 1.8 is located. Open a console terminal and enter:

$ echo $JAVA_HOME

The path to Java 8's folder should be echoed back to you. In my case it's /usr/lib/jvm/java-8-oracle. Make sure to copy it.

Then we have to edit Tomcat's configurations and tell it to use this JVM. On the console terminal, type in:

$ sudo nano /etc/default/tomcat7

The configuration file for Tomcat 7 should be opened. Locate the following text in it:

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.

Find the line that starts with JAVA_HOME, and change the path to your Java 8 folder. Make sure to uncomment the line by removing the # before JAVA_HOME. In my case, the file ended up like this:

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.

After that we need to restart Tomcat with the following command:

$ sudo service tomcat7 restart

Then if we check localhost:8080/manager, in the bottom of the page there should be something like:

|        Tomcat Version         |  JVM Version  | [...] |
| Apache Tomcat/7.0.52 (Ubuntu) | 1.8.0_131-b11 | [...] |

And GeoServer should now be successfully started, and it should be accessible through localhost:8080/geoserver.


I am having problems installing sbt on ubuntu 16.10. I have Open JDK 1.9 installed. I followed the instructions from here for Unix :

I added to my ~/.bashrc file the following:


When I run sbt from command line I get a not recognized command error. If I put the JAR file and the sbt script in /bin/ and run I get this error:

Getting org.scala-sbt sbt 0.13.8 ...
    at javax.crypto.JceSecurityManager.<clinit>(java.base@9-Ubuntu/

at javax.crypto.Cipher.getConfiguredPermission(java.base@9-Ubuntu/
at javax.crypto.Cipher.getMaxAllowedKeyLength(java.base@9-Ubuntu/
at java.lang.Class.forName0(java.base@9-Ubuntu/Native Method)
at java.lang.Class.forName(java.base@9-Ubuntu/
at org.apache.ivy.util.url.BasicURLHandler.getURLInfo$57a0216e(
at org.apache.ivy.util.url.BasicURLHandler.getURLInfo(
at org.apache.ivy.plugins.repository.url.URLResource.init(
at org.apache.ivy.plugins.repository.url.URLResource.exists(
at org.apache.ivy.plugins.resolver.RepositoryResolver.findResourceUsingPattern(
at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findResourceUsingPatterns(
at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findIvyFileRef(
at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(
at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(
at org.apache.ivy.core.resolve.IvyNode.loadData(
at org.apache.ivy.core.resolve.VisitNode.loadData(
at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(
at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(
at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(
at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(
at org.apache.ivy.core.resolve.ResolveEngine.resolve(
at xsbt.boot.Update.xsbt$boot$Update$$lockedApply(Update.scala:106)
at xsbt.boot.Update$$anon$
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at xsbt.boot.Update.apply(Update.scala:101)
at xsbt.boot.Launch.update(Launch.scala:352)
at xsbt.boot.Launch.xsbt$boot$Launch$$retrieve$1(Launch.scala:208)
at xsbt.boot.Launch$$anonfun$3.apply(Launch.scala:216)
at scala.Option.getOrElse(Option.scala:120)
at xsbt.boot.Launch.xsbt$boot$Launch$$getAppProvider0(Launch.scala:216)
at xsbt.boot.Launch$$anon$
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at xsbt.boot.Launch.locked(Launch.scala:238)
at xsbt.boot.Launch$.run(Launch.scala:102)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
    at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/
    ... 78 more
    Caused by: java.lang.NullPointerException
        at sun.nio.fs.UnixPath.normalizeAndCheck(java.base@9-Ubuntu/
        at sun.nio.fs.UnixPath.<init>(java.base@9-Ubuntu/
        at sun.nio.fs.UnixFileSystem.getPath(java.base@9-Ubuntu/
        at java.nio.file.Paths.get(java.base@9-Ubuntu/
        at javax.crypto.JceSecurity.setupJurisdictionPolicies(java.base@9-Ubuntu/
        at javax.crypto.JceSecurity.access$000(java.base@9-Ubuntu/
        at javax.crypto.JceSecurity$
        at javax.crypto.JceSecurity$
        at Method)
        at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/
        ... 78 more
    Error during sbt execution: java.lang.ExceptionInInitializerError


SBT as far as I know, to date 28.12.2016 it is not compatible with java9, had the same problem and what worked for me was first to uninstall openjdk-9 as follows

sudo apt-get autoremove openjdk-9-jre-headless

sudo apt-get remove default-jdk

sudo apt-get purge openjdk-9-jre-headless gcj-4.9-jre-headless

and then since I had java 8 already installed

> ~$ java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.10.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

I have followed the procedure from the sbt page and everything worked as expected


I'm running Ubuntu 15.10.

So, I just uploaded the Android Studio from the site. After that I unpacked the zip file. Went to android-studio/bin and found Sit permission to be executed chmod +x Ran the file to install with this line: ./ Then I had the error

No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.

I have already netbeans installed. I just ran the instalation package file JDK + Netbeans, so it was supposed to have java environments variables sit.

If I run pintenv the PATH environment variable do not hold the path to java. This is what I have:


So, how can I find the location where Java was installed? I could set the PATH variable manually.

Any idea how to solve this issue?


I had very simmilar problem, I had all JAVA_HOME and other things done but I forget to set below lines in terminal:

update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_45/bin/java 100 update-alternatives --config java


I have installed TomCat 8 on an Ubuntu 15.04 system and I have to use NetBeans

Now the problem is when I try to add my TomCat 8 installation into NetBeans (into Window --> Services --> Servers --> Add Server). After that, when I select my TomCat directory it gives me the following error message:

The CATALINA_HOME /conf/server.xml can't be read.

Why? What does it mean? How can I fix this issue?


Your CATALINA_HOME may not be correct.Please Correct your CATALINA_HOME using export command.


Iv'e installed a fresh copy of Ubuntu 18.04 on my system. Now i would install the openjdk 8 package. The follwoing came out.

# apt install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openjdk-8-jdk

When I search in the apt cache the following is shown:

apt-cache search openjdk
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless - Standard Java or Java compatible Development Kit (headless)
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
openjdk-11-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-source - OpenJDK Development Kit (JDK) source files

Has someone an idea what's wrong or missing?


Oke, I've found out by myself by reading the repository documentation.

You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:

deb bionic-security main universe


I am trying to run a java application, but its saying javac not found. When I did install java by using the following command:

sudo apt install openjdk-11-jre-headless

It's in my path as I can run java command fine. I'm not sure why it isn't seeing the javac command. What am I missing after installing openjdk-11 java ?


You have installed the Java Runtime Environment (JRE): openjdk-11-jre which allows you to run java software.

And should install the Java Developer Kit (JDK) in order to compile code:

sudo apt install openjdk-11-jdk


Answer: site is closed now and web-upd8 repository cannot get JDK sources from there. I suggest you to download JDK 9 from Oracle site and install it manually according to installation instructions


I already have installed in my linux Ubuntu the java 8 (Update 121), but I need to install the java 7 RE for a specific software that I need to use. I want the java 7 only to use with this tool, and I do not want to make any modification on my default java 8. How to do that? Can I install java 7 with no issue for my 8?

update-alternatives --config java
   There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
    Nothing to configure.


You do not need to install Java 7. You can download java 7 zip package and unzip it to a location. Create an environment variable/ Sdk Config in your tool pointing to the java 7. I am not sure which tool you are referring to !

Eg : In intellij you can create a new sdk and point it to your java 7 jdk location and use it. In eclipse you can create a Java 7 sdk environment from java build path and use it.


I was installing Spark on my Ubuntu 14.04 and it seemed to be going smoothly for quite a while then bombed with I have previously installed and checked Scala... and see details of Java at bottom..

    at java.util.concurrent.ThreadPoolExecutor$
[error] (streaming-flume-sink/compile:compile) Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2,    No such file or directory
[error] (unsafe/compile:compile) Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2, No such file or directory
[error] (network-common/compile:compile) Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2, No such file or directory
[error] (launcher/compile:compile) Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2, No such file or directory
[error] Total time: 737 s, completed Nov 9, 2015 4:37:48 PM

I have Java installed:

tom@tom-sam:~$ java -version
java version "1.7.0_85"
OpenJDK Runtime Environment (IcedTea 2.6.1) (7u85-2.6.1-5ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)

Any ideas??


I have Java installed:

tom@tom-sam:~$ java -version
java version "1.7.0_85"
OpenJDK Runtime Environment (IcedTea 2.6.1) (7u85-2.6.1-5ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)

You have the java runtime installed (the JRE). You need the JDK (Java Developer Kit). You can install the Oracle JDK, or the OpenJDK. For the OpenJDK, it should be as simple as

$ sudo apt-get install default-jdk

For the Oracle JDK, it's only a little more involved,

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update

Then one of

$ sudo apt-get install oracle-java6-installer


$ sudo apt-get install oracle-java7-installer


$ sudo apt-get install oracle-java8-installer

For Java 6, 7 or 8 respectively.



I am trying to install Hadoop 2.6.0 on my Ubuntu 14 machine. I am coming across an error though.

When I am trying to set the HOME variable for Java it does not seem to be doing as expected.

I am on my machine as hduser setup specifically for running and using Hadoop. This user is a sudoer.

Some information:

java -version' gives the following

java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

This is the only version installed on my machine, which can be seen by running the following command:

update-alternatives --display java

Which gives the following message:

java - auto mode
link currently points to /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java - priority 1071
slave java.1.gz: /usr/lib/jvm/java-7-openjdk-amd64/jre/man/man1/java.1.gz
Current 'best' version is '/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java'.

I then go to the following path:

cd /usr/lib/jvm

and the I list out the contents ls

default-java  java-1.7.0-openjdk-amd64  java-7-openjdk-amd64

I then type cd java* and pwd which brings up the following path:


Ok, so with that information, I then copy that directory into the .bashrc file as follows:

# The java implementation to use.
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

The file I fill out as follows:

#Hadoop variables
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

I then at the terminal type source ~/.bashrc and then restart the terminal in order for it to set to the new Java path. When typing Hadoop -version I get the following output:

/usr/bin/hadoop: line 350: /usr/lib/jvm/java-6-sun/bin/java: No such file or directory
/usr/bin/hadoop: line 434: /usr/lib/jvm/java-6-sun/bin/java: No such file or directory

I do not know where to go from here.

Thank you,


Add JAVA_HOME to point to your openjdk in Add this line in

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

NOTE: Change JAVA_HOME path in .bashrc too


Run these commands in terminal. (This will set java & javac in /bin to use your jdk)

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java 1

sudo update-alternatives --config java

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/javac" 1

sudo update-alternatives --config javac

NOTE: If you dont have java and javac in the specified path, it will be inside /jre folder. Change it respectively.


I had java8 and maven3 installed on my Ubuntu 64bits. I added java7 (but didn't remove java8) and configured my system as explained in this tutorial. (I edited the path of java7 in /etc/profile and I used "update-alternatives" command to inform Ubuntu where my Java JRE is located and that it is my default JRE).

Java7 install was fine and I get:


But after this, maven doesn't work anymore:

mvn -version
The program 'mvn' can be found in the following packages:
 * maven
 * maven2
Try: sudo apt-get install <selected package>

Does someone know how to solve this? Because I am sure that I still have maven.


I think you should check following points

Is this maven 3?

I installed maven with apt-get install maven

Was maven 2 installed before?

un maven2 <none> <none> (no description available)

Is maven 3 available in the Ubuntu repository?

sudo apt-get purge maven3
Unable to locate package maven3

Seems you have installed maven 3 not from the repository


To get it working add the location of mvn to your PATH (put this in your user profile script)

export PATH=/usr/local/apache-maven/apache-maven-3.3.1/bin/:${PATH}
mvn -version


I need to install a 32bit version of Oracle Java on my Ubuntu Sever 14.04 x64

I tried it following the this answer for jre 1.7 and this for jdk 1.8. In both cases I were not able verify the installation success by typing java -version

The result is always -bash: /usr/bin/java: No such file or directory Thx in advance for any help.

ls -l /usr/bin/java results in lrwxrwxrwx 1 root root 22 Sep 30 14:02 /usr/bin/java -> /etc/alternatives/java


/etc/alternatives/java -> /usr/lib/jvm/jdk1.8.0_20/bin/java

furthermore: ldd /usr/lib/jvm/jdk1.8.0_20/bin/java produces not a dynamic executable

sudo updatedb; locate java:



Assuming that /usr/bin/java really points to the java executable, this may be caused by missing shared libraries. On my system, /usr/bin/java finally points to /usr/lib/jvm/java-7-oracle/jre/bin/java

Try ldd /usr/lib/jvm/java-7-oracle/jre/bin/java. The result should look similar to this (this is 64bit): =>  (0x00007fff7a7d7000) => /lib/x86_64-linux-gnu/ (0x00007fa477851000) => /usr/lib/jvm/java-7-oracle/jre/bin/../lib/amd64/jli/ (0x00007fa47763a000) => /lib/x86_64-linux-gnu/ (0x00007fa477435000) => /lib/x86_64-linux-gnu/ (0x00007fa47706f000)
/lib64/ (0x00007fa477a97000)

If there is a library missing, install it.


Hie, I am confused where I am messed up.

I have downloaded JDK and JRE rpm files from the Oracle download page. I am using a 64-bit Linux machine ubuntu 18.04 os.

here the file I have downloaded

I used alien to convert into .deb files and then I have used dpkg to install deb.

I have installed JRE 1.8 . and I have installed maven via command line. but after install, I found this surprisingly


If you know the paths where Oracle packages with Java were installed, you can use update-alternatives to choose which Java you want to use. For example, in my case:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_51/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_51/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_51/bin/javaws" 1

and in the end:

sudo update-alternatives --config java

and choose the the number of your Oracle Java installation.


I had developed a Java Application Project using Netbeans IDE 8.2 on Ubuntu14. How can I have its installers for Linux Systems using Netbeans IDE(.deb) Native Packaging.

I had packaged it by following instruction in this link

But, this tutorial above mentioned is NetBeans 7.4 native packaging in Windows. But I followed this tutorial in Netbeans8.2 in Ubuntu(my system). And I got .deb file in specified folder in the tutorial mentioned above.

The Project-name-1.0.deb file could be successfully installed in my Ubuntu System, but while running this installed application it shows error: "java.sql.SQLException: Opening db:'DB-NAME.sqlite' : Permission denied"

My project uses sqlite DB for data storage. I had used JAR sqlite-JDBC-3.19.3.jar for its Library.

I had used Netbeans IDE 8.2 in Ubuntu and created the new Java Application Project in it.

Now, how can I package this Java Application project to get its installer for Linux(.deb) without this Permission denied error

The java class is as follows

import java.sql.*;

import javax.swing.JOptionPane;

public class Connect {

    Connection con = null;
    Statement stmt = null;

    public static Statement ConnectDB() {
        try {
            Connection conn = null;
            Statement stmt = null;

            conn = DriverManager.getConnection("jdbc:sqlite:JavaApp3DB.sqlite");

            stmt = conn.createStatement();

            return stmt;
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        return null;

The application execute successfully in NetBeans without any permission denied error. But, it shows the error when the Packaged (.deb) installer when installed and executed in Ubuntu.


Change this jdbc:sqlite:JavaApp3DB.sqlite to this jdbc:sqlite:JavaApp3DB.db

When you want to connect to your database you need an address and this address mention to a file we call database.db not .sqlite.


Where is the recommended place to install the jdk .tar.gz file I just downloaded? I want it to be available for all users.

The installation guides that I have found told me to extract the jdk in many different places, such as /opt, /usr/lib and /usr/local. But the which one is the "right" choice? Why?


Into /usr/lib/jvm/ folder, the reason is because the default installation path is that one when you use the sudo apt install command, which makes total sense to me.

Example: OpenJDK 11 is located at : /usr/lib/jvm/java-11-openjdk-amd64/bin/java OpenJDK 8 is located at : /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

For more information, you can read this article here.


I've downloaded java jdk1.8.0.7.tar.gz file from the official website and unzipped it into my home directory. Now to set the $JAVA_HOME variable I used the follwing commands command nano .bashrc and then appending export $JAVA_HOME=/home/shivam/Java/jdk1.8.0.7 at the end of the file . But whenever I run the command sudo $CATALINA_HOME/bin/ I get an error message saying

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

I don't understand why it is unable to find the java path though I've installed tomcat and set its home variable the this way, which worked. I wan't to install Java manually without using apt-get. Kindly guide .


You want to append the following to .bashrc:


Note the missing $ at the start.

Also remember that the file won't effect your current shell without sourceing it first.

Also, when running a command with sudo, you are running it as the root user, not as yourself. So the environment variable needs to be set for the root user, not yourself.

You can run sudo env | grep JAVA_HOME to see whether it is set for root.


I have a Ubuntu host on which i have installed OpenJDK 10 and Gloud SDK using APT. When i try to install 'google-cloud-sdk-datastore-emulator', i get the error shown below. I found a thread on GCP GitHub that talks about this but its closed. Here -

Anyone else having this issue?

Error -

# apt install google-cloud-sdk-datastore-emulator
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 google-cloud-sdk-datastore-emulator : Depends: openjdk-8-jdk but it is not installable
E: Unable to correct problems, you have held broken packages.

My Environment -

OS -

VERSION="18.04.2 LTS (Bionic Beaver)"

OpenJDK -

#java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
#javac -version
javac 10.0.2
#which java

Gcloud sdk -

# gcloud -v
Google Cloud SDK 234.0.0
alpha 2019.02.08
beta 2019.02.08
bq 2.0.41
core 2019.02.08
gsutil 4.36
kubectl 2019.02.08


There's some issue with our debian package dependancy config. Although if you install the emulator via gcloud command it should work:

gcloud components install cloud-datastore-emulator


Note the components manager doesn't work if sdk is insalled from other package managers. In this case you can remove it and install following the suggestion here:

If for some other reason you do have to install via apt-get, should help, basically avoid install openjdk by:

apt-get install google-cloud-sdk-datastore-emulator openjdk-8-jdk-

Note there's a "-" after the openjdk-8-jdk

Or you can follow the steps in the same thread to update package dependancy.


I have a standard version of Ubuntu 18.04 freshly installed and want to use it as a Cassandra node.

I went through the following steps to install Cassandra:

## Install java 1.8
sudo apt install openjdk-8-jre -y
## Check java version
java -version
## Create the JAVA_HOME link
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
## Create the Apache Cassandra 3.11.x apt repo:
echo "deb 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl | sudo apt-key add -
sudo apt-get update
## If GPG public key error
sudo apt-key adv --keyserver --recv-key A278B781FE4B2BDA
sudo apt-get update
## Install cassandra
sudo apt-get install cassandra
## Service status
sudo service cassandra status


cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra; generated)
Active: active (exited) since Thu 2018-08-02 23:03:47 UTC; 4h 2min ago
 Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4662)
CGroup: /system.slice/cassandra.service

The "active (exited)" part makes me think something went wrong.

I wanted to give it a re-try, and uninstall cassandra by doing:

sudo apt-get remove cassandra
sudo apt-get purge "cassandra-*"
sudo rm -rf /var/lib/cassandra
sudo rm -rf /var/log/cassandra
sudo rm -rf /etc/cassandra
sudo apt-get update

went through the same installing steps, and now /etc/cassandra contains only /triggers/, all configuration files are missing.

My guess is that I haven't completely cleant up something


In my limited debian/ubuntu experience, purging a package does nothing for removing dependencies. So people make the mistake that if they purge a package, then their system is returned to the state that it was in before the package was installed, which isn't true because all off the dependencies and their config files are still in the system.

So when removing a package, remove the dependencies too. I would do something like this:

sudo apt-get remove package_name
sudo apt-get purge package_name
sudo apt-get --purge autoremove
sudo apt-get clean

As far as your original problem, I would ask if it logged any errors in /var/log/cassandra/system.log but it looks like you deleted the logs.

Did java -version output what you expected?

Also make sure you have python and python-support installed

After doing a google search, you could check this out Cassandra status changing from active(running) to active(exited) without any errors


I am brand new to WSO2 API manager and I am trying to install the API Manager for the first time on a Linux VM machine.

Java-8 has been installed. JAVA_HOME is defined and points to /usr/lib/jvm/java-8-oracle. It has been verified by running: echo $JAVA_HOME and it looks correct. JAVA_HOME and path are both defined in /etc/environment file.

On the WSO2 side I downloaded it and I am trying to run the executable.

I keep getting this error

ERROR: JAVA_HOME is not defined correctly

CARBON cannot execute java


Make sure you run all the commands in the same terminal window.

Or you can run source command for the modified file before you start APIM.

Or after setting JAVA_HOME, you can start a new terminal window to run APIM.


I installed Netbeans 11.2 on Ubuntu 18.04 via snap.

Now i want to configure Netbeans, modifying netbeans.conf. This file is placed at /snap/netbeans/current/netbeans/etc/ and is mounted as read-only file system. So i assume you should not edit this file here.

How do i configure Netbeans if the classic way (editing netbeans.conf) is blocked?

Note: I want to set netbeans_jdkhome="~/.sdkman/candidates/java/latest/".


This works:

netbeans --jdkhome ~/.sdkman/candidates/java/latest


You CAN have user local versions of the netbeans configuration. Just copy the global netbeans.conf from the global snap location to your Netbeans user directory and make your changes there.

Example for version 11.3 of Netbeans:

mkdir ~/snap/netbeans/common/data/11.3/etc
cp /snap/netbeans/current/netbeans/etc/netbeans.conf ~/snap/netbeans/common/data/11.3/etc/netbeans.conf
gedit ~/snap/netbeans/common/data/11.3/etc/netbeans.conf

NOTE: You will need to repeat this process whenever the user directory changes as a result of a version update. Ie. from 11.3 -> 12, etc.


There is an error like java runtime environment version 11 is not capable of running eclipse.

But I do not understand required jre version is 8 or upper.

Should I have to downgrade JRE version?

Here is error details when I run da@n53sm:~$ tail -f omnetpp-5.4.1/samples/.metadata/.log command.

2019-01-09 log tracing

!SESSION 2019-01-09 17:09:25.101 -----------------------------------------------
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2019-01-09 17:09:27.757
!MESSAGE Application error
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(
    at org.eclipse.ui.internal.Workbench.lambda$3(
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.base/java.lang.reflect.Method.invoke(
    at org.eclipse.equinox.launcher.Main.invokeFramework(
    at org.eclipse.equinox.launcher.Main.basicRun(
    at org.eclipse.equinox.launcher.Main.main(
Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
    at org.eclipse.e4.core.internal.di.InjectorImpl.inject(
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(
    ... 23 more
Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(
    at java.base/java.lang.ClassLoader.loadClass(
    ... 25 more

!ENTRY org.eclipse.e4.ui.workbench 4 0 2019-01-09 17:09:27.769
!MESSAGE FrameworkEvent ERROR
java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
    at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(
    at org.eclipse.e4.core.internal.di.Requestor.disposed(
    at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(
    at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(
    at org.eclipse.osgi.container.Module.publishEvent(
    at org.eclipse.osgi.container.Module.doStop(
    at org.eclipse.osgi.container.Module.stop(
    at org.eclipse.osgi.container.SystemModule.stop(
    at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$
    at java.base/
Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(
    at java.base/java.lang.ClassLoader.loadClass(
    ... 21 more

My java version is:

da@n53sm:~$ java --version 
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-2ubuntu1, mixed mode, sharing)

I've looked some pages. The solution is downgrading the JRE to version 8.x.


Here is an answer from OMNET++ mailing list.

Adding configuration to your config.ini solves the problem asked.

Here is the link for the topic of mailing list:

I know it's super ugly, but OMNeT++ 5.4.1 is based on Eclipse 4.7.3 and The java 11 broke the compatibility with Eclipse 4.7 which in turn causes the issue with OMNeT++ 5.4.1.

A very quick workaround would be to downgrade your java package to 1.8, though I'm not sure that is definitely possible.

An other workaround is to paste the following in the ide/configuration/config.ini (obviously we may need to release omnet 5.4.2 to fix this with an updated eclipse) Hope it helps

org.osgi.framework.system.packages = \

Rudolf Hornig


In Ubuntu I want to change my selection of java to be in auto mode, so I do

sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      manual mode

Press enter to keep the current choice[*], or type selection number: 2

But it seems that I can only change the Selection. How can I also change the Status of my selection (jdk8) to be in auto mode?


Have a look to the man page, it says that the priority is set during - - install of a symlink to a valid group of jre/jdk. The auto mode is used to automatically set the current active (symlink) to the installed group having the highest priority

For instance if you install a new jdk like this :

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0.05/bin/java 1

The last parameter is the priority. The command creates a link called user/ bin/ java pointing the usr/lib/jvm/jdk1.8.0.05/bin/java binary file and set the priority to one You can create all the links this way for all the java binaries... But inside a package the initscript is executed during installation and creates all the links for you. Have a look to this other post


I'm trying to install a java extension as a jar file. When I have just Oracle Java version 8 installed, I can run the jar-file.

However, when I download Eclipse, it includes openjkd7 and somehow this messes up my Java installation. When I include the jar file and try to run, I get:

Exception in thread "main" java.lang.UnsupportedClassVersionError:<path>    Unsupported major.minor version 52.0

What is going on? Is Eclipse using a different version of Java? How can this be resolved?


I think you need to do the following things :

a.) Set the JAVA_HOME, probably should be the 1.8 version. Quit all instances of Eclipse. b.) Re-open Eclipse. Then, In Eclipse, configure the Eclipse project Build Path to the SHOULD be the default JRE/JDK in Eclipse now, but it's hard to say since your installed Eclipse with a bundled JRE/JDK.

Right-click on the Eclipse project. Build Path > Configure Build Path > Libraries (Tab) > Choose the JDK you want.

You can also configure Alternate versions of JRE/JDK from the screen...


I installed Hadoop 2.7.0 single node cluster on Ubuntu 15.04 following commands from here and nearly all went fine until the command formatting hdfs.

When I enter

$ hdfs namenode -format

I get error: Could not find or load main class Djava.librarary.path=.usr.local.hadoop.lib

In bashrc I have

#hadoop variables
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/lib/amd64
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

In I have

export JAVA_HOME="/usr/lib/jvm/java-8-oracle"

What do I do to get rid of the error?

I'm assuming something's wrong with the java path but I can't figure what... Can anybody help?...

Thanks in advance.


Set the following variables alone in bashrc. Remove all other variables that you have set and then try

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export HADOOP_HOME=/usr/local/hadoop

Let me know if still you have any problem.


I was used to program on Windows in NetBeans. I was forced to use Ubuntu instead of Windows. I have created file in NetBeans on Windows. Now, I would like to import this file into NetBeans on Ubuntu.

Could you kindly advice me how to import zipped project into NetBeans on Ubuntu system?


You should be able to unzip your project into your netbeans folder on Ubuntu and then open the project from within netbeans.


I'm trying to install the java native library from the command line as

sudo apt-get install libjna-java

but Ubuntu tells me

 E: Unable to locate package libjna-java

and even if I do cache search, there is nothing there matching that package.

How do I install Java JNA in Ubuntu server 14?


libjna-java is in universe repository and it seems that you dont have it enabled. To enable, run

sudo add-apt-repository universe


Trying to install Java Opengl and keep getting this error

Exception in thread "main" java.lang.InstantiationError: com.jogamp.common.util.locks.RecursiveLock
at Simple.<init>(
at Simple.main(

what does this mean and what can I do to fix it ?

I'm using Ubuntu 64 bit 14.04 with intel i5processor IDE:Eclipse ;


Please uninstall any JOGL package and follow the official instructions available here and the instructions for the IDEs here.

I have used JOGL under GNU Linux since 2006 without any trouble. Good luck.


Package oracle-java7-installer is not available, but is referred to by another package. This may mean that the package is missing,that has been obsoleted, or is only available from another source


oracle-java7-installeris no longer available from their ppa:webupd8team/java repository, and that would make sense now that Java 8 is out. Try installing Java 8 and see if the problem still persists.


When I install OpenJDK I get a message on console:

seekting@seekting-2016:~$ sudo apt-get install openjdk-7-jre

Reading package lists... Done
Building dependency tree       
Reading state information... Done

Package openjdk-7-jre is a virtual package provided by:

oracle-java9-installer 9b140+9b140arm-1~webupd8~3
oracle-java8-installer 8u111+8u111arm-1~webupd8~0
oracle-java7-installer 7u80+7u60arm-0~webupd8~1

You should explicitly select one to install.

What can I do to successfully install the OpenJDK?


Ma de, da bu liao zhongwen

I think it was you input has some error, copy the name from apt-cache search and post it on you command, don't use the Chinese input method, switch to English input method, you can add me in 2672406516 at qq, and...speak Chinese....


My machine is Ubuntu 14.04.4 LTS (trusty).

I had multiple Java installed on my Ubuntu machine so I decided to delete all of them according to this answer and install only Java JDK 6 (which is what I need to compile Android 4.3) using the command:

sudo apt-get install oracle-java6-installer

but I'm getting the following error message:

oracle-java6-installer is already the newest version.

My question:

Does anyone know how to solve this problem?


It looks like not everything was dispatched utterly, but that's quite alright - the command you'll want is:

sudo apt-get install --reinstall oracle-java6-installer

This will forcibly reinstall the package, without trying to remove it by any other means.


I install Rundeck following this.I install it by .jar ,.deb or .war but it all failed.I have installed java8.


Install rundeck by launcher This document is more detailed.After install it,you should modify something. Use your server ip replace localhost or you may go to http://ubuntu:4440/menu/home after login admin.

  • $RDECK_HOME/etc/ framework.server.url
  • $RDECK_HOME/etc/ framework.server.url
  • $RDECK_HOME/server/config/


I need to install the apk file. I follow the instructions - "adb install" and the name of the file you want to install. I get a message that there is no such file ...

What am doing wrong?


Have you enabled USB debugging on your Android Device?

If not:

  • Go to settings
  • Go to about phone
  • Find build number
  • Repeatedly tap the build number, until it says you are now a developer or something along those lines
  • Back to main settings page
  • Find developer options
  • Allow USB debugging

A link to help

Also check out | How To Geek - ADB

Hope I Helped!


I am newbie to OpenCV. What I found (after spending considerable time) on searching how to install OpenCV on Ubuntu 14.04 is that there are two ways to do so.

  1. sudo apt-get install libopencv-dev
  2. Install OpenCV manually. i.e. download source code and build it.

Please suggest, when one should use what ?

PS: I will be using OpenCV in Java project.


I have install opencv in my Ubuntu 14.04 via apt-get and using it from last 2 months. sudo apt-get install libopencv-dev installs version 2.4 which is sufficient for me till now. So I am happy with this way.


I am an enthusiast programmer trying to make a simple program that implements a 3rd party API used for translation of language, such as Google Translate.

I have searched for a long time, but what I have read has gone over my head, for I am still a novice in programming and computer use. I would love clear-cut instructions on how I can get a download of the API, install(?) it, and use its code in my code, if that is possible. This is what I want, but if it does not work that way, let me know!

I do not use an IDE for development, and I run Ubuntu 15.04.


Please pardon my lengthy answer, hope it may help you achieve what you are trying to do.

There is a Java port of Google Translate available here.

The example program given there looks simple, i have added few modifications to it:


public class JTranslator {
  public static void main(String[] args) throws Exception {
    // Set the HTTP referrer to your website address.

    // Set the Google Translate API key
    // See:

    String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);


But in order to execute the above simple program, we need Google Translate API key. It requires us to create a project in Google Developers and create a key against that project. It's a lengthy process, so instead of uploading all the steps(in images) here, the images have been uploaded here.

Once we have the API Key, next comes the execution part. We need to download the jar file to use.

Let's assume we have java & the downloaded jar file in the same folder, following are the steps to compile and execute the program:


javac -cp google-api-translate-java-0.97.jar;.


java -cp google-api-translate-java-0.97.jar;. JTranslator

But while executing we will hit the following error:

Error: [google-api-translate-java] Error retrieving translation.
Exception in thread "main" java.lang.Exception: [google-api-translate-java] Error retrieving transla
        at JTranslator.main(
Caused by: java.lang.Exception: [google-api-translate-java] Error retrieving translation.
        ... 1 more
Caused by: Server returned HTTP response code: 403 for URL:"hSifeHtllArOfSknahTgNoLo-SyXaLago-TeDIuGsReki-HhctIH&q=Bonjour+le+monde&target=en&source=fr
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at$ Source)
        at$ Source)
        at Method)
        at Source)
        at Source)
        at Source)
        at Source)
        ... 2 more

The simplified version of this error can be retrieved if we copy paste the URL tried by the program into browser:

 "error": {
  "errors": [
    "domain": "usageLimits",
    "reason": "dailyLimitExceeded",
    "message": "Daily Limit Exceeded"
  "code": 403,
  "message": "Daily Limit Exceeded"

Based on this SOF question, it is clear that we need to pay for the usage of Translate API. There is also an option Sign up for a free trial. in Google Developers Console. Google Translate pricing.

Good luck.

Update: Came across a Translator API from Microsoft, which allows translation of upto 2Million Characters/month for free.


Because the Ubuntu upgrade to 18.04 destroyed my working Eclipse configuration, I reinstalled Eclipse (Photon Release 4.8.0) and tried to use again R with the StatET 3.6 plugin. As suggested here, I attempted to install the package rj-2.1 in an R term console via

install.packages(c("rj", ""), repos="")

and this started to install rj and

Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)

but ends with an error message:

Warning message:
In install.packages(c("rj", ""), repos = "") :
  installation of package ‘rj’ had non-zero exit status

A closer look into the console output reveals this error message:

checking Java support in R... configure: error: cannot determine complete java config
    JAVA_HOME: /usr/lib/jvm/default-java
    JAVA     : /usr/lib/jvm/default-java/bin/java
    JAVAC    : /usr/lib/jvm/default-java/bin/javac
    JAVAH    : 
    JAVA_CPPFLAGS: -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
    JAVA_LIBS: -L/usr/lib/jvm/default-java/lib/server -ljvm
    JAR      : /usr/lib/jvm/default-java/bin/jar
R is not configured with full Java support. Please make sure
an JDK is installed and run
    R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
    R CMD javareconf -e
to set all Java-related variables and then install the package.
ERROR: configuration failed for package ‘rj’
* removing ‘/usr/local/lib/R/site-library/rj’
* restoring previous ‘/usr/local/lib/R/site-library/rj’

When I run the suggested command

sudo R CMD javareconf

in a terminal, the output suggests that it works as expected

Java interpreter : /usr/lib/jvm/default-java/bin/java
Java version     : 10.0.2
Java home path   : /usr/lib/jvm/default-java
Java compiler    : /usr/lib/jvm/default-java/bin/javac
Java headers gen.: 
Java archive tool: /usr/lib/jvm/default-java/bin/jar

trying to compile and link a JNI program 
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.o -L/usr/lib/jvm/default-java/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/default-java
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib/R

Nonetheless, the installation of rj-2.1 still produces afterwards the same error message. I had a look at /usr/local/lib/R/site-library and is updated, but rj is still the previous version. And starting the R console produces the error message

java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product


Launching the R Console was cancelled, because it seems starting the R engine failed.
Please make sure that R package 'rj' (2.1 or compatible) is installed and that the R library paths are set correctly for the R environment configuration 

Any idea, how to get rj installed?

P.S.: Seems to be a Java version problem. Ubuntu 18.04 has this version preinstalled:

openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)

Update: Without knowingly having changed anything, the installation of rj and from an Rterm console worked now. The files in /usr/local/lib/R/site-library are indeed updated and the Rterm console does not have any error messages. Nonetheless, when creating and running an RJ console, the same error message appears

Launching the R Console was cancelled, because it seems starting the R engine failed. 
Please make sure that R package 'rj' (2.1 or compatible) is installed and that the R library paths are set correctly for the R environment configuration 'Rstatet36'.

I also defined again Preferences>Statet>R environment and Run Configurations to no effect.

Update: If you downvote a question, it would be favourable to add a comment, why you did this, so the question can be improved. Or deleted. Oh, well.


It was indeed the wrong Java Environment. The installation does not take long, if you know, what to do, but was rather tedious to find out:

1) Install openjdk 8 on Ubuntu 18.04 with sudo apt install openjdk-8-jdk. I thought that simply changing the default Java version with sudo update-alternatives --config java might help but this was not the case. So don't do this.

2) Go to Eclipse>Preferences>Java>Installed JREs: There choose ADD and specify the folder, in this case /usr/lib/jvm/java-8-opdenjdk-amd64. Click OK.

3) Go to Run>Run Configurations and double click on R console to open a new run configuration. Choose RJ (default)

4) Go to the tab JRE and choose Java 8 from Alternate JRE

5) Give your new configuration a nice name, click Apply and Run and your RJ console starts. At least it did in my environment.


I am trying to install latest version of java 8 on ubuntu. I tried below

sudo apt-get install default-jre
sudo apt-get install default-jdk

I got message

  Package default-jre is a virtual package provided by:
  oracle-java9-installer 9b181-1~webupd8~2
  oracle-java8-installer 8u144-1~webupd8~0
  oracle-java6-installer 6u45-0~webupd8~8
  oracle-java7-installer 7u80+7u60arm-0~webupd8~1

Then I run command

sudo apt-get install oracle-java8-installer

got error as

HTTP request sent, awaiting response... 302 Moved Temporarily Location: [following] --2018-01-12 11:43:32-- Connecting to (||:80... connected. HTTP request sent, awaiting response... 404 Not Found 2018-01-12 11:43:33 ERROR 404: Not Found.

download failed Oracle JDK 8 is NOT installed. dpkg: error processing package oracle-java8-installer (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: oracle-java8-installer E: Sub-process /usr/bin/dpkg returned an error code (1)


Anyone facing same issue I solved it by following below link Link


I have downloaded tar.gz file and unzipped it. I don't have admin access, so I added PATH variable: export PATH=$PATH:/home/shashank/jdk1.8.0_144/bin in .bashrc and reloaded by source ~/.bashrc. But when I do "java -version". I cant see any update.


The problem is that 64bit machine is not supporting 32 bit Java Compiler. It got fixed when x64 version jdk is installed.


I am new to Amazon Web Services. I have created one ec2 instance and want to install Java on that. I have downloaded rpm file but not able to execute it. below is the list of folder/files under root.

root@ip-172-31-6-12:~# ls  jdk1.8_1.8.0171-1_amd64.deb  node_modules  node-v8.11.3.tar.gz
jdk-10.0.1  jdk-8u171-linux-x64.rpm      node-v8.11.3  survey

and when I am running

dpkg -i jdk1.8_1.8.0171-1_amd64.deb

I am getting this message.

dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

please let me know, what I am missing here.


I would try to install java from the distribution packages. Like apt-get install java-openjdk. The other problem seems to be that you've downloaded an rpm and you are trying to install on debian. RPM's are for RHEL/CentOS like distributions.



All command line.

"The easiest solution I have found so far is using a great tool called Oraji 
which automatically does the configuration for you. Here is the brief 
excerpt from the install instruction created by the Oraji developer:

Download latest official 32-Bit Oracle JDK. File name should be jdk-... - 
linux-i586.tar.gz from 

Install Oraji on Ubuntu:

sudo add-apt-repository -y ppa:neurobin/ppa
sudo apt-get update
sudo apt-get install oraji
Java Installation Instruction:

Run in terminal:

sudo oraji '/path/to/the/jdk_or_jre_archive'
or run

sudo /path/to/oraji /path/to/the/jdk_or_jre_archive
after giving the oraji script execution permission if you didn't install the 

That's it. Now if you want to populate JAVA_HOME and other environment 
variables run source /etc/profile or logout and login.

For more info like Uninstall, Changing JDK version, just follow this nice 
tutorial by Oraji developers

Have a great day, guys!"--Chiggiddi (Ubuntu Ask)