How to change the version of java installed in BOSS Linux? - java

I am trying to change java installed in boss Linux because am trying to install eclipse oxygen which needs java8. First I couldn't find where the jdk installed. Currently 1.7.0_73 installed. I just downloaded the tar.gz of jdk8. Extracted in a location. Setted java home and path pointing bin. But still am getting error during eclipse installation that version 1.8 is required.

Well as Wikipedia states that
BOSS Linux is an "LSB certified" Linux distribution :
the software has been certified by the Linux Foundation
for compliance with the Linux Standard Base standard.
BOSS Linux is derived from Debian Linux.
Note that It is derived from Debian Linux and uses apt to handle packages for updates or upgrades. On that note, you just have to use apt
command to upgrade to version you want.
Installing java version 1.8 by installing OpenJDK v8
To install java version 1.8 (OpenJDK v8), type following on terminal :
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
If you only want to install the Java Runtime Environment :
sudo apt-get install openjdk-8-jre
Feel free to add-in more details to the answer.

Related

Installing WSO2 on ubuntu 14.04 LTS get java_home error

Hi I want to install WSO2 API Manager on VirtualBox with Ubuntu 14.04 LTS, I install Java using sudo apt-get install jre-default but I got OpenJDK version that isn't recommended for WSO2.
So I proceeded to add oracle repository and install java 8, then I configured as default java version and used the source /etc/environment for update paths, then with echo $JAVA_HOME I got this route /usr/lib/java/java-8-oracle/jre/bin/java and when I run the wso2server.sh I got "Error: JAVA_HOME is not defined correctly. Carbon cannot execute java"
I don't know what is the problem when I installing WSO2 API Manager. Or in the route, also I check the route with Whereis java.

Change default JRE in debian Wheezy

I am installing library libapache-mime4j-java in debian Wheezy. However, this depends on the default JRE which is Java 1.6 and therefore installs Java 1.6 by default. Is there any way to change the default JRE to Java 1.7 when installing a package that depends on it using
apt-get install libapache-mime4j-java
so that after installing the library you end up with Java 1.7 instead of Java 1.6 ?
Short answer: no. The default-jre on wheezy points to openjdk-6-jre for amd64.
BUT you can also install openjdk-7-jre, and select the former using update-alternatives facility or update-java-alternatives from java-common package.

The full pathname of a JDK installation for Oracle SQL Developer

