Question or issue on macOS:
Download Java for OS X 2017-001 Java for macOS 2017-001 installs the legacy Java 6 runtime for macOS 10.13 High Sierra, macOS 10.12 Sierra, macOS 10.11 El Capitan, macOS 10.10 Yosemite, macOS 10.9 Mavericks, macOS 10.8 Mountain Lion, and macOS 10.7 Lion. Download the Oracle Software:So you might want to download the latest Version 11.1.1.6.0. (Although a Version Oracle JDeveloper 11g (11.1.2.3.0) (Build 6276.1) is availabe, this Version is not suitable if you want to build SOA, BPM, WebCenter or Oracle Cloud applications. Java SE 6 Downloads. Go to the Oracle Java Archive page. Thank you for downloading this release of the Java TM Platform, Standard Edition Development Kit (JDK TM).The JDK is a development environment for building applications, applets, and components using the Java programming language. The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 375 open source projects, including runtimes, tools and frameworks. It is free and open source. Also you can get it from the GitHub mirror. Enterprise Edition 7.3.0. Released on December 7, 2020 EE version web site: dbeaver.com Trial version is available. Windows 64 bit (installer) Windows 64 bit (zip) Install from Microsoft Store; Chocolatey package; Mac OS X. Mac OS X (installer) Mac OS X (dmg) Mac.
I am having a problem running Ant with JDK 1.6 on Mac OS X. Even though Java application versions is set to Java SE 6 in OS X’s Java Preference, executing java -version in Terminal also shows java version “1.6.0_07”, Ant still seems to use JDK 1.5 to be using JDK 1.5 as it does not see JDK 1.6 classes when compiling my code.
I understand that Ant relies on JAVA_HOME environment variable to specify which JDK to use. However, I do not quite understand how this variable can be set on Mac OS X.
Hence, my question is how to make Ant runs with JDK 1.6 on Mac OS X. If the correct way is still to set JAVA_HOME environment variable, how to set the variable on OS X.
How to solve this problem?
Solution no. 1:
The JAVA_HOME environment variable is set in your home directory’s .profile file. (/Users/ejel/.profile ?) Edit it and set it to what you want it to be. E.g.:
From this point onward, every time you open a new terminal window it will have JAVA_HOME set to this new value. It will not have changed with any existing open windows.
If you are truly aghast to putting this in the profile, or if it conflicts with other software, the export statement could always be run in the terminal manually or go into a script (eg: setj6ev.sh) that is run once before you start running ant tasks.
Solution no. 2:
I’ve added the line
To my .zshrc file, it seems to do the trick (.bash_profile or whatever if you use bash).
Solution no. 3:
Ted, using the Java Preferences app doesn’t change the CurrentJDK symlink in /System/Library/Frameworks/JavaVM.framework/Versions, which is what Ant will use if the JAVA_HOME environment variable isn’t set. Thus, you can either change that symlink manually or set the JAVA_HOME environment variable, but if you do neither, then Ant won’t use the correct JDK.
You can see the version of the jdk that Ant is using by issuing an <echo message=”${ant.java.version}”/> in your build.xml file.
Solution no. 4:
Explicitly setting the JAVA_HOME variable in your .profile/.bashrc/.zshrc isn’t actually the recommended way to do it on the mac. There are programs that I’ve seen get hosed up with an explicitly set JAVA_HOME to a particular version (grails 1.1 with some spring resources for example).
The correct way to set the version of Java that you want to use is to use the /Application/Utilities/Java Preferences.app application.
In there, you drag the version of java that you want to use to the top. This will enable that version for all applications (both those run from the command line and those launched through GUI processes).
You can test the current version by running this from the command line:
I don’t actually like the way that the mac handles the entire set of java symlinked directories and files. It’s not obvious and people often screw it up.
See the apple developer page on this for more details.
Solution no. 5:
I try everything, and only one thing works for me : unlink CurrentJDK, and link to 1.6 :
Finally I get :
I hope this help.
Solution no. 6:
You may need to open a new command prompt instance so that the shell can pick up any changes to the environment variables.
Hope this helps!
This article shows you how to install Java on Mac OSX, and also how to do Java/JDK version switching.
Tested with
- Mac OS 10.15.3
- JDK 8, 9, 10, 11, 12, 13 (AdoptOpenJDK)
Note
On Mac OSX, Java should installed in this folder; it is Mac’s standard.
We will show you two ways to install Java JDK on Mac, via the popular Homebrew package manager and manually installation.
1. Homebrew
1.1 Install Homebrew and update it.
1.2 Add adoptopenjdk/openjdk.
1.3 Find all available JDK.
The output may vary.
1.4 Java 8, 9, 10, 11, 12, 13, choose one to install.
This example will install Java 8 and 11 for testing.
1.5 Where Java is installed? /usr/libexec/java_home -V
Homebrew will install the JDK at folder /Library/Java/JavaVirtualMachines/
, and this folder is Mac’s standard folder for Java installs.
1.6 Test it, by default, Mac takes the highest version.
1.7 How to do version switching? Refer to below 3. version switching
2. Manual installation
The example shows you how to download the early access JDK 14 and install it on Mac OSX.
Steps
- Download JDK.
- Puts the JDK folder at
/Library/Java/JavaVirtualMachines
. - Export
JAVA_HOME
.
2.1 Download the early access JDK 14 from the OpenJDK website.
2.2 Extracts tar file to /Library/Java/JavaVirtualMachines
2.3 Export JAVA_HOME
.
Find out where is JDK 14.
Create or edit the existing ~/.bash_profile
with a text editor.
Export JAVA_HOME
, save and exit.
Reflect the changes
2.4 Test it.
3. Version Switching
In this tutorial, we installed the Java 8 and Java 11 via Homebrew
(Step 1), and Java 14 manually (Step 2), so this Mac has three versions now. And the Mac is using the JDK 14.
Note
There are tools like jEnv to manage the Java version switching, but I prefer to manage with export JAVA_HOME
manually, it’s simple and easy to understand, no black box magic.
3.1 Create or edit the existing ~/.bash_profile
with a text editor like vim or nano, export JAVA_HOME
to the specified JDK we want to use on Mac.
The above changes will make JAVA_HOME
point to JAVA 8.
3.2 Reflect the changes.
Done.
If we want to switch JDK version again, update the ~/.bash_profile
and export JAVA_HOME
to other JDK version.