Hot questions for Using Ubuntu in install

Question:


Answer:

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

Question:

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.


Answer:

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: 
    

    and

    $ 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)
    

    and

    $ javac --version
    javac 10
    
  • Done


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

Question:

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?


Answer:

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]                                                                 
Encoding=UTF-8
Name=IntelliJ IDEA
Comment=IntelliJ IDEA
Exec=/opt/ideaIC-14.1.2/bin/idea.sh
Icon=/opt/ideaIC-14.1.2/bin/idea.png
Terminal=false
StartupNotify=true
Type=Application

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.

#!/bin/sh

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
#done
ed=C

# Fetch the most recent version
VERSION=$(wget "https://www.jetbrains.com/intellij-repository/releases" -qO- | grep -P -o -m 1 "(?<=https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/BUILD/)[^/]+(?=/)")

# Prepend base URL for download
URL="https://download.jetbrains.com/idea/ideaI$ed-$VERSION.tar.gz"

echo $URL

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

# Set download directory
DEST=~/Downloads/$FILE

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
DIR="/opt/idea-I$ed-$VERSION"

echo "Installing to $DIR"

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

# Grab executable folder
BIN="$DIR/bin"

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

# Set desktop shortcut path
DESK=/usr/share/applications/IDEA.desktop

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

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

echo "Done."  

Old Version

#!/bin/sh                                                                                                                                   

echo "Installing IntelliJ IDEA..."

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

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

# Fetch the most recent community edition URL
URL=$(wget "https://www.jetbrains.com/idea/download/download_thanks.jsp?edition=I${ed}&os=linux" -qO- | grep -o -m 1 "https://download.jetbrains.com/idea/.*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
DIR="${FILE%\.tar\.gz}"

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

# Grab executable folder
BIN="/opt/$DIR/bin"

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

# Set desktop shortcut path
DESK=/usr/share/applications/IDEA.desktop

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

echo "Done."    

Question:

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.


Answer:

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)

Question:

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 download.oracle.com (download.oracle.com)|23.215.130.99|: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.


Answer:

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=https://download.oracle.com/otn/java/jdk/8u212-b10/59066701cf1a433da9770636fbc4c9aa/|PARTNER_URL=https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/|' 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: http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz.

For the purposes of this tutorial, we only need the link's path: http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/. 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:

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

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=http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/|' 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).

Question:

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 studio.sh 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.country=US, -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.country=US, -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.country=US -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.country=US -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, /127.0.0.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.country=US,-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.

Answer:

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

Question:

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--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 64.78.224.186, 64.78.224.185
Connecting to download.oracle.com (download.oracle.com)|64.78.224.186|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz [following]
--2017-10-17 16:42:10--  https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.217.152.181, 2600:141b:13:28c::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.217.152.181|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1508276650_49e5615c0aa8584dd72b809fbec787eb [following]
--2017-10-17 16:42:10--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1508276650_49e5615c0aa8584dd72b809fbec787eb
Connecting to download.oracle.com (download.oracle.com)|64.78.224.186|: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


Answer:

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.

Question:

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


Answer:

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.

Question:

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

/usr/lib/jvm/java-11-openjdk-amd64

my etc/environment looks like this

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/$
MKL_THREADING_LAYER=GNU
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

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.so 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
Done.

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

EDIT:

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/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory

Answer:

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 libjvm.so 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: https://github.com/UCL-RITS/rcps-buildscripts/blob/master/adoptopenjdk-11.0.3_install.sh#L46

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/ld.so.conf.d/ which you should call something with a .conf extension e.g. java.conf which contains the line:

/usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/server

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 (https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/366728/).

Question:

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?


Answer:

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.

Question:

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?


Answer:

You can use SDKMAN to install it:

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

And then run the install command for Groovy:

sdk install groovy

You will find further information on the SDKMAN website.

Question:

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?

Thanks

Sergio


Answer:

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 http://jdk.java.net/9/). 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 http://jdk.java.net/archive/.

Question:

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.

references

scala - https://www.scala-lang.org/documentation/getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html