I want to run Oracle SQL Devloper on Ubuntu with this command:
sh sqldeveloper/sqldeveloper.sh
Then I got this message:
Type the full pathname of a JDK installation (or Ctrl-C to quit), the
path will be stored in /home/aimad/.sqldeveloper/4.0.0/product.conf
So I gave the path of jdk as the following:
/usr/lib/jvm/java-7-openjdk-i386/
But then I got this message:
Error: Java home /usr/lib/jvm/java-7-openjdk-i386//bin/java is not a
JDK. Running SQL Developer under a JRE is not supported.
For me it was similar error. I solved it simply by inserting
SetJavaHome /usr/lib/jvm/java-7-openjdk-amd64/
into ~/.sqldeveloper/4.0.0/product.conf file.
I Agree with szabozoltan's answer but there should be some explanation required for this:
SetJavaHome /usr/lib/jvm/java-7-openjdk-amd64/
This one we need to keep in product.conf file. Inorder to open that file we need to type following command:
sudo gedit /home/abc/.sqldeveloper/4.0.0/product.conf
After this, type the following command.
./sqldeveloper.sh
That's it, your SQL Developer
will be opened.
You only have the Java JRE installed, you need to install the JDK in order for Oracle SQL Devloper to work.
TL;DR
Install the JDK, type sudo apt-get install openjdk-7-jdk in a terminal.
Checking if JDK is Installed
To check if you have the JDK installed, type aptitude search openjdk-7-jdk in the terminal. If you see an i beside either package then it is installed. For example, I have the 64-bit JDK installed on my machine, this is the output.
$ aptitude search openjdk-7-jdk
i openjdk-7-jdk - OpenJDK Development Kit (JDK)
p openjdk-7-jdk:i386 - OpenJDK Development Kit (JDK)
If the package does not have an i beside it, then it is not installed.
Installing JDK
To install in the JDK in ubuntu you need to install the package openjdk-7-jdk. Install by running sudo apt-get install openjdk-7-jdk in a terminal.
Setting JAVA_HOME
After installing the JDK you need to set the JAVA_HOME environment variable.
You can see all the installed JDKs on your machine by running update-java-alternatives -l, choose the one you want to use and copy the third field, this field is the JAVA_HOME for that JDK.
For example, on my machine
$ update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
This means I only have one JDK installed, java-1.7.0-openjdk-amd64, and its JAVA_HOME is /usr/lib/jvm/java-1.7.0-openjdk-amd64.
Next, set the JAVA_HOME environment variable, in Bash I would set it by running this from the terminal:
$ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
Check to make sure it was set correctly.
$ echo $JAVA_HOME
/usr/lib/jvm/java-1.7.0-openjdk-amd64
This will set JAVA_HOME for your current terminal session, to not have to worry about setting it again, you can add it to your ~/.bashrc file.
Running Oracle SQL Developer
Once the JDK is installed and the JAVA_HOME environment variable set, you can move into the sql developer directory and run the sqldeveloper.sh script.
$ cd sqldeveloper
$ ./sqldeveloper.sh
If sqldeveloper.sh is not executable run chmod +x sqldeveloper.sh and run the script again.
Checking all Java packages
For completeness, you can check what Java packages you have installed by running aptitude search openjdk-7. If you have the JRE installed you will se an i beside a package that begins with openjdk-7-jre
$ aptitude search openjdk-7
p openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols)
p openjdk-7-dbg:i386 - Java runtime based on OpenJDK (debugging symbols)
p openjdk-7-demo - Java runtime based on OpenJDK (demos and examples)
p openjdk-7-demo:i386 - Java runtime based on OpenJDK (demos and examples)
p openjdk-7-doc - OpenJDK Development Kit (JDK) documentation
i openjdk-7-jdk - OpenJDK Development Kit (JDK)
p openjdk-7-jdk:i386 - OpenJDK Development Kit (JDK)
i openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
p openjdk-7-jre:i386 - OpenJDK Java runtime, using Hotspot JIT
i openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
p openjdk-7-jre-headless:i386 - OpenJDK Java runtime, using Hotspot JIT (headless)
i openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries)
v openjdk-7-jre-lib:i386 -
p openjdk-7-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
p openjdk-7-jre-zero:i386 - Alternative JVM for OpenJDK, using Zero/Shark
p openjdk-7-source - OpenJDK Development Kit (JDK) source files
p uwsgi-plugin-jvm-openjdk-7 - Java plugin for uWSGI (OpenJDK 7)
p uwsgi-plugin-jvm-openjdk-7:i386 - Java plugin for uWSGI (OpenJDK 7)
p uwsgi-plugin-jwsgi-openjdk-7 - JWSGI plugin for uWSGI (OpenJDK 7)
p uwsgi-plugin-jwsgi-openjdk-7:i386 - JWSGI plugin for uWSGI (OpenJDK 7)
Just solved this by not adding slash as you did, so instead of
/usr/lib/jvm/java-7-openjdk-i386/
type
/usr/lib/jvm/java-7-openjdk-i386
Just type /usr/java/default and hit Enter if you use Oracle's JDK.
Just insert below one into ~/.sqldeveloper/4.0.0/product.conf file.
SetJavaHome /usr/lib/jvm/java-7-openjdk-amd64/
I had a similar issue and solved it by simply adding 'SetSkipJ2SDKCheck true'
to one of the below files.
/home/abc/.sqldeveloper/4.1.5/product.conf
/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
In my case (Oracle SQL Developer 4.1.3) it seems to be problem with Java version - when I point to Java 8 JDK instead of 11, it started working immediately.
I've faced with similar issue. Tried published recommendations but unsuccessfully. Possible the reason I'm using sdkman to manage java versions, may be something with permissions because of Mac OS.
For Mac user it is important try manage configuration:
try SetJavaHome {{path to your java}} in ~/.sqldeveloper/{{sql-dev-version}}/product.conf
this step could help if you are using jdk installed by brew following default path.
If you've installed openjdk with sdkman path to java will be like ~/.sdkman/candidates/java/{{java-version}} and this path needs to be mapped on default expectations with aliases.
I did not have information about the default path, so it needs to find executable file:
start sqldeveloper (to make shown error message);
in terminal try ps ux | grep sql - it will help you to detect executable file location sqldeveloper.sh;
open the file with text editor:
remove or comment block that tries to get java from default location /usr/libexec/java_home;
find line with export JAVA_HOME=$TMP_PATH and replace path with your path to java home or simply remove line if JAVA_HOME was specified in OS settings.
In newer version I needed to extend the path in
/Users/{{yourUsername}}/.sqldeveloper/21.2.1/product.conf
SetJavaHome /Library/Java/JavaVirtualMachines/jdk-11.0.13.jdk/Contents/Home
apt-get install openjdk-6-jre
apt-get install openjdk-7-jre
apt-get install openjdk-6-jdk
apt-get install openjdk-7-jdk
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer

