0

I am trying to run bluej using command terminal but I get this : A suitable Jdk couldn't be located. You may need to edit the /usr/bin/bluej launch script

Please help i am new to this.

Roy
  • 81

3 Answers3

0

first remove blueJ
sudo apt remove bluej
Install openjdk-8
sudo apt-get openjdk-8-jdk
Then Install Bluej .deb file
sudo dpkg -i *.deb
It will be work

0

If you haven't installed a JDK, you have several options.

1. APT and the official repositories

You may install one via apt-get, for that, open a terminal and type:

sudo apt-get openjdk-8-jdk

I recommend this, as it will set everything for you properly and you will be able to upgrade easily.

2. APT and the WebUpd8 PPA

You can also install Oracle's JDK vida the WebUpd8 PPA as detailed here, I believe it will also take care of everything for you.

3. Download directly from Oracle

Finally, you can install Oracle's JDK, but you will need to set set your JAVA_HOME, PATH and alternatives manually.

JAVA_HOME is used by some applications to find your JDK. I'm unsure if BlueJ uses it.

PATH is used by your shell session to know where it can look for any executables.

If you have several JDK versions, lets say you have the OpenJDK from the official Ubuntu repos, plus Oracle's JDK 1.8., both in your PATH. If you call javac, The Debian alternatives system will be used to resolve which one of those javac binaries will be used.

To do this, append this lines to your ~/.bashrc:

export JAVA_HOME=/path/to/jdk
export PATH=$PATH:$JAVA_HOME/bin

Source your bashrc file ( . ~/.bashrc ). Afterwards, update your alternatives (you will only need to do so if you have more than one JDK installed).

--install
  E.g. sudo update-alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 1

--set
  E.g. sudo update-alternatives --set javac $JAVA_HOME/bin/javac

To help you identify which alternatives you may need to update you can use:

update-alternatives --get-selections | grep java

If you really need to edit the launcher, you can edit /usr/share/applications/bluej.desktop:

sudo nano /usr/share/applications/bluej.desktop

or add your own at

~/.local/share/applications/bluej.desktop

But I doubt that is the issue.

Samuel
  • 1,015
  • I have set the JAVA_HOME and my current java version is " 1.8.0_121" – Roy Feb 17 '17 at 19:18
  • If you have installed a JDK and set all the variables/alternatives correctly BlueJ should launch without problems. – Samuel Feb 22 '17 at 18:23
  • My problem has been sorted. I accidently deleted /usr/lib/jvm then I resinstalled it using sudo apt-get install oracle-java8-installer and it worked well!! Thank you everyone for your help :) – Roy Feb 23 '17 at 11:59
  • Good! You can post that as an answer and accept it. – Samuel Feb 24 '17 at 14:46
0

My problem has been sorted. I accidently deleted /usr/lib/jvm then I reinstalled it using:

sudo apt-get install oracle-java8-installer

and it worked well!! Thank you everyone for your help :)

Roy
  • 81