sbt - http://www.scala-sbt.org/1.0/docs/Installing-sbt-on-Linux.html

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 https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

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 http://www.java.com/getjava/ and download
# a valid Java Runtime and install before running .

Answer:

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.

https://github.com/sbt/sbt-launcher-package/blob/master/src/universal/bin/sbt-launch-lib.bash#L207

You can install bc with apt install bc.

Question:

I installed Emscripten through the steps shown below:

1.) Download the emsdk-portable version for Linux/MacOSX
http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html#sdk-downloads
2.)
Run
$ ./emsdk update
$ ./emsdk install latest
$ ./emsdk activate latest
$ source emsdk_env.sh (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.


Answer:

The first problem sounds like the PATH isn't being set correctly. Type echo $PATH after running source emdsk_env.sh 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>/emsdk_env.sh in your .bashrc file so this gets done automatically).

Could this link help with the second problem?

https://kripken.github.io/emscripten-site/docs/building_from_source/verify_emscripten_environment.html#installing-missing-components

Question:

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?.


Answer:

  • 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 https://github.com/Z3Prover/z3/releases , for example: z3-4.8.7-x64-ubuntu-16.04.zip.

  • 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
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$Z3_DIR/bin
  • Download the Java example that matches your Z3 version, compile and run it:
$ curl https://raw.githubusercontent.com/Z3Prover/z3/z3-4.8.7/examples/java/JavaExample.java > JavaExample.java
$ javac -cp $Z3_DIR/bin/com.microsoft.z3.jar JavaExample.java
$ java -cp $Z3_DIR/bin/com.microsoft.z3.jar:. 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/com.microsoft.z3.jar \
   -DgroupId=com.microsoft \
   -DartifactId=z3 \
   -Dversion=4.8.7 \
   -Dpackaging=jar \
   -DgeneratePom=true

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:

     <dependency>
         <groupId>com.microsoft</groupId>
         <artifactId>z3</artifactId>
         <version>4.8.7</version>
     </dependency>
  • It is nice to have the Z3 API Java sources handy, these are available on Github: https://github.com/Z3Prover/z3/tree/z3-4.8.7/src/api/java . 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: https://github.com/Z3Prover/z3/issues/294

Question:

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
wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.11.0/geoserver-2.11.0-war.zip
unzip geoserver-2.11.0-war.zip 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(WebappClassLoader.java:2970)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1209)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1689)
        [...]

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.


Answer:

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.
#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk

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.
JAVA_HOME=/usr/lib/jvm/java-8-oracle

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.

Question:

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 :

http://www.scala-sbt.org/release/docs/Manual-Installation.html

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

JAVA_HOME="/usr/lib/jvm/java-1.9.0-openjdk-amd64" 
SBT_HOME="$HOME/sbt-launcher-packaging-0.13.13" 
PATH="$SBT_HOME/bin/sbt":$PATH

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 ...
java.lang.ExceptionInInitializerError
    at javax.crypto.JceSecurityManager.<clinit>(java.base@9-Ubuntu/JceSecurityManager.java:65)

