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.
Related
On a desktop with a dual boot I currently have Java JDK 8 in the Linux (Mint) system
chris#M17A ~ $ sudo apt install default-jdk
...
default-jdk is already the newest version (2:1.8-56ubuntu2).
...
chris#M17A ~ $ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
But I'm sure that in fact 1.8.0_171 is not the latest version, even of Java 8! If I want to change to 1.11.xxx, which seems to be the latest LTS release (for Oracle non-OpenJDK at least), what should I do? Do I have to manually download something, or use a PPA? How can I be sure my Linux OS is using the version-11 JRE and the version-11 JDK?
I've also never quite understood either about the versioning of the JRE side of things and how this corresponds to the JDK being used. On my Windows machine (W10) I am using a Java 9 JDK but a Java 8 JRE (I think). Is this a bad thing to do?
This question says there is no such thing in Windows as a Java 11 JRE, although there is a Java 11 JDK. Is that a problem in W10? Would it be a bad idea to use an JDK 11 with a JRE 8?
I also simply don't understand why it is not possible read somewhere about the "latest JRE" or "latest stable JRE". These do not appear to be coupled one-to-one with the latest JDK as far as I can make out but I'm having difficulty obtaining clarity about all this.
I also have some difficulty understanding whether I should opt for OpenJDK or the other JDK (they're both Oracle so I don't know how to refer to the non-OpenJDK one... "commercial JDK"?). But unlike the above difficulties there are lots of explanations out there. I am mainly looking for "latest stable release" hopefully with LTS. Seems like "Commercial JDK" version 11 might be the way to go...
Java 8 is the default JDK (recommanded) for your System.
According to this, you need to add the repository of openjdk using this command:
sudo add-apt-repository ppa:openjdk-r/ppa
After that you need to update you index using
sudo apt-get update
If you want to install jdk 11 you can do:
sudo apt-get install openjdk-11-jdk
[Hint]
default-jdk is the default jdk. This means that, if this is up-to-date, you have the recommanded/default version of a jdk.
Also, openjdk seems to be recommanded for linux
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.
How can I cleanse my Mac of Java 8 -- jdk, not jre or plugin, which I don't care about? I need to downgrade to jdk 7. I've found docs online but they're all about the java plugin. If I try simply installing jdk 7 (on top of 8), the 8 is still there.
You can uninstall a JDK simply by deleting the appropriate directory under /Library/Java/JavaVirtualMachines where it is installed. But note that browsers, Java Web Start and double-clickable app bundles created with Oracle's appbundler will always use the "public JRE" under /Library/Internet Plug-Ins, and that will remain as Java 8 unless you uninstall it separately.
But you may not actually need to uninstall Java 8 - the command line tools such as java and javac respect JAVA_HOME, so you can have both versions installed side by side and pick the appropriate one with /usr/libexec/java_home:
export JAVA_HOME=`/usr/libexec/java_home -v '1.7*'`
On my machine, I get the following output from terminal:
> /usr/libexec/java_home -v 1.6
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> /usr/libexec/java_home -v 1.7
/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
> /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
Check yours and let me know.
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
I am new to Linux and installed Ubuntu. Fine. I gone through the basics of file system and basic things to know.
I installed Jdk1.7. by downloading the related .rpm file from oracle website. I installed Eclipse. I gave the the installed jdk1.7 jre folder in the eclipse project classpath.
But it is not identifying that and a simple java code is not getting compiled.
In one of the forums I found that we should use openjdk for linux distributions.
could someone explain me Why is that? and am I doing anything wrong by installing the jdk7 from oracle website in these linux distributions?
What difference they make?
Thanks
No, you don't have to use openjdk, any jdk should work fine. You say that you gave path to the jre in the jdk, not jdk itself? JRE has no compiler, JDK has.
Try
sudo apt-get install openjdk-6-jdk eclipse
and see if it helps.
The Openjdk or icedtea or ... are JRE or JDK which try to be as open as possible. Oracles JDK/JRE is not Open enough in respect to the open source community, which is something the usual Linux user doesn't want in its Linux distribution as default implementation.
For a to releasing product you should specify the supported/tested Java implementation. There can be difference for example in performance or in tooling.
For developing with eclipse you don't necessarily need a JDK, because eclipse has its own Java Compiler. But it is recommended to use a JDK. It has nice tools and for some projects you need a JDK.
(The oracle jdk (and jre) are working just fine (at the current u05 release)).
Given that I've understood where you unpacked/put/installed the jdk (check the path), the following commands should fix a lot for you.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.7/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.7/bin/javac" 1
(
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/jdk1.7/bin/javaws" 1
)
sudo update-alternatives --config java
sudo update-alternatives --config javac
Hopefully this should make ubuntu take care of your java specific env. variables.