2

I installed Aptana Studio 3 on my MAC which I updated to the Newest OS Catalina. That is what outdated all my adobe applications and Dreamweaver was a favourite program. Installing Aptana Studio 3 I can't open it because it says I need to instal Legacy Java SE Runtime 6. But I can't install that because Catalina has a higher version of Java that is already installed. So I can't open Aptana Studio 3.

Any suggestions?

Nicola Gallazzi
  • 7,897
  • 6
  • 45
  • 64
Mike Thackery
  • 21
  • 1
  • 2

3 Answers3

4

Steps to install Java 6 on Catalina

From https://www.harrisgeospatial.com/Support/Self-Help-Tools/Help-Articles/Help-Articles-Detail/ArtMID/10220/ArticleID/23780/Mac-OS-Catalina-1015-ENVIIDL-and-Legacy-Java-6-Dependencies)

  1. Open Finder
  2. Navigate to Applications > Utilities > Script Editor
  3. Select "New Document" button
  4. Copy the following text to the Script Editor Document:

    set theDMG to choose file with prompt "Please select javaforosx.dmg:" of type {"dmg"}
    do shell script "hdiutil mount " & quoted form of POSIX path of theDMG
    do shell script "pkgutil --expand /Volumes/Java\\ for\\ macOS\\ 2017-001/JavaForOSX.pkg ~/tmp"
    do shell script "hdiutil unmount /Volumes/Java\\ for\\ macOS\\ 2017-001/"
    do shell script "sed -i '' 's/return false/return true/g' ~/tmp/Distribution"
    do shell script "pkgutil --flatten ~/tmp ~/Desktop/ModifiedJava6Install.pkg"
    do shell script "rm -rf ~/tmp"
    display dialog "Modified ModifiedJava6Install.pkg saved on desktop" buttons {"Ok"}
    
  5. Select Script > Compile from the menu, or select the "Hammer" button to ensure the above copy and pasted code compiles.

  6. Select Script > Run from the menu, or select the "Arrow" run button.
  7. Running the script will create a ModifiedJava6Install.pkg on your desktop. Run this ModifiedJava6Install.pkg to install Java 6.

This should work to enable adding legacy Java onto the Catalina Mac OS device

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
smokecloud
  • 43
  • 6
  • The script made no difference for me on Mojave 10.14.6. I get this error after installing with the modified pkg via script. "Version 1.6.0_65 of the JVM is not suitable for this product. Version 1.8 or greater is required." – adamlogan Jan 09 '20 at 04:25
  • It doesn't create any file in my case – Nicola Gallazzi Jun 03 '20 at 07:39
2

TLDR:
Get JavaForOSX.dmg file from https://support.apple.com/kb/DL1572?locale=en_US
Run below 7-commands in Terminal:
hdiutil mount ~/Downloads/JavaForOSX.dmg
mkdir -p ~/Downloads/tmp/
pkgutil --expand "/Volumes/Java for macOS 2017-001/JavaForOSX.pkg" ~/Downloads/tmp/OSXJavaSE6/
hdiutil unmount "/Volumes/Java for macOS 2017-001/"
sed -i '' 's/return false/return true/g' ~/Downloads/tmp/OSXJavaSE6/Distribution
pkgutil --flatten ~/Downloads/tmp/OSXJavaSE6/ ~/Downloads/tmp/JavaSE6.pkg
rm -r ~/Downloads/tmp/OSXJavaSE6
Run/double-click on "JavaSE6.pkg" file inside ~/Downloads/tmp/ folder.
End-of-TLDR

BEGIN:

"LEGACY JAVA" is older version of Java SE JRE/JDK, etc.

  • Some apps specifically need to use very specific (old) version of Java SE JRE/JDK, etc.
    So user need to load those specific version, which is required by an App.
  • One computer can have/use multiple versions of Java JRE/JDK, etc.
  • Older Apple macOSX included Java. ( i think, upto Java SE 6 in upto macOSX High-Sierra 10.13 ).
    Then Apple macOSX stopped including any Java, so user had to load on their own.
  • OBTAIN JAVA : I suggest to use OpenJDK based Java (OpenJDK based Java release includes JDK & JRE) from https://OpenJDK.Java.net/ site (it is free for any Commercial usage & also free for any Personal usage & you're free to include JRE/JDK with your App, etc ) , use OpenJDK when a java-based App needs (latest) Java or Legacy-Java (not below Legacy-Java 6).
    To obtain Legacy-Java, we can also get it from 'Oracle' website ('Oracle' purchased 'Sun', & 'Sun' developed Java), but Java from 'Oracle' is free only for Personal usage, & also needs user to free-registration in website, it is not-free for Commercial usage, & not-free if you want to distribute JRE with your App, etc . If App needs older than Legacy-Java 6 (1.6), then we have to get it from 'Oracle' site, as OpenJDK does not have older than Legacy-Java 6 (1.6).
    By the way, OpenJDK's macOS optimized Java binary-files (and src-code) are available for Java 9 (1.9) & above, in OpenJDK archive-site . And OpenJDK 6(1.6), 7(1.7), 8(1.8) are available as Src-code form only, So dev/user have to compile Src-code to get macOS optimized binary for OpenJDK 6, 7 or 8.
    So its easier+better that, for last binary+src of Legacy-Java 6 (1.6) (Java JRE+JDK 6 (1.6)) that is optimized for macOS, we should use Apple website: https://support.apple.com/kb/DL1572?locale=en_US ( "JavaForOSX.dmg" (en_US) file, 51.1MB, md5:5bc4ef2d2115f8b35bc6c0bd792477d5, sha1:10687ebc3d0965bd0fcbad600ae48ee84e0eff04. )