at javax.crypto.Cipher.getConfiguredPermission(java.base@9-Ubuntu/Cipher.java:2595)
at javax.crypto.Cipher.getMaxAllowedKeyLength(java.base@9-Ubuntu/Cipher.java:2619)
at sun.security.ssl.CipherSuite$BulkCipher.isUnlimited(java.base@9-Ubuntu/CipherSuite.java:602)
at sun.security.ssl.CipherSuite$BulkCipher.<init>(java.base@9-Ubuntu/CipherSuite.java:574)
at sun.security.ssl.CipherSuite$BulkCipher.<clinit>(java.base@9-Ubuntu/CipherSuite.java:460)
at sun.security.ssl.CipherSuite.<clinit>(java.base@9-Ubuntu/CipherSuite.java:1074)
at sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuiteList(java.base@9-Ubuntu/SSLContextImpl.java:353)
at sun.security.ssl.SSLContextImpl.access$100(java.base@9-Ubuntu/SSLContextImpl.java:41)
at sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit>(java.base@9-Ubuntu/SSLContextImpl.java:582)
at java.lang.Class.forName0(java.base@9-Ubuntu/Native Method)
at java.lang.Class.forName(java.base@9-Ubuntu/Class.java:291)
at java.security.Provider$Service.getImplClass(java.base@9-Ubuntu/Provider.java:1844)
at java.security.Provider$Service.newInstance(java.base@9-Ubuntu/Provider.java:1820)
at sun.security.jca.GetInstance.getInstance(java.base@9-Ubuntu/GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(java.base@9-Ubuntu/GetInstance.java:164)
at javax.net.ssl.SSLContext.getInstance(java.base@9-Ubuntu/SSLContext.java:166)
at javax.net.ssl.SSLContext.getDefault(java.base@9-Ubuntu/SSLContext.java:98)
at javax.net.ssl.SSLSocketFactory.getDefault(java.base@9-Ubuntu/SSLSocketFactory.java:123)
at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(java.base@9-Ubuntu/HttpsURLConnection.java:332)
at javax.net.ssl.HttpsURLConnection.<init>(java.base@9-Ubuntu/HttpsURLConnection.java:289)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(java.base@9-Ubuntu/HttpsURLConnectionImpl.java:85)
at sun.net.www.protocol.https.Handler.openConnection(java.base@9-Ubuntu/Handler.java:62)
at sun.net.www.protocol.https.Handler.openConnection(java.base@9-Ubuntu/Handler.java:57)
at java.net.URL.openConnection(java.base@9-Ubuntu/URL.java:1049)
at org.apache.ivy.util.url.BasicURLHandler.getURLInfo$57a0216e(BasicURLHandler.java:66)
at org.apache.ivy.util.url.BasicURLHandler.getURLInfo(BasicURLHandler.java:54)
at org.apache.ivy.plugins.repository.url.URLResource.init(URLResource.java:65)
at org.apache.ivy.plugins.repository.url.URLResource.exists(URLResource.java:81)
at org.apache.ivy.plugins.resolver.RepositoryResolver.findResourceUsingPattern(RepositoryResolver.java:97)
at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findResourceUsingPatterns(AbstractPatternsBasedResolver.java:96)
at org.apache.ivy.plugins.resolver.AbstractPatternsBasedResolver.findIvyFileRef(AbstractPatternsBasedResolver.java:66)
at org.apache.ivy.plugins.resolver.BasicResolver.getDependency(BasicResolver.java:228)
at org.apache.ivy.plugins.resolver.ChainResolver.getDependency(ChainResolver.java:104)
at org.apache.ivy.core.resolve.IvyNode.loadData(IvyNode.java:169)
at org.apache.ivy.core.resolve.VisitNode.loadData(VisitNode.java:292)
at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:714)
at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:799)
at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:722)
at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:594)
at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:234)
at xsbt.boot.Update.xsbt$boot$Update$$lockedApply(Update.scala:106)
at xsbt.boot.Update$$anon$4.call(Update.scala:100)
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$2.call(Launch.scala:196)
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.app(Launch.scala:147)
at xsbt.boot.Launch.app(Launch.scala:145)
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/JceSecurity.java:91)
    ... 78 more
    Caused by: java.lang.NullPointerException
        at sun.nio.fs.UnixPath.normalizeAndCheck(java.base@9-Ubuntu/UnixPath.java:75)
        at sun.nio.fs.UnixPath.<init>(java.base@9-Ubuntu/UnixPath.java:69)
        at sun.nio.fs.UnixFileSystem.getPath(java.base@9-Ubuntu/UnixFileSystem.java:280)
        at java.nio.file.Paths.get(java.base@9-Ubuntu/Paths.java:84)
        at javax.crypto.JceSecurity.setupJurisdictionPolicies(java.base@9-Ubuntu/JceSecurity.java:254)
        at javax.crypto.JceSecurity.access$000(java.base@9-Ubuntu/JceSecurity.java:49)
        at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:82)
        at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:79)
        at java.security.AccessController.doPrivileged(java.base@9-Ubuntu/Native Method)
        at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/JceSecurity.java:78)
        ... 78 more
    Error during sbt execution: java.lang.ExceptionInInitializerError

