I am running Ubuntu 20.04 and am installing Netbeans 12. The installer prompts to install Java SE (and Java EE) and bunch of other stuff.
Do I need really need to install that (Java SE and Java EE) since I already have the JDK installed?
You don't need to install the Java version that comes with Netbeans. You just need to select the Java installation you want to use in the Netbeans installer.
From the docs it appears you only need the JDK and Java EE but I am not on my home system to verify.
NetBeans 12 Docs
I have a clean install of El Capitan. I have PHPStorm installed on my Macbook Air. When I try to run the application, I get an error that says PHP storm can't be opened because it requires legacy Java SE 6. I've attached an image of the error below.
I had the same problem when I installed Yosemite but I was able to install the legacy java fix (Java for OS X 2014-001) from Apple's website. When I try installing that same java fix I get the following Error:
Java for OS X can't be installed on this disk. A newer version of this package is already installed
Any thoughts and help will be greatly appreciated!
Thanks
Download Java 6 for El Capitan:
Java for OS X 2015-001 Beta
https://support.apple.com/kb/DL1824
I've used Homebrew to install JDK 1.6.0_65:
brew tap homebrew/cask-versions
brew cask install java6
If you have a problem with Java version on OsX Yosemite or El Capitain, you should download bundled Webstorm (or any other IDE from Jetbrains). It's working, I've tried it by myself.
https://www.jetbrains.com/webstorm/download/
And yes, this is not a programming related question, but it's an IDE for programming and when you come to work at morning and you can't code — that's problem — and you don't care if it's related ;)
i changed version to 1.8 here in below instructions and PhpStorm is now working for me.
At the moment all our products require Apple JDK 1.6 to be installed in order to run on Mac. JDK 1.7 from Oracle is not officially supported yet and has known problems that stop us from using it by default. Oracle JDK 1.7.0_40 has added support for Retina and works much better than previous versions on Mac. You are welcome to give it a try in case you have any problems with Apple JDK.
To force running under JDK 1.7 edit /Applications/.app/Contents/Info.plist file, change JVMVersion from 1.6* to 1.7* :
JVMVersion
1.7*
Open Terminal.app and write sudo nvram boot-args="rootless=0" + return
Reboot
Install Java from https://support.apple.com/kb/dl1572?locale=en_US
This will install Java 6, 7 and 8. Enjoy!
I currently have Java 7 on my machine, but would like to downgrade as some unit tests in my current project fails with newer versions of Java.
Note that I am running OS X 10.9.1, and the Java installation practices have changed since previous versions of the OS.
Since Apple has changed the distribution around the time of 1.6, it's not obvious to me how I get the old version. Oracle does not supply Mac packages of 1.6 :(
Clues?
The OS/X Mavericks ships with Java 1.6, but in case you've installed another version, you can get back with 1.6 if you download a bundle of Java SE 1.6.0_65 from Apple.
If you've installed a later version of Java, e.g. 1.7, for all users, installing the bundle mentioned above will most likely break your existing newer installation.
The response here from Sami Laine didn't help me but this StackOverflow page did:
Java 6 Unsupported major.minor version 51.0
To step down from Java 1.8 to 1.6 to support a legacy codebase, I also had to step down Maven from 3.3 to 3.2.
I was working in a Java 1.6 project in Windows, and now I have to work from my laptop, that is a Macbook Pro (Intel Core 2 Duo) with a MacOsX Leopard 10.5.8 installed.
In the same laptop I've worked in the past with Java 1.5 with any problems, but now I can't work with 1.6, and I don't know what I'm doing wrong.
When in a terminal I write: java -version I get java version "1.6.0_26"
But when I'm trying to install last version of Netbeans (7.0.1) I get the message:
It's not possibe to install NetBeans 7.0.1 in this volume. This
software can be installed and work only with Java 6
Then I tried to work with Eclipse. I've download last version of the IDE, and open the project. I get some compile errors (the parts of Java 1.6).
I went to Preferences -> Java -> Compiler->Compiler compliance level from 1.5 to 1.6
Then I get a message that says:
When selecting 1.6 compliance, make sure to have a compatible JRE
installed and activated (currently 1.5) Configure
But when I try to change to 1.6
The selected JRE does not support the current compiler compliance
level of 1.6
What I have to do to work with Java 1.6?
EDIT:
I've noticed that at
/System/Library/Frameworks/JavaVM.framework/Versions/
1.6 seems not to be installed
On OS X Leopard (10.5) the JDK 1.6 can only be used on 64bit-hardware (also in the Apple FAQ). If you are on a 32bit-hardware, you will not be able to run Java 1.6.
If you are on 64bit hardware, you can install it via SoftwareUpdate or via the Developer Tools. To select the running version of Java you can use the Java Preferences.
Here you will find a chart which (Apple)-JDK is running under which OS X version.
There is an "unofficial" port I have not tried: The project SoyLatte brings JDK 1.6 to OS X 10.4. and later - perhaps you can have a try with this.
I want to install a specific JDK (the latest for example). For this, I went to the JDK download homepage: http://java.sun.com/javase/downloads/index.jsp.
I looked for a Mac version, but I'm a bit surprised to only see downloadable versions for Linux, Windows and Solaris...
Here's the message for Mac:
"Apple Computer supplies their own version of Java. Use the Software
Update feature (available on the Apple menu) to check that you have
the most up-to-date version of Java for your Mac."
OK BUT... when I update Java with Mac I have a JRE and not a JDK...
I don't understand why a JDK version doesn't exist that is easily downloadable/installable (like a jar to unzip?) for Mac...
In a comment under #Thilo's answer, #mobibob asked how to set JAVA_HOME in your .bash_profile on a Mac. Answer:
export JAVA_HOME=`/usr/libexec/java_home`
This will dynamically assign to JAVA_HOME the location of the first JDK listed in the "General" tab of "Java Preferences" utility.
See Apple Technical Q&A 1170: https://developer.apple.com/library/content/qa/qa1170/_index.html
EDIT:
If you prefer parentheses to backticks for command substitution, this also works:
export JAVA_HOME=$(/usr/libexec/java_home)
As the message says, you have to go to Apple, not Sun, for Java on the Mac. As far as I know, Apple JDK 6 is installed by default on Mac OS X 10.6 (Snow Leopard). Maybe you need to install the developer tools from your Mac OS X installation DVD (the dev tools are an optional install from the OS DVD).
See: http://developer.apple.com/java/
NOTE This answer from 16 Oct 2009 is now outdated; you can get the JDK for Mac OS X from the regular JDK download page on Oracle's website now.
For people using any LION OS X 10.7.X
They uploaded Java SE 6 version 1.6.0_26 available here
http://support.apple.com/kb/dl1421
I bought a MacBook Pro yesterday (Mac OS X v10.8 (Mountain Lion)) and there is no JDK installed by default...
As well as javac, I also found it didn't have packages such as SVN installed. It turns out you can get everything from the Apple developer page (you will need to register with your AppleID). SVN is part of the "Command Line Tools" package.
This is what happens on a fresh MacBook:
Hopefully this will help out other newbies like me ;)
The explanation is that JDK is a bit specific and does not contain the library tools.jar. For my development, I need this library and Mac's JDK doesn't provide it:
(Cf. http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html)
tools.jar does not exist. Classes usually located here are instead included in classes.jar. Scripts that rely on the existence of tools.jar need to be rewritten accordingly.
It sucks!
The easiest way is to use Homebrew.
Install Homebrew and then:
brew tap caskroom/versions
brew cask install java7
You can list all available versions using the following command:
brew cask search java
Mac comes with the JDK, for more information check:
http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html
Compiling with -source 1.5 -target 1.5 (in a JDK 6 environment) will honor only language elements that were in 1.5 and prior. Great. But there were no language changes in 6 anyway. Problem with this approach (on Mac with 1.6) is that using classes that came AFTER 1.5 will still compile because they exist in the rt.jar. So one could run in a 1.5 env and get a class not found exception with no prior warning when compiling. I found this out the hard way with javax.swing.event.RowSorterEvent/Listener. Both entered "Since 1.6" but are not caught with -source 1.5
If you installed brew, cmd below will be helpful:
brew cask install java
As of Mac OS X v10.6 (Snow Leopard), you can run Java 6 in 32-bit mode on either 32-bit or 64-bit Intel processor equipped Macs.
If you cannot upgrade to Snow Leopard, Soy Latte is a pre-compiled version of Java 6 for Intel 32-bit.
There are various tricky issues with having multiple versions of Java (Apple's own Java 6 and Oracle JDK 7 or even 8) on one's Mac OS X system, and using different versions for different applications. I spent some time writing up my experience of my experience of installing and configuring various versions of JDK on Mac OS X 10.9.2.
In 2022, give a try to sdkman, is better than brew
curl -s "https://get.sdkman.io" | bash
then open a new shell and try list to see what you could install ;-)
sdk list java
At time of writing you could use:
sdk install java 17.0.1-tem
Check this awesome tool sdkman to manage your jdk and other jdk related tools with great ease!
e.g.
$sdk list java
$sdk install java <VERSION>
Since most answers are out of date, here's what works as of end of 2018 under the assumption that
You want to install the GPL version of OpenJDK.[0]
You do not want to install Homebrew
In that case, grab the desired version from one the many available, freely usable OpenJDK editions, e.g.:
AdoptOpenJDK
Amazon Corretto (Great for production, includes backports)
Oracle GPLv2 OpenJDK
Some of these include installers, but if not you can do the following. Assuming here version 11.0.1 for Mac. In your favorite shell, run:
tar -xzf openjdk-11.0.1_osx-x64_bin.tar.gz
sudo mv jdk-11.0.1.jdk /Library/Java/JavaVirtualMachines
# Fix owner and group
sudo chown -R root:wheel /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
# (Optional) Check if the new JDK can be found
/usr/libexec/java_home
=> /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
[0] Note that the Oracle branded JDK has significant licensing restrictions allowing you its use basically only for testing, i.e., not for production. If you do not have a support agreement with Oracle, then it seems risky to me to use their JDK, especially since the differences to OpenJDK are minimal.
Edit: added more choices
I think this other Stack Overflow question could help:
How to get JDK 1.5 on Mac OS X
It basically says that if you need to compile or execute a Java application with an older version of the JDK (for example 1.4 or 1.5), you can do it using the 1.6 because it is backwards compatible. To do it so you will need to add the parameter -source 1.5 and/or -target 1.5 in the javac options or in your IDE.
JDK is the Java Development Kit (used to develop Java software).
JRE is the Java Runtime Environment (used to run any .jar file 'Java software').
The JDK contains a JRE inside it.
On Windows when you update Java, it updates the JRE automatically.
On Mac you do not have a JRE separated you have it, but inside the JDK, so when you update Java it will update your JRE which is inside your JDK;
it doesn't install an JDK for you. You need to get it from somewhere else.
As a rule you cannot install other versions of Java on a Mac than those provided by Apple through Software Update. If you need Java 6 you must have a 64-bit Intel computer. You should always have Java 5 and 1.4 and perhaps 1.3 installed if you have at least OS X 10.4.
If you have VERY much elbow grease and is willing to work with beta software you can install the OpenJDK under OS X, but I don't think you want to go there.