in macOSX Catalina (or in macOS-XI/11/X1 after it) download it in default ~/Downloads/ folder.

PROBLEM : if you try to install Legacy-Java package/pkg/PKG in macOSX ( i think in macOSX Mojave or macOSX after it ) you will receive various ERRORS from macOSX installer "This package is incompatible..." , it will STOP INSTALLING, etc, As it is very old, etc.

SOLUTION : So you will have to do some further modification(s) on pkg installer file on your own with below instructions, ( Do not download/use someone else's modified pkg file, as it may have unwanted components in it ).
Part of these below instructions are adopted from MacRumors-site user bogdanw (THANK YOU, bogdanw) , which are then further modified by me as original instructions were not working properly for me.

Note:

  • in below 'cmd:' word is indicating a command is given after it, to type in the Terminal utility. Do not type/use the 'cmd:' word itself when you type/copy a command.
  • when you see '<YourUserName>' then change it to your actual macOS user name , and do not use the '<' or '>' symbols. An example: the ~/Downloads folder means /Users/<YourUserName>/Downloads folder . The '~' is short form of /Users/<YourUserName> folder aka your HOME folder . Folder = Directory.

Follow below INSTRUCTIONS:

  • in Finder, double-click/tap on that Legacy-Java "JavaForOSX.dmg" file , macOS HDIutil will mount/load the DMG archive file & in Finder you will see a new mount point (aka, new drive) "Java for macOS 2017-001" has appeared, & it has a file "JavaForOSX.pkg" inside it.
    if you prefer to do this via Terminal:
    cmd: hdiutil mount ~/Downloads/JavaForOSX.dmg
  • start "System Preferences" , in macOSX Catalina (or Mojave or macOSX after it) goto "Security & Privacy" > "Privacy" > "Full Disk Access" > click on "+" to add a new tool/app > File-browser window will appear, but it will not show HIDDEN files, so press [Cmd]+[Shift]+[.] 3-buttons together to Show Hidden Files. Browse into /usr/sbin/ folder, find the "pkgutil" binary file, select/open it, and make sure "pkgutil" in list has a tick-mark/check-mark next to it, so it gets full disk access.
  • "Terminal" utility need to be given either full-disk-access Or at-least access to these folders: "Downloads folder", "Removable Volumes" . Once you do something (i.e: run a command like this in Terminal: cmd: echo "1" > ~/Downloads/test.txt ) inside Downloads folder from Terminal, then macOS will ask you if you want to allow Terminal to access Downloads folder, allow that, (a privileged user & user's Password is needed to approve/allow that).
  • open "Terminal" utility (if not yet open), Type in below COMMAND(s):
    cmd: mkdir -p ~/Downloads/tmp/
    cmd: pkgutil --expand "/Volumes/Java for macOS 2017-001/JavaForOSX.pkg" ~/Downloads/tmp/OSXJavaSE6/
    ( if you see error: "Error encountered while creating /Users/<YourUserName>/Downloads/tmp/OSXJavaSE6/. Error 17: File exists" , then delete the "OSXJavaSE6" folder (which is inside the tmp folder which is inside the Downloads folder), and run above pkgutil cmd again )
    cmd: hdiutil unmount "/Volumes/Java for macOS 2017-001/"
    ( output: "/Volumes/Java for macOS 2017-001/" unmounted successfully. )
    cmd: sed -i '' 's/return false/return true/g' ~/Downloads/tmp/OSXJavaSE6/Distribution
    cmd: pkgutil --flatten ~/Downloads/tmp/OSXJavaSE6/ ~/Downloads/tmp/JavaSE6.pkg
  • remove this folder & it's contents: cmd: rm -r ~/Downloads/tmp/OSXJavaSE6
  • double-click/tap on the newly created "JavaSE6.pkg" file, inside the ~/Downloads/tmp/ folder, to run it.
    It should start the Legacy-Java 6 installer, & should install without further errors, (when you provide a privileged user Password again, when macOS asks for it).
    after install, Installer program will ask you, if you want to delete the pkg file, do not delete, Keep it.
    • copy ~/Downloads/tmp/JavaSE6.pkg file into ~/Downloads/ folder, in case later you decide to delete everything inside ~/Downloads/tmp/ folder:
      cmd: cp ~/Downloads/tmp/JavaSE6.pkg ~/Downloads/

Remove full-disk-access permission from "pkgutil" if you will not do any more direct pkg-file modifications : just remove the tick/check mark from "pkgutil" for now, from here: System Preferences > Security & Privacy > Privacy > Full Disk Access.

DONE.

OPTIONAL / EXTRA : Check existing JAVA installations:

cmd: /usr/libexec/java_home -V
output of above cmd may look like below, (in my side it shows below info as those were my existing items when this answer was written):
Matching Java Virtual Machines (4):
14.0.1, x86_64: "OpenJDK 14.0.1" /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
1.7.0_80, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
( in above, the last line of output is showing the default JAVA location/version )

OPTIONAL / EXTRA : Setup Specific Java ENV-VAR (ENVIRONMENT VARIABLE) for specific Java-based App:

Find a solution thats suitable for your need/implementation:

(some Java-based App can find & use specific Java version (if pre-installed), without the need for ENV VARs setup by a shell/bash script, But some Java-based App needs ENV VARs set by shell script)

SETUP/USE SPECIFIC JAVA FOR A SPECIFIC JAVA-BASED APP:
in this way different Java-based App can use different Java . For this, we have to run a script file, & it will setup ENV VARs JAVA_HOME, PATH, etc only for that specific App, before running the app:
cmd: sb='#!/bin/bash' ; echo "$sb" > ~/java-based-APP-name.sh ; unset sb;
edit the shell script file:
cmd: nano ~/java-based-APP-name.sh

  • 1st line must be #!/bin/bash to use it as "BASH" shell script, then add below 5-lines:
    export JAVA_HOME=$(/usr/libexec/java_home --version 1.6);
    export PATH="$JAVA_HOME/bin:$PATH";
    # $JAVA_HOME/bin/java -jar executableJarAppName.jar
    # $JAVA_HOME/bin/java -cp jarAppName.jar <full-path-of-main-class>
    "/Applications/java-based-APP-name.app/Contents/MacOS/java-based-APP-name"
  • Save "~/java-based-APP-name.sh" & exit out from nano . ( Nano )
    ( Note: if a macOS app's name is "My MacApp.app", then it must have an executable file with same name here: "My MacApp.app/Contents/MacOS/My MacApp" . So above example script is using that example executable )
  • set executable permission (attribute bit) for the shell script:
    cmd: chmod +x ~/java-based-APP-name.sh
  • now you can RUN the App by using it's shell script .sh file, so that it can get the specific Java that it needs:
    cmd: ~/java-based-APP-name.sh

Suppose you have a different (java-based) App2 that specifically needs Legacy Java 7 (1.7):

  • obtain Legacy Java 7 (JDK, 1.7) binary (and src) from Oracle site & install it . ( OpenJDK based Legacy Java 7 (1.7) src-code is available in OpenJDK.java.net site, for those, who want to compile it & build their own binary. )
    Copy-paste above "java-based-APP-name.sh" shell-script, & rename copied filename into: "App2.sh", & Edit it: cmd: nano ~/App2.sh , & change line-number 2nd & 6th, as shown below:
    Line#2: export JAVA_HOME=$(/usr/libexec/java_home --version 1.6);
    Line#6: "/Applications/java-based-APP-name.app/Contents/MacOS/java-based-APP-name"
    And change those/above two lines like below:
    export JAVA_HOME=$(/usr/libexec/java_home --version 1.7);
    "/Applications/App2.app/Contents/MacOS/App2"
    Save ~/App2.sh & exit out of nano.
    And set 'execute' bit: cmd: chmod +x ~/App2.sh
    Now you can run it: cmd: ~/App2.sh

EXTRA INFO:
I was trying to run an old macOS app & the latest Jitsi.app.
Jitsi showed message that it needed Legacy-Java 6, but after installing Legacy-Java 6, i received such error:
[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/java/sip/communicator/launcher/SIPCommunicator : Unsupported major.minor version 51.0
So i had to load Java 7 (1.7) for Jitsi (because, error-msg "51.0" points-to Java 7) . Jitsi can auto detect the needed Java version & use it, so no extra bash-script was needed for Jitsi, it ran fine.
For the old macOS app, i had to use Legacy-Java ( Java 6 (1.6) ) & a bash-script (shown above).

atErik
  • 923
  • 2
  • 13
  • 24
1

In my case I simply added to installation (requires a free account) the latest jdk-8u251-macosx-x64.dmg JDK from Oracle and everything turned out fine.

Nicola Gallazzi
  • 7,897
  • 6
  • 45
  • 64