Answer:

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

Question:

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 studio.sh. Sit permission to be executed chmod +x studio.sh. Ran the file to install with this line: ./studio.sh. 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:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 

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?


Answer:

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

Question:

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?


Answer:

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

Question:

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?


Answer:

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 http://security.ubuntu.com/ubuntu bionic-security main universe

Question:

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 ?


Answer:

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

Question:


Answer:

java.net 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

Question:

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.

Answer:

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.

Question:

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$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[error] (streaming-flume-sink/compile:compile) java.io.IOException: Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2,    No such file or directory
[error] (unsafe/compile:compile) java.io.IOException: Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2, No such file or directory
[error] (network-common/compile:compile) java.io.IOException: Cannot run program "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac": error=2, No such file or directory
[error] (launcher/compile:compile) java.io.IOException: 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??


Answer:

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

or

$ sudo apt-get install oracle-java7-installer

or

$ sudo apt-get install oracle-java8-installer

For Java 6, 7 or 8 respectively.

Question:

EDIT

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:

/usr/lib/jvm/java-1.7.0-openjdk-amd64

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 hadoop-env.sh 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,


Answer:

Add JAVA_HOME to point to your openjdk in hadoop-env.sh. Add this line in hadoop-env.sh:

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

NOTE: Change JAVA_HOME path in .bashrc too

UPDATE I:

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.

Question:

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:

echo $JAVA_HOME
/usr/local/java/jdk1.7.0_75

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.


Answer:

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

/usr/local/apache-maven/apache-maven-3.3.1 

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

Question:

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

and...

/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:

/etc/alternatives/java
/etc/alternatives/javac
/etc/alternatives/javaws
/etc/apparmor.d/abstractions/ubuntu-browsers.d/java
/usr/bin/java
/usr/bin/javac
/usr/bin/javaws
/usr/lib/jvm/jdk1.8.0_20/javafx-src.zip
/usr/lib/jvm/jdk1.8.0_20/bin/java
/usr/lib/jvm/jdk1.8.0_20/bin/java-rmi.cgi
/usr/lib/jvm/jdk1.8.0_20/bin/javac
/usr/lib/jvm/jdk1.8.0_20/bin/javadoc
/usr/lib/jvm/jdk1.8.0_20/bin/javafxpackager
/usr/lib/jvm/jdk1.8.0_20/bin/javah
/usr/lib/jvm/jdk1.8.0_20/bin/javap
/usr/lib/jvm/jdk1.8.0_20/bin/javapackager
/usr/lib/jvm/jdk1.8.0_20/bin/javaws
/usr/lib/jvm/jdk1.8.0_20/jre/bin/java
/usr/lib/jvm/jdk1.8.0_20/jre/bin/javaws
/usr/lib/jvm/jdk1.8.0_20/jre/lib/javafx.properties
/usr/lib/jvm/jdk1.8.0_20/jre/lib/javaws.jar
/usr/lib/jvm/jdk1.8.0_20/jre/lib/deploy/java-icon.ico
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/applications/sun-java.desktop
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/applications/sun-javaws.desktop
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/applications/sun_java.desktop
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/16x16/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/16x16/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/48x48/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/48x48/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/16x16/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/16x16/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/48x48/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/48x48/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/16x16/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/16x16/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/16x16/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/16x16/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/48x48/apps/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/48x48/apps/sun-javaws.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-application-x-java-archive.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-text-x-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/mime/packages/x-java-archive.xml
/usr/lib/jvm/jdk1.8.0_20/jre/lib/desktop/mime/packages/x-java-jnlp-file.xml
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjava.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjava_crw_demo.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjavafx_font.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjavafx_font_freetype.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjavafx_font_pango.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjavafx_font_t2k.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/i386/libjavafx_iio.so
/usr/lib/jvm/jdk1.8.0_20/jre/lib/images/icons/sun-java.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/images/icons/sun-java_HighContrast.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/images/icons/sun-java_HighContrastInverse.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/images/icons/sun-java_LowContrast.png
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/de/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/es/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/fr/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/it/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/ja/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/ko/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/ko.UTF-8/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/pt_BR/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/sv/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/zh/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/zh.GBK/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/zh_HK.BIG5HK/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/zh_TW/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/locale/zh_TW.BIG5/LC_MESSAGES/sunw_java_plugin.mo
/usr/lib/jvm/jdk1.8.0_20/jre/lib/security/java.policy
/usr/lib/jvm/jdk1.8.0_20/jre/lib/security/java.security
/usr/lib/jvm/jdk1.8.0_20/jre/lib/security/javaws.policy
/usr/lib/jvm/jdk1.8.0_20/jre/plugin/desktop/sun_java.desktop
/usr/lib/jvm/jdk1.8.0_20/jre/plugin/desktop/sun_java.png
/usr/lib/jvm/jdk1.8.0_20/lib/ant-javafx.jar
/usr/lib/jvm/jdk1.8.0_20/lib/javafx-mx.jar
/usr/lib/jvm/jdk1.8.0_20/lib/missioncontrol/plugins/javax.el_2.2.0.v201108011116.jar
/usr/lib/jvm/jdk1.8.0_20/lib/missioncontrol/plugins/javax.servlet.jsp_2.2.0.v201112011158.jar
/usr/lib/jvm/jdk1.8.0_20/lib/missioncontrol/plugins/javax.servlet_3.0.0.v201112011016.jar
/usr/lib/jvm/jdk1.8.0_20/lib/visualvm/platform/config/Modules/org-netbeans-modules-javahelp.xml
/usr/lib/jvm/jdk1.8.0_20/lib/visualvm/platform/modules/org-netbeans-modules-javahelp.jar
/usr/lib/jvm/jdk1.8.0_20/lib/visualvm/platform/modules/locale/org-netbeans-modules-javahelp_ja.jar
/usr/lib/jvm/jdk1.8.0_20/lib/visualvm/platform/modules/locale/org-netbeans-modules-javahelp_zh_CN.jar
/usr/lib/jvm/jdk1.8.0_20/lib/visualvm/platform/update_tracking/org-netbeans-modules-javahelp.xml
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/java.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javac.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javadoc.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javafxpackager.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javah.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javap.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javapackager.1
/usr/lib/jvm/jdk1.8.0_20/man/ja_JP.UTF-8/man1/javaws.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/java.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javac.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javadoc.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javafxpackager.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javah.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javap.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javapackager.1
/usr/lib/jvm/jdk1.8.0_20/man/man1/javaws.1
/usr/lib/python2.7/dist-packages/serial/serialjava.py
/usr/lib/python2.7/dist-packages/serial/serialjava.pyc
/usr/share/java
/usr/share/apport/java_uncaught_exception
/usr/share/apport/testsuite/test_java_crashes.py
/usr/share/apport/testsuite/test_java_crashes.pyc
/usr/share/bash-completion/completions/java
/usr/share/bash-completion/completions/javac
/usr/share/bash-completion/completions/javadoc
/usr/share/bash-completion/completions/javaws
/usr/share/java/libintl.jar
/usr/share/mime/application/javascript.xml
/usr/share/mime/application/x-java-archive.xml
/usr/share/mime/application/x-java-jce-keystore.xml
/usr/share/mime/application/x-java-jnlp-file.xml
/usr/share/mime/application/x-java-keystore.xml
/usr/share/mime/application/x-java-pack200.xml
/usr/share/mime/application/x-java.xml
/usr/share/mime/text/x-java.xml
/usr/share/mime/video/x-javafx.xml
/usr/share/nano/java.nanorc
/usr/share/vim/vim74/autoload/javascriptcomplete.vim
/usr/share/vim/vim74/compiler/javac.vim
/usr/share/vim/vim74/ftplugin/java.vim
/usr/share/vim/vim74/ftplugin/javascript.vim
/usr/share/vim/vim74/indent/java.vim
/usr/share/vim/vim74/indent/javascript.vim
/usr/share/vim/vim74/syntax/java.vim
/usr/share/vim/vim74/syntax/javacc.vim
/usr/share/vim/vim74/syntax/javascript.vim
/var/lib/dpkg/alternatives/java
/var/lib/dpkg/alternatives/javac
/var/lib/dpkg/alternatives/javaws