Installing Java 7 on Ubuntu

Note: This question was asked before Oracle made the OpenJDK the free version of the Oracle JDK, and the historic answers reflect that. As of 2022 you should not use Java 7 unless you must for projects which cannot run on OpenJDK 8.
To install java I have always used the classic way from the terminal.
I would like to install java manually.
I placed the folder of the JDK on the desk and I set environment variables (PATH, CLASSPATH and JAVA_HOME).
From the terminal, if I type java -version I get printed
foralobo#ubuntu-vincy:~$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
But when I try to install eclipse or netbeans, the system warns by saying that there is no java installed on the machine.
What is missing to compleatare manual installation?
(Ubuntu 13.04)
This answer used to describe how to install Oracle Java 7. This no longer works since Oracle end-of-lifed Java 7 and put the binary downloads for versions with security patches behind a paywall. Also, OpenJDK has grown up and is a more viable alternative nowadays.
In Ubuntu 16.04 and higher, Java 7 is no longer available. Usually you're best off installing Java 8 (or 9) instead.
sudo apt-get install openjdk-8-jre
or, f you also want the compiler, get the jdk:
sudo apt-get install openjdk-8-jdk
In Trusty, the easiest way to install Java 7 currently is to install OpenJDK package:
sudo apt-get install openjdk-7-jre
or, for the jdk:
sudo apt-get install openjdk-7-jdk
If you are specifically looking for Java 7 on a version of Ubuntu that no longer supports it, see https://askubuntu.com/questions/761127/how-do-i-install-openjdk-7-on-ubuntu-16-04-or-higher .
sudo apt-get update
sudo apt-get install openjdk-7-jdk
and if you already have other JDK versions installed
sudo update-alternatives --config java
then select the Java 7 version.
In addition to flup's answer you might also want to run the following to set JAVA_HOME and PATH:
sudo apt-get install oracle-java7-set-default
More information at:
http://www.ubuntuupdates.org/package/webupd8_java/precise/main/base/oracle-java7-set-default
Note: According to comments this text was copied from a GIST without attribution.
Download java jdk<version>-linux-x64.tar.gz file from https://www.oracle.com/technetwork/java/javase/downloads/index.html.
Extract this file where you want. like: /home/java(Folder name created by user in home directory).
Now open terminal.
Set path JAVA_HOME=path of your jdk folder(open jdk folder then right click on any folder, go to properties then copy the path using select all)
and paste here.
Like: JAVA_HOME=/home/xxxx/java/JDK1.8.0_201
Let Ubuntu know where our JDK/JRE is located.
sudo update-alternatives --install /usr/bin/java java /home/xxxx/java/jdk1.8.0_201/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /home/xxxx/java/jdk1.8.0_201/bin/javac 20000
sudo update-alternatives --install /usr/bin/javaws javaws /home/xxxx/java/jdk1.8.0_201/bin/javaws 20000
Tell Ubuntu that our installation i.e., jdk1.8.0_05 must be the default Java.
sudo update-alternatives --set java /home/xxxx/sipTest/jdk1.8.0_201/bin/java
sudo update-alternatives --set javac /home/xxxx/java/sipTest/jdk1.8.0_201/bin/javac
sudo update-alternatives --set javaws /home/xxxxx/sipTest/jdk1.8.0_201/bin/javaws
Now try:
$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-oracle1/bin/java 1047 auto mode
1 /usr/bin/gij-4.6 1046 manual mode
2 /usr/lib/jvm/java-6-oracle1/bin/java 1047 manual mode
3 /usr/lib/jvm/jdk1.7.0_75/bin/java 1 manual mode
Press enter to keep the current choice [*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk1.7.0_75/bin/java to provide /usr/bin/java (java) in manual mode
Repeat the above for:
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
I think you should consider Java installation procedure carefully. Following is the detailed process which covers almost all possible failures.
Installing Java with apt-get is easy. First, update the package index:
sudo apt-get update
Then, check if Java is not already installed:
java -version
If it returns "The program java can be found in the following packages", Java hasn't been installed yet, so execute the following command:
sudo apt-get install default-jre
You are fine till now as I assume.
This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), which is usually needed to compile Java applications (for example Apache Ant, Apache Maven, Eclipse and IntelliJ IDEA execute the following command:
sudo apt-get install default-jdk
That is everything that is needed to install Java.
Installing OpenJDK 7:
To install OpenJDK 7, execute the following command:
sudo apt-get install openjdk-7-jre
This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), execute the following command:
sudo apt-get install openjdk-7-jdk
Installing Oracle JDK:
The Oracle JDK is the official JDK; however, it is no longer provided by Oracle as a default installation for Ubuntu.
You can still install it using apt-get. To install any version, first execute the following commands:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
Then, depending on the version you want to install, execute one of the following commands:
Oracle JDK 7:
sudo apt-get install oracle-java7-installer
Oracle JDK 8:
sudo apt-get install oracle-java8-installer
PPA method no longer works.
While Oracle Java 6 and 7 are not supported for quite a while, they were still available for download on Oracle's website until recently.
However, the binaries were removed about 10 days ago (?), so the Oracle Java (JDK) 6 and 7 installers available in the WebUpd8 Oracle Java PPA no longer work.
Oracle Java 6 and 7 are now only available for those with an Oracle Support account (which is not free), so I can't support this for the PPA packages.
Source : http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html
Dated : June 2017
Oracle's download page says
Updates for Java SE 7 released after April 2015, and updates for Java SE 6 released after April 2013 are only available to Oracle Customers through My Oracle Support (requires support login).
Java SE Advanced offers users commercial features, access to critical bug fixes, security fixes, and general maintenance".
I had to download it from Oracle archives -
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
You need an account for this though.
Oracle Java 1.7.0 from .deb packages
wget https://raw.github.com/flexiondotorg/oab-java6/master/oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh -7
sudo apt-get update
sudo sudo apt-get install oracle-java7-jdk oracle-java7-fonts oracle-java7-source
sudo apt-get dist-upgrade
Workaround for 1.7.0_51
There is an Issue 123 currently in OAB and a pull request
Here is the patched vesion:
wget https://raw.github.com/ladios/oab-java6/master/oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh -7
sudo apt-get update
sudo sudo apt-get install oracle-java7-jdk oracle-java7-fonts oracle-java7-source
sudo apt-get dist-upgrade
flup's answer is the best but it did not work for me completely. I had to do the following as well to get it working:
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/
chmod 777 on the folder
./gradlew build - Building Hibernate
Oracle as well as modern versions of Ubuntu have moved to newer versions of Java. The default for Ubuntu 20.04 is OpenJDK 11 which is good enough for most purposes.
If you really need it for running legacy programs, OpenJDK 8 is also available for Ubuntu 20.04 from the official repositories.
If you really need exactly Java 7, the best bet as of 2020 is to download a Zulu distribution. The easiest to install if you have root privileges is the .DEB version, otherwise download the .ZIP one.
https://www.azul.com/downloads/?version=java-7-lts&os=ubuntu&architecture=x86-64-bit&package=jdk#download-openjdk
Open Applicaction -> Accessories -> Terminal
Type commandline as below...
sudo apt-get install openjdk-7-jdk
Type commandline as below...
apt-cache search jdk
(Note: openjdk-7-jdk is symbolically used here. You can choose the JDK version as per your requirement.)
For "JAVA_HOME" (Environment Variable) type command as shown below, in "Terminal" using your installation path...
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
(Note: "/usr/lib/jvm/java-7-openjdk" is symbolically used here just for demostration. You should use your path as per your installation.)
For "PATH" (Environment Variable) type command as shown below, in "Terminal" using your installation path...
export PATH=$PATH:/usr/lib/jvm/java-7-openjdk/bin
(Note: "/usr/lib/jvm/java-7-openjdk" is symbolically used here just for demostration. You should use your path as per your installation.)
Check for "open jdk" installation, just type command in "Terminal" as shown below
javac -version