Answer:

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):

linux-vdso.so.1 =>  (0x00007fff7a7d7000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa477851000)
libjli.so => /usr/lib/jvm/java-7-oracle/jre/bin/../lib/amd64/jli/libjli.so (0x00007fa47763a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa477435000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa47706f000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa477a97000)

If there is a library missing, install it.

Question:

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


Answer:

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.

Question:

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 Connect.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;

            Class.forName("org.sqlite.JDBC");
            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.


Answer:

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.

Question:

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?


Answer:

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.

Question:

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/startup.sh 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 .


Answer:

You want to append the following to .bashrc:

JAVA_HOME=/home/shivam/Java/jdk1.8.0.7

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.

Question:

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 - https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/144

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 -

DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
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
/usr/bin/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

Answer:

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

(https://cloud.google.com/sdk/gcloud/reference/components/install)

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: stackoverflow.com/questions/42697026

If for some other reason you do have to install via apt-get, https://serverfault.com/questions/250224 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.

Question:

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
echo $JAVA_HOME
##
## Create the Apache Cassandra 3.11.x apt repo:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
##
## If GPG public key error
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
sudo apt-get update
##
## Install cassandra
sudo apt-get install cassandra
##
## Service status
sudo service cassandra status

Output:

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


Answer:

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

Question:

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 wso2server.sh executable.

I keep getting this error

ERROR: JAVA_HOME is not defined correctly

CARBON cannot execute java


Answer:

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.

Question:

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/".

UPDATE

This works:

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

Answer:

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.

Question:

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 -----------------------------------------------
eclipse.buildId=5.4.1.180629-5e28390
java.version=11.0.1
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
!STACK 1
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
    at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
    ... 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(BundleLoader.java:433)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 25 more

!ENTRY org.eclipse.e4.ui.workbench 4 0 2019-01-09 17:09:27.769
!MESSAGE FrameworkEvent ERROR
!STACK 0
java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
    at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
    at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
    at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
    at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
    at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
    at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
    at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
    at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
    at org.eclipse.osgi.container.Module.doStop(Module.java:634)
    at org.eclipse.osgi.container.Module.stop(Module.java:498)
    at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
    at java.base/java.lang.Thread.run(Thread.java:834)
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(BundleLoader.java:433)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 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.


Answer:

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: https://groups.google.com/d/topic/omnetpp/t13qEhyyuqI/discussion

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 = \
 javax.accessibility,\
 javax.activation,\
 javax.activity,\
 javax.crypto,\
 javax.crypto.interfaces,\
 javax.crypto.spec,\
 javax.imageio,\
 javax.imageio.event,\
 javax.imageio.metadata,\
 javax.imageio.plugins.bmp,\
 javax.imageio.plugins.jpeg,\
 javax.imageio.spi,\
 javax.imageio.stream,\
 javax.jws,\
 javax.jws.soap,\
 javax.lang.model,\
 javax.lang.model.element,\
 javax.lang.model.type,\
 javax.lang.model.util,\
 javax.management,\
 javax.management.loading,\
 javax.management.modelmbean,\
 javax.management.monitor,\
 javax.management.openmbean,\
 javax.management.relation,\
 javax.management.remote,\
 javax.management.remote.rmi,\
 javax.management.timer,\
 javax.naming,\
 javax.naming.directory,\
 javax.naming.event,\
 javax.naming.ldap,\
 javax.naming.spi,\
 javax.net,\
 javax.net.ssl,\
 javax.print,\
 javax.print.attribute,\
 javax.print.attribute.standard,\
 javax.print.event,\
 javax.rmi,\
 javax.rmi.CORBA,\
 javax.rmi.ssl,\
 javax.script,\
 javax.security.auth,\
 javax.security.auth.callback,\
 javax.security.auth.kerberos,\
 javax.security.auth.login,\
 javax.security.auth.spi,\
 javax.security.auth.x500,\
 javax.security.cert,\
 javax.security.sasl,\
 javax.sound.midi,\
 javax.sound.midi.spi,\
 javax.sound.sampled,\
 javax.sound.sampled.spi,\
 javax.sql,\
 javax.sql.rowset,\
 javax.sql.rowset.serial,\
 javax.sql.rowset.spi,\
 javax.swing,\
 javax.swing.border,\
 javax.swing.colorchooser,\
 javax.swing.event,\
 javax.swing.filechooser,\
 javax.swing.plaf,\
 javax.swing.plaf.basic,\
 javax.swing.plaf.metal,\
 javax.swing.plaf.multi,\
 javax.swing.plaf.nimbus,\
 javax.swing.plaf.synth,\
 javax.swing.table,\
 javax.swing.text,\
 javax.swing.text.html,\
 javax.swing.text.html.parser,\
 javax.swing.text.rtf,\
 javax.swing.tree,\
 javax.swing.undo,\
 javax.tools,\
 javax.xml,\
 javax.xml.bind,\
 javax.xml.bind.annotation,\
 javax.xml.bind.annotation.adapters,\
 javax.xml.bind.attachment,\
 javax.xml.bind.helpers,\
 javax.xml.bind.util,\
 javax.xml.crypto,\
 javax.xml.crypto.dom,\
 javax.xml.crypto.dsig,\
 javax.xml.crypto.dsig.dom,\
 javax.xml.crypto.dsig.keyinfo,\
 javax.xml.crypto.dsig.spec,\
 javax.xml.datatype,\
 javax.xml.namespace,\
 javax.xml.parsers,\
 javax.xml.soap,\
 javax.xml.stream,\
 javax.xml.stream.events,\
 javax.xml.stream.util,\
 javax.xml.transform,\
 javax.xml.transform.dom,\
 javax.xml.transform.sax,\
 javax.xml.transform.stax,\
 javax.xml.transform.stream,\
 javax.xml.validation,\
 javax.xml.ws,\
 javax.xml.ws.handler,\
 javax.xml.ws.handler.soap,\
 javax.xml.ws.http,\
 javax.xml.ws.soap,\
 javax.xml.ws.spi,\
 javax.xml.ws.spi.http,\
 javax.xml.ws.wsaddressing,\
 javax.xml.xpath,\
 org.ietf.jgss,\
 org.omg.CORBA,\
 org.omg.CORBA_2_3,\
 org.omg.CORBA_2_3.portable,\
 org.omg.CORBA.DynAnyPackage,\
 org.omg.CORBA.ORBPackage,\
 org.omg.CORBA.portable,\
 org.omg.CORBA.TypeCodePackage,\
 org.omg.CosNaming,\
 org.omg.CosNaming.NamingContextExtPackage,\
 org.omg.CosNaming.NamingContextPackage,\
 org.omg.Dynamic,\
 org.omg.DynamicAny,\
 org.omg.DynamicAny.DynAnyFactoryPackage,\
 org.omg.DynamicAny.DynAnyPackage,\
 org.omg.IOP,\
 org.omg.IOP.CodecFactoryPackage,\
 org.omg.IOP.CodecPackage,\
 org.omg.Messaging,\
 org.omg.PortableInterceptor,\
 org.omg.PortableInterceptor.ORBInitInfoPackage,\
 org.omg.PortableServer,\
 org.omg.PortableServer.CurrentPackage,\
 org.omg.PortableServer.POAManagerPackage,\
 org.omg.PortableServer.POAPackage,\
 org.omg.PortableServer.portable,\
 org.omg.PortableServer.ServantLocatorPackage,\
 org.omg.SendingContext,\
 org.omg.stub.java.rmi,\
 org.w3c.dom,\
 org.w3c.dom.bootstrap,\
 org.w3c.dom.css,\
 org.w3c.dom.events,\
 org.w3c.dom.html,\
 org.w3c.dom.ls,\
 org.w3c.dom.ranges,\
 org.w3c.dom.stylesheets,\
 org.w3c.dom.traversal,\
 org.w3c.dom.views,\
 org.w3c.dom.xpath,\
 org.xml.sax,\
 org.xml.sax.ext,\
 org.xml.sax.helpers

Rudolf Hornig

Question:

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?


Answer:

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

Question:

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?


Answer:

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 1.8...it 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...

Question:

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 PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

In hadoop-env.sh 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.


Answer:

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
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin

Let me know if still you have any problem.

Question:

I was used to program on Windows in NetBeans. I was forced to use Ubuntu instead of Windows. I have created project.zip 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?


Answer:

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

Question:

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?


Answer:

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

sudo add-apt-repository universe

Question:

Trying to install Java Opengl and keep getting this error

Exception in thread "main" java.lang.InstantiationError: com.jogamp.common.util.locks.RecursiveLock
at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:491)
at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:178)
at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:169)
at Simple.<init>(Simple.java:43)
at Simple.main(Simple.java:20)

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 ;


Answer:

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.

Question:

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


Answer:

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.

Question:

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?


Answer:

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....

Question:

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?


Answer:

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.

Question:

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


Answer:

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.properties framework.server.url
  • $RDECK_HOME/etc/preferences.properties framework.server.url
  • $RDECK_HOME/server/config/rundeck-config.properties rundeck-config.properties

Question:

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?


Answer:

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!

Question:

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.


Answer:

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.

Question:

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.


Answer:

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:

import com.google.api.translate.Language;
import com.google.api.translate.Translate;
import com.google.api.GoogleAPI;

public class JTranslator {
  public static void main(String[] args) throws Exception {
    // Set the HTTP referrer to your website address.
    GoogleAPI.setHttpReferrer("http://duckduckgo.com");

    // Set the Google Translate API key
    // See: http://code.google.com/apis/language/translate/v2/getting_started.html
    GoogleAPI.setKey("hSifeHtllArOfSknahTgNoLo-SyXaLago-TeDIuGsReki-HhctIH");

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

    System.out.println(translatedText);
  }
}

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:

Compile:

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

Execute:

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" com.google.api.GoogleAPIException: java.lang.Exception: [google-api-translate-java] Error retrieving transla
tion.
        at com.google.api.translate.TranslateV2.execute(TranslateV2.java:68)
        at JTranslator.main(JTranslator.java:14)