How can I install Eclipse and Java SDK on Ubuntu?

I have just downloaded Ubuntu. It runs much faster than my Windows XP. But, I don't know how I can set up Eclipse v4.2 (Juno), or the Java SDK. I am currently developing in the Lightweight Java Game Library, so I might need some help with that too.
Execute this in your terminal:
sudo apt-get install eclipse
sudo apt-get install openjdk-6-jdk openjdk-6-source openjdk-6-demo openjdk-6-doc openjdk-6-jre-headless openjdk-6-jre-lib
The first one installs Eclipse (you will be asked to enter your password), and the second one installs all the Java stuff you may need!
Don't install Eclipse from the Linux repositories. These repositories may not be up-to-date with the last versions released by Eclipse. A better approach is to follow the instructions in this answer from Ask Ubuntu. For Java programming, make sure you have a JDK and a JRE installed
apt-get install openjdk-7-jdk openjdk-7-jre
You can download whatever Eclipse Java IDE version suits you best from the Eclipse website (link to the Eclipse v4.4 (Luna) release).
You might want to consider installing Sun Java 6 for your Java programming needs; correct me if I'm wrong, but I feel that OpenJDK may still be lacking in some libraries and compatibilities.
If you want to install Java 6 on your machine, you can follow this guide on how to do so: https://codingforme.wordpress.com/2012/05/14/installing-oracle-java-jdk-6-or-7-on-ubuntu-12-04/
Java installation on Ubuntu:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Eclipse IDE installation on Ubuntu:
Since it requires a detailed list of steps, I would suggest you to visit the blog post Install Eclipse IDE Mars in Linux Ubuntu to check out steps to install Eclipse on Linux Ubuntu.
You don't really install Eclipse - you just download the folder and run the program - just like in windows. Just make sure you download a Linux version.
To install JDK, type:
sudo apt-get install openjdk-6-jdk
You will be asked to type in your password before the installation will begin. You could also install JDK through the software manager.
Just remove all Eclipse packages typing:
sudo apt-get autoremove eclipse
And with tab find all installed Eclipse packages.
Do the same with Java.
I just reinstalled Eclipse with the command
sudo apt-get install eclipse
which also contains Java.

Categories