Caused by: java.lang.Exception: [google-api-translate-java] Error retrieving translation.
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:99)
        at com.google.api.translate.TranslateV2.execute(TranslateV2.java:62)
        ... 1 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.googleapis.com/language/translate/v2?key="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 sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
        at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:93)
        ... 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.

Question:

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", "rj.gd"), repos="http://download.walware.de/rj-2.1")

and this started to install rj and rj.gd

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", "rj.gd"), repos = "http://download.walware.de/rj-2.1") :
  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.so 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
Done.

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 rj.gd is updated, but rj is still the previous version. And starting the R console produces the error message

eclipse.buildId=4.8.0.I20180611-0500
java.version=10.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product

de.walware.statet.r.console.ui

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 rj.gd 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.


Answer:

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.

Question:

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: http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1515737732_ecd7adee8c373b9510eae0f55774956f [following] --2018-01-12 11:43:32-- http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1515737732_ecd7adee8c373b9510eae0f55774956f Connecting to download.oracle.com (download.oracle.com)|202.88.188.203|: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)


Answer:

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

Question:

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.


Answer:

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

Question:

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
install.sh  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.


Answer:

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.

Question:


Answer:

https://askubuntu.com/questions/819996/howto-install-latest-oracle-java-jdk-32-bit-to-linux-xubuntu-14-04-64-bit-ea

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 
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads- 
2133151.html

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 
script.

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 https://github.com/neurobin/oraji

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