Last active
March 16, 2025 21:11
-
-
Save bric3/1163008 to your computer and use it in GitHub Desktop.
Revisions
-
bric3 revised this gist
Jul 2, 2015 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,14 @@ # _______ _ _ _ _ _ # |__ __| | (_) (_) | | | | # | | | |__ _ ___ ___ ___ _ __ _ _ __ | |_ _ __ ___ _____ _____ __| | # | | | '_ \| / __| / __|/ __| '__| | '_ \| __| | '_ ` _ \ / _ \ \ / / _ \/ _` | # | | | | | | \__ \ \__ \ (__| | | | |_) | |_ | | | | | | (_) \ V / __/ (_| | # |_| |_| |_|_|___/ |___/\___|_| |_| .__/ \__| |_| |_| |_|\___/ \_/ \___|\__,_| # | | # |_| # # New home : https://github.com/bric3/osx-jdk5-installer #!/bin/bash # This script is edited by Brice Dutheil -
bric3 renamed this gist
Feb 17, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
bric3 revised this gist
Feb 11, 2014 . 1 changed file with 90 additions and 59 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,8 @@ # See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2014/02/10 Updated the script to run on OSX 10.9 Maverick # # 2013/05/11 Added a few more guidance when Java Preferences is not available anymore # Added a simple example of a JDK switch function. # @@ -38,23 +40,45 @@ pushd `dirname $0` > /dev/null script_location=`pwd -P` popd > /dev/null # locate Java Preferences in /Applications java_prefs=`mdfind -onlyin /Applications "Java Preferences.app"` declare "osxname_14=OS 11" declare "osxname_13=Mavericks" declare "osxname_12=Mountain Lion" declare "osxname_11=Lion" get_osx_name() { local array="osxname" key=$1 local declare_name="${array}_${key}" printf '%s' "${!declare_name}" } # 13.0.0 = Mavericks = 10.9.0 # 12.1.0 = Mountain Lion = 10.8.1 # 12.0.0 = Mountain Lion = 10.8 # 11.0.0 = Lion = 10.7 darwin_version=`uname -r` osx_version=`sw_vers -productVersion` osx_commercial_name=$(get_osx_name ${darwin_version%.[0-9].[0-9]}) test ${darwin_version/1[2-9]./} != $darwin_version && is_mountain_lion=true # colors and style RESET=`tput sgr0` RED=`tput setaf 1` BLUE=`tput setaf 4` PURPLE=`tput setaf 5` GREEN=`tput setaf 2` YELLOW=`tput setaf 3` UNDERLINED=`tput smul` BOLD=`tput bold` # escape aware echo echo() { builtin echo -e $@; } @@ -72,58 +96,60 @@ fi # Make sure the user understand he is all alone if something goes wrong if [ $is_mountain_lion ]; then echo $BLUE'==>'$RESET' You are using '$BOLD$osx_commercial_name$RESET', the script has been updated to work, however '$osx_commercial_name' kernel works in 64bit. This shouldn'"'"'t be an issue, as event the JDK 6 32bit is working, however 32bit mode doesn'"'"'t work for this hacky install of JDK 5. '$YELLOW'It means that only the 64bit version of the JDK5 will work on your OS.'$RESET echo fi echo $BLUE'==>'$RESET' The present script has been tested on my current setup and is far from bulletproof, it might not work at all on your system. And there is '$RED'*no uninstall script*'$RESET' for now!' echo echo $BLUE'==>'$RESET' Again '$RED'this script touches system files'$RESET', please be advised you are the sole responsible to run or '$BOLD'TO NOT'$RESET' run this script on your machine.' echo # Reminder about Apple JDK updates echo $YELLOW$UNDERLINED'NOTES :'$RESET echo $BLUE'==>'$RESET' Generally speaking it seems that '$YELLOW'applying updates'$RESET' on your system Java, XCode, OSX, etc. might cause problems with your current install, '$RED'reapply this script after any update if you experience issues with your Java 5 install.'$RESET echo $BLUE'==>'$RESET' When '$YELLOW'applying a Java update from Apple'$RESET', some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script.'$RESET echo if [[ -n "$java_prefs" && $is_mountain_lion ]]; then echo $BLUE'==>'$RESET' For people that where upgrading OS X, it seems this scripts fail to open Java Preferences app at the end of the script, with an error like that:' echo $PURPLE'\tLSOpenURLsWithRole() failed with error -10810 for the application /Applications/Utilities/Java Preferences.app.' echo $PURPLE'\tFSPathMakeRef(/Applications/Utilities/Java Preferences.app) failed with error -43.' echo echo $YELLOW' If this is happening, '$RED'you have to (re)install Java 6 !' echo $YELLOW' You can enter these commands yourself in root mode :' echo $YELLOW'\tsudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk' echo '\tsudo rm -rf /System/Library/Java/JavaVirtualMachines' echo '\tjava' echo echo $RESET' This last command will trigger the Java 6 install, then you can run again this script.'$RESET echo fi printf "%s " 'Do you still want to proceed ? (y/n)' read answer [ $answer != 'y' ] && echo 'You'"'"'re fine, JDK5 Hacky Install script has been aborted' && exit 1 echo echo echo $UNDERLINED'Here we go...'$RESET # =================================== echo if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found locally.' echo 'Now trying to download the DMG file from Apple website (http://support.apple.com/kb/DL1359).' echo $javadmgurl' -> '$script_location/$javapkg.dmg echo -n $BLUE @@ -137,7 +163,7 @@ http://support.apple.com/kb/DL1359' exit 1 fi else echo 'Using '$javapkg'.dmg file to install "Java for Mac OS X 10.5 Update 10".' fi @@ -204,7 +230,7 @@ ln -svhF ./$jvmver 1.5 ln -svhF ./$jvmver 1.5.0 echo echo 'Changing values in config files to make JDK work with '$osx_commercial_name cd $jvmver /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist @@ -231,7 +257,7 @@ ln -sivh $java_frmwk_path/$jvmver ./Contents if [ $is_mountain_lion ]; then echo echo $BOLD'REMINDER'$RESET' : You are using '$osx_commercial_name' which is running a '$BOLD'64 bit kernel'$RESET', this causes segfaults when the Java 5 JVM is run in 32 bit mode. For this reason this script removes 32bit mode on this JVM.'$RESET ditto --arch x86_64 $java_frmwk_path/$jvmver $java_frmwk_path/$jvmver-x64 @@ -248,12 +274,9 @@ echo $UNDERLINED'Almost over...'$RESET echo # opening Java Preferences if [ -n "$java_prefs" ]; then # open -a "/Applications/Utilities/Java Preferences.app" echo $BLUE'==> TIP'$YELLOW' : If you are using applications that need Java 6, but some other command line apps that require JDK 5 :' echo ' - keep the "Java SE 6" entry at the top in "Java Preferences"' echo ' - use the Apple "/usr/libexec/java_home" tool, for example to choose the "J2SE 5.0 64-bit" version :' echo $PURPLE'\texport JAVA_HOME=`/usr/libexec/java_home -F -v 1.5 -a x86_64 -d64`'$RESET @@ -264,7 +287,7 @@ try asking the internet :-/' open -a "$java_prefs" else echo $RED'This script could not find the Java Preferences, maybe you moved it elsewhere, or maybe you are running a recent version of MacOSX.'$RESET echo 'In recents MacOSX, Apple decided to remove the Java Preference app, which means you @@ -274,7 +297,7 @@ you can only specify it in the terminal via the $PATH variable.' echo 'Check that /usr/libexec/java_home knows about JDK5, other wise try asking the internet :-/' fi echo '(starting here : '$YELLOW'https://gist.github.com/1163008#comments'$RESET')' echo echo @@ -283,47 +306,55 @@ echo $UNDERLINED'/usr/libexec/java_home says :'$RESET # listing JVMs on local machine echo $(/usr/libexec/java_home -V 2>&1 | sed -E 's,$,\\n,g' | sed -E 's,.*J2SE 5.0.*,\\033[0;33m&\\033[00m,') echo $UNDERLINED'java -version says :'$RESET echo $(/usr/libexec/java_home -F -v 1.5 -a x86_64 --exec java -version 2>&1 | sed -E 's,$,\\n,g' | sed -E 's,java version.*,\\033[0;33m&\\033[00m,') echo echo $UNDERLINED'You can also try the java 5 command yourself'$RESET # ================================================================== # possible commands echo $GREEN'\t/usr/libexec/java_home -F -v 1.5 -a x86_64 --exec java -version'$RESET echo $GREEN'\t`/usr/libexec/java_home -F -v 1.5 -a x86_64`/bin/java -version'$RESET echo echo 'Don'"'"'forget to update the JAVA_HOME accordingly!' echo printf "%s" 'Yeah I got it ! (Press Enter) ' read -s -n 0 key_press echo echo echo echo $BLUE'==> TIP'$RESET' : To switch the JDK version in your shell you can use the great '$BOLD'jenv'$RESET' project ('$YELLOW'https://github.com/gcuisinier/jenv'$RESET'), that can easily switch your JDK version globally or per shell or folder.' echo 'jenv pretty much covers for the terminal what the Java Preference app did, but in much usable way for terminal users.' echo echo 'The old school way would be to change the java runtime with the correct runtime path in $JAVA_HOME and $PATH' echo 'Below is a simple function that you can put in your shell rc (.bashrc, .zshrc, ...) that automates steps to switch the JDK to the wanted version. Adapt it to your needs. It uses the Apple tool : /usr/libexec/java_home' echo # /System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home/bin # /Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/bin echo $GREEN'\tfunction switch_jdk() {' echo '\t\tlocal wanted_java_version=$1' echo '\t\texport JAVA_HOME=`/usr/libexec/java_home -F -v $wanted_java_version -a x86_64 -d64`' echo '\t' echo '\t\t# cleaned PATH' echo '\t\texport PATH=$(echo $PATH | sed -E "s,(/System)?/Library/Java/JavaVirtualMachines/[a-zA-Z0-9._]+/Contents/Home/bin:,,g")' echo '\t' echo '\t\t# prepend wanted JAVA_HOME' echo '\t\texport PATH=$JAVA_HOME/bin:$PATH' echo '\t' echo '\t\techo "Now using : "' echo '\t\tjava -version' echo '\t}'$RESET echo echo 'And just use it this way :' echo $GREEN'\tswitch_jdk 1.5'$RESET echo $GREEN'\tswitch_jdk 1.7.0_45'$RESET echo $GREEN'\tswitch_jdk 1.7.0_51'$RESET -
bric3 revised this gist
May 11, 2013 . 1 changed file with 71 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,9 @@ # See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2013/05/11 Added a few more guidance when Java Preferences is not available anymore # Added a simple example of a JDK switch function. # # 2012/08/25 This script didn't behave correctly when ran on 10.8.1 # Added recommendation to always run this script after updates such as Java, XCode, OSX, etc. # @@ -54,13 +57,13 @@ YELLOW='\033[1;33m' UNDERLINED='\033[4m' # escape aware echo echo() { builtin echo -e $@; } # Make sure only root can run the script if [ $EUID -ne 0 ]; then echo $RED'This script must be run as root in order to install the JDK! If unsure why check the script.'$RESET 1>&2 exit 1 fi @@ -96,13 +99,15 @@ echo echo $BROWN'=> For people that where upgrading OS X, it seems this scripts fail to open Java Preferences at the end of the script, with an error like that:' echo $PURPLE'\tLSOpenURLsWithRole() failed with error -10810 for the application /Applications/Utilities/Java Preferences.app.' echo $PURPLE'\tFSPathMakeRef(/Applications/Utilities/Java Preferences.app) failed with error -43.' echo echo $BROWN' If this is happening, '$RED'you have to (re)install Java 6 !' echo $BROWN' You can enter these commands yourself in root mode :' echo $BROWN'\tsudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk' echo '\tsudo rm -rf /System/Library/Java/JavaVirtualMachines' echo '\tjava' echo echo $BROWN' This last command will trigger the Java 6 install, then you can run again this script.'$RESET echo echo -n 'Do you still want to proceed ? (y/n) ' @@ -113,7 +118,7 @@ echo echo echo $UNDERLINED'Here we go...'$RESET # ================================ echo @@ -158,7 +163,7 @@ rm -rf /tmp/jdk5dmg/ # Prepare the System JVM path if [ ! -e $jvms_path ]; then echo 'Create '$jvms_path', as it does not exist on your system (it might be because you don'"'"' t have another Java install).' mkdir -v -p $jvms_path fi @@ -242,33 +247,85 @@ echo $UNDERLINED'Almost over...'$RESET # ==================================== echo # opening Java Preferences # locate Java Preferences java_prefs=`mdfind -onlyin /Applications "Java Preferences.app"` if [ -d "$java_prefs" ]; then # open -a "/Applications/Utilities/Java Preferences.app" echo $BROWN'TIP : If you are using applications that need Java 6, but some other command line apps that require JDK 5 :' echo ' - keep the "Java SE 6" entry at the top in "Java Preferences"' echo ' - use the Apple "/usr/libexec/java_home" tool, for example to choose the "J2SE 5.0 64-bit" version :' echo $PURPLE'\texport JAVA_HOME=`/usr/libexec/java_home -F -v 1.5 -a x86_64 -d64`'$RESET echo echo 'Now check that JDK 5 appears in Java Preference App, if yes the install is successful, otherwise try asking the internet :-/' open -a "$java_prefs" else echo $RED'This script could find the Java Preferences, maybe you moved it elsewhere, or maybe you are running a recent version of MacOSX.'$RESET echo 'In recents MacOSX, Apple decided to remove the Java Preference app, which means you cannot reorder the JDK Preferences, hence you cannot choose JDK5 as a defaukt JDK for the whole OS, you can only specify it in the terminal via the $PATH variable.' echo echo 'Check that /usr/libexec/java_home knows about JDK5, other wise try asking the internet :-/' fi echo '(starting here : https://gist.github.com/1163008#comments)' echo echo echo $UNDERLINED'/usr/libexec/java_home says :'$RESET # =================================================== # listing JVMs on local machine echo $(/usr/libexec/java_home -V 2>&1 | sed -E 's,$,\\n,g' | sed -E 's,.*J2SE 5.0.*,\\033[0;33m&\\033[00m,') echo echo $UNDERLINED'You can also try the java 5 command yourself'$RESET # ================================================================== # possible commands echo '\t/usr/libexec/java_home -F -v 1.5 -a x86_64 --exec java -version' echo '\t`/usr/libexec/java_home -F -v 1.5 -a x86_64`/bin/java -version' echo echo -n 'Yeah I got it ! (Press Enter)' read -s -n 0 key_press echo echo echo echo $BROWN'TIP : In a terminal change the java runtime with the correct runtime path in $JAVA_HOME and $PATH' echo 'Below is a simple function that you can put in your shell rc (.bashrc, .zshrc, ...) that automates steps to switch the JDK to the wanted version. Adapt it to your needs. It uses the Apple tool : /usr/libexec/java_home' echo # /System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home/bin # /Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home/bin echo '\tfunction switch_jdk() {' echo '\t local wanted_java_version=$1' echo '\t export JAVA_HOME=`/usr/libexec/java_home -F -v $wanted_java_version -a x86_64 -d64`' echo '\t' echo '\t # cleaned PATH' echo '\t export PATH=$(echo $PATH | sed -E "s,(/System)?/Library/Java/JavaVirtualMachines/[a-zA-Z0-9._]+/Contents/Home/bin:,,g")' echo '\t' echo '\t # prepend wanted JAVA_HOME' echo '\t export PATH=$JAVA_HOME/bin:$PATH' echo '\t' echo '\t echo "Now using : "' echo '\t java -version' echo '\t}' echo echo 'And just use it this way :' echo '\tswitch_jdk 1.5' echo '\tswitch_jdk 1.7' echo echo $RESET'.' -
bric3 revised this gist
Sep 7, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash # This script is edited by Brice Dutheil # See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2012/08/25 This script didn't behave correctly when ran on 10.8.1 @@ -272,4 +272,3 @@ echo '\t`/usr/libexec/java_home -F -v 1.5 -a x86_64`/bin/java -version' # opening Java Preferences open -a "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Aug 25, 2012 . 1 changed file with 17 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,9 @@ # See there in french http://blog.arkey.fr/2011/08/22/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2012/08/25 This script didn't behave correctly when ran on 10.8.1 # Added recommendation to always run this script after updates such as Java, XCode, OSX, etc. # # 2O12/07/29 Added Mountain Lion support => Choose the 64bit JVM ! # Can dowload the Java DMG itself if not present in same directory # Colored the output a bit, works well on a black background @@ -33,10 +36,11 @@ script_location=`pwd -P` popd > /dev/null # 12.0.0 = Mountain Lion = 10.8 # 12.1.0 = Mountain Lion = 10.8.1 # 11.0.0 = Lion = 10.7 darwin_version=`uname -r` osx_version=`sw_vers -productVersion` test ${darwin_version/12./} != $darwin_version && is_mountain_lion=true # colors and style @@ -81,7 +85,11 @@ echo # Reminder about Apple JDK updates echo $YELLOW$UNDERLINED'NOTES :'$RESET echo $BROWN'=> Generally speaking it seems that applying updates on your system Java, XCode, OSX, etc. might cause problems with your current install, '$RED'reapply this script after any update if you experience issues with your Java 5 install.'$RESET echo echo $BROWN'=> When applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script.'$RESET echo @@ -255,6 +263,13 @@ echo $UNDERLINED'/usr/libexec/java_home says :'$RESET # listing JVMs on local machine /usr/libexec/java_home -V echo echo $UNDERLINED'You can also try the java 5 command yourself'$RESET # ================================================================== # possible commands echo '\t/usr/libexec/java_home -F -v 1.5 -a x86_64 --exec java -version' echo '\t`/usr/libexec/java_home -F -v 1.5 -a x86_64`/bin/java -version' # opening Java Preferences open -a "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Aug 6, 2012 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -249,5 +249,12 @@ try asking the internet :-/' echo '(starting here : https://gist.github.com/1163008#comments)' echo echo echo $UNDERLINED'/usr/libexec/java_home says :'$RESET # =================================================== # listing JVMs on local machine /usr/libexec/java_home -V # opening Java Preferences open -a "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Jul 30, 2012 . 1 changed file with 50 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,17 +36,20 @@ popd > /dev/null # 11.0.0 = Lion = 10.7 darwin_version=`uname -r` osx_version=`sw_vers -productVersion` test $darwin_version == '12.0.0' && is_mountain_lion=true # colors and style RESET='\033[00m' RED='\033[00;31m' BLUE='\033[0;34m' PURPLE='\033[0;35m' LIGHT_PURPLE='\033[1;35m' BROWN='\033[0;33m' YELLOW='\033[1;33m' UNDERLINED='\033[4m' # escape aware echo echo() { builtin echo -e $@; } @@ -61,7 +64,7 @@ fi # Make sure the user understand he is all alone if something goes wrong if [ $is_mountain_lion ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion kernel works in 64bit. This shouldn'"'"'t be an issue, as the JDK 6 32bit is working, however it actually doesn'"'"'t work for this hacky install of JDK 5. '$RED'It means that only @@ -72,36 +75,47 @@ echo '=> The present script has been tested on my current setup and is far from bulletproof, it might not work at all on your system. And there is '$RED'*no uninstall script*'$RESET' for now!' echo echo '=> Again '$RED'this script touches system files'$RESET', please be advised you are the sole responsible to run or TO NOT run this script on your machine.' echo # Reminder about Apple JDK updates echo $YELLOW$UNDERLINED'NOTES :'$RESET echo $BROWN'=> It seems that when applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script.'$RESET echo echo $BROWN'=> For people that where upgrading OS X, it seems this scripts fail to open Java Preferences at the end of the script, with an error like that:' echo $PURPLE'\tLSOpenURLsWithRole() failed with error -10810 for the application /Applications/Utilities/Java Preferences.app.' echo echo $BROWN'If this is happening, '$RED'you have to (re)install Java 6 !' echo $BROWN'You can enter these commands yourself in root mode :' echo $BROWN'\tsudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk' echo '\tsudo rm -rf /System/Library/Java/JavaVirtualMachines' echo '\tjava' echo $BROWN'This last command will trigger the Java 6 install, then you can run again this script.'$RESET echo echo -n 'Do you still want to proceed ? (y/n) ' read answer [ $answer != 'y' ] && echo 'JDK5 Lion / Mountain Lion Install script aborted' && exit 1 echo echo echo $UNDERLINED'Here we go'$RESET # ================================ echo if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found.' echo 'Now trying to download the DMG file from Apple website (http://support.apple.com/kb/DL1359).' echo $javadmgurl' -> '$script_location/$javapkg.dmg echo -n $BLUE curl -C - -# -L $javadmgurl -o $script_location/$javapkg.dmg echo -n $RESET if [ ! -f $script_location/$javapkg.dmg ]; then echo 'Couldn'"'"'t download the uptate. Please download it from Apple at : @@ -156,10 +170,10 @@ rm -rf $jvmver 2>&1 echo echo $UNDERLINED'Preparing JavaVM framework'$RESET # ================================================ echo echo 'Extracting JDK 1.5.0 from package payload in :' cd $java_frmwk_path pwd @@ -173,11 +187,11 @@ rm -rf /tmp/jdk5pkg/ echo echo 'Recreating symbolic links to ./'"$jvmver"' for 1.5 and 1.5.0 :' pwd ln -svhF ./$jvmver 1.5 ln -svhF ./$jvmver 1.5.0 echo echo 'Changing values in config files to make JDK work with Lion / Mountain Lion' cd $jvmver /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist @@ -189,17 +203,21 @@ echo 'Linking Apple native wrapper' mkdir ./MacOS ln -siv ../Libraries/libjava.jnilib ./MacOS echo echo $UNDERLINED'Preparing Java Virtual Machine'$RESET # ==================================================== cd $jvms_path mkdir -v 1.5.0 cd 1.5.0 pwd ln -sivh $java_frmwk_path/$jvmver ./Contents if [ $is_mountain_lion ]; then echo echo $YELLOW'REMINDER : You are using Mountain Lion which is running a 64 bit kernel, this causes segfaults when the Java 5 JVM is run in 32 bit mode. For this reason this script removes 32bit mode on this JVM.'$RESET @@ -208,8 +226,12 @@ when the Java 5 JVM is run in 32 bit mode. For this reason this script removes 3 mv $java_frmwk_path/$jvmver-x64 $java_frmwk_path/$jvmver fi echo echo $UNDERLINED'Almost over...'$RESET # ==================================== echo echo $BROWN'TIP : If you are using applications that need Java 6, but some other command line apps that require JDK 5 :' @@ -223,7 +245,9 @@ read -s -n 0 key_press echo echo 'Now check that JDK 5 appears in Java Preference App, if yes the install is successful, otherwise try asking the internet :-/' echo '(starting here : https://gist.github.com/1163008#comments)' echo open -a "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Jul 30, 2012 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,11 +77,14 @@ responsible to run or TO NOT run this script on your machine.' echo # Reminder about Apple JDK updates echo $LIGHT_BLUE'NOTE 1: It seems that when applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script.'$RESET echo echo $LIGHT_BLUE'NOTE 2: For people that where upgrading OS X, it seems this scripts fail to open Java Preferences at the end of the script, '$RED'you have to reinstall Java 6'$LIGHT_BLUE' by launching manually a Java application, then you can run this script.'$RESET echo echo -n 'Do you still want to proceed ? (y/n) ' read answer @@ -224,4 +227,3 @@ try asking the internet :/' echo open "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 27 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,22 @@ #!/bin/bash # This script is edited by Brice Dutheil # See there in french http://blog.arkey.fr/2011/08/22/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2O12/07/29 Added Mountain Lion support => Choose the 64bit JVM ! # Can dowload the Java DMG itself if not present in same directory # Colored the output a bit, works well on a black background # Added tips for using the different JVMs # Removed 32bit mode for Mountain Lion (Thanks to Henri Gomez for pointing me to 'ditto') # # 2011/12/04 Added warnings and some more information on gotchas # # 2011/08/25 Updated this very comments # # 2011/08/22 Initial version (Thanks to Benjamin Morin for his blog post) # This script heavily inspired/copied from http://www.s-seven.net/java_15_lion @@ -24,6 +27,7 @@ javadmgurl='http://support.apple.com/downloads/DL1359/en_US/JavaForMacOSX10.5Upd javapkg='JavaForMacOSX10.5Update10' jvmver='1.5.0_30' jvms_path='/System/Library/Java/JavaVirtualMachines' java_frmwk_path='/System/Library/Frameworks/JavaVM.framework/Versions' pushd `dirname $0` > /dev/null script_location=`pwd -P` popd > /dev/null @@ -139,7 +143,7 @@ cd $jvms_path pwd rm -rf 1.5 rm -rf 1.5.0 cd $java_frmwk_path pwd rm 1.5/ > /dev/null 2>&1 || rm -rf 1.5 > /dev/null 2>&1 rm 1.5.0/ > /dev/null 2>&1 || rm -rf 1.5.0 > /dev/null 2>&1 @@ -154,11 +158,11 @@ echo '==========================' echo echo 'Extracting JDK 1.5.0 from package payload in :' cd $java_frmwk_path pwd gzip -cd /tmp/jdk5pkg/$javapkg.pkg/Payload | pax -r -s \ ',.'$java_frmwk_path'/1.5.0,./'$jvmver',' \ '.'$java_frmwk_path'/1.5.0' ls -Fld 1.5* rm -rf /tmp/jdk5pkg/ @@ -183,26 +187,28 @@ mkdir ./MacOS ln -siv ../Libraries/libjava.jnilib ./MacOS echo echo 'Preparing Java Virtual Machine' echo '==============================' cd $jvms_path mkdir -v 1.5.0 cd 1.5.0 pwd ln -sivh $java_frmwk_path/$jvmver ./Contents if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'REMINDER : You are using Mountain Lion which is running a 64 bit kernel, this causes segfaults when the Java 5 JVM is run in 32 bit mode. For this reason this script removes 32bit mode on this JVM.'$RESET ditto --arch x86_64 $java_frmwk_path/$jvmver $java_frmwk_path/$jvmver-x64 rm -rf $java_frmwk_path/$jvmver mv $java_frmwk_path/$jvmver-x64 $java_frmwk_path/$jvmver fi echo echo 'Almost over...' echo echo $BROWN'TIP : If you are using applications that need Java 6, but some other command line apps that require JDK 5 :' echo ' - keep the "Java SE 6" entry at the top in "Java Preferences"' echo ' - use the Apple "/usr/libexec/java_home" tool, for example to choose the "J2SE 5.0 64-bit" version :' -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,7 +60,8 @@ fi if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion kernel works in 64bit. This shouldn'"'"'t be an issue, as the JDK 6 32bit is working, however it actually doesn'"'"'t work for this hacky install of JDK 5. '$RED'It means that only the 64bit version will work on your OS.'$RESET echo fi echo '=> The present script has been tested on my current setup and is far from @@ -78,7 +79,7 @@ values, you can just re-apply this script.'$RESET echo echo -n 'Do you still want to proceed ? (y/n) ' read answer [ $answer != 'y' ] && echo 'JDK5 Lion Install script aborted' && exit 1 echo @@ -91,11 +92,11 @@ echo if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found.' echo 'Now trying to download the DMG file from Apple website in : '$script_location/$javapkg.dmg echo $javadmgurl curl -C - -# -L $javadmgurl -o $script_location/$javapkg.dmg if [ ! -f $script_location/$javapkg.dmg ]; then echo 'Couldn'"'"'t download the uptate. Please download it from Apple at : http://support.apple.com/kb/DL1359' echo 'And place it in the same folder as this script : '$script_location @@ -113,7 +114,7 @@ fi echo echo 'Extracting Java for Mac OS X package' mkdir /tmp/jdk5dmg hdiutil attach -quiet -nobrowse -mountpoint /tmp/jdk5dmg/ $script_location/$javapkg.dmg cd /tmp/jdk5dmg/ # too bad pkgutil nor xar cannot stream package content pkgutil --expand $javapkg.pkg /tmp/jdk5pkg @@ -202,7 +203,7 @@ have to the select the following entry :' echo fi echo $BROWN'TIP : If you are using applications that need Java 6, but some other command line apps that require JDK 5 :' echo ' - keep the "Java SE 6" entry at the top in "Java Preferences"' echo ' - use the Apple "/usr/libexec/java_home" tool, for example to choose the "J2SE 5.0 64-bit" version :' echo $PURPLE'\texport JAVA_HOME=`/usr/libexec/java_home -F -v 1.5 -a x86_64 -d64`'$RESET -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,7 +60,7 @@ fi if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion kernel works in 64bit. This shouldn'"'"'t be an issue, as the JDK 6 32bit is working, however it actually doesn'"'"'t work for this hacky install of JDK 5.'$RED'It means that only the 64bit version will work on your OS.'$RESET echo fi echo '=> The present script has been tested on my current setup and is far from -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,7 +59,7 @@ fi # Make sure the user understand he is all alone if something goes wrong if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion kernel works in 64bit. This shouldn'"'"'t be an issue, as the JDK 6 32bit is working, however it actually doesn't work for this hacky install of JDK 5.'$RED'It means that only the 64bit version will work on your OS.'$RESET echo fi -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,13 +56,11 @@ fi # Make sure the user understand he is all alone if something goes wrong if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion kernel works in 64bit. This shouldn't be an issue, as the JDK 6 32bit is working, however it actually doesn't work for this hacky install of JDK 5.'$RED'It means that only the 64bit version will work on your OS.'$RESET echo fi echo '=> The present script has been tested on my current setup and is far from -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 137 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,68 +5,150 @@ # This script is edited by Brice Dutheil # See there in french http://blog.arkey.fr/2011/08/22/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # # 2O12/07/29 Added Moutain Lion support => Choose the 64bit JVM ! # Can dowload the Java DMG itself if not present in same directory # Colored the output a bit, works well on a black background # Added tips for using the different JVMs # 2011/12/04 Added warnings and some more information on gotchas # 2011/08/25 link to blog post # 2011/08/22 initial version # #some variables javadmgurl='http://support.apple.com/downloads/DL1359/en_US/JavaForMacOSX10.5Update10.dmg' javapkg='JavaForMacOSX10.5Update10' jvmver='1.5.0_30' jvms_path='/System/Library/Java/JavaVirtualMachines' pushd `dirname $0` > /dev/null script_location=`pwd -P` popd > /dev/null # 12.0.0 = Mountain Lion = 10.8 # 11.0.0 = Lion = 10.7 darwin_version=`uname -r` osx_version=`sw_vers -productVersion` # colors RESET='\033[00m' RED='\033[00;31m' BLUE='\033[0;34m' PURPLE='\033[0;35m' LIGHT_PURPLE='\033[1;35m' BROWN='\033[0;33m' YELLOW='\033[1;33m' # colored echo echo() { builtin echo -e $@; } # Make sure only root can run the script if [ $EUID -ne 0 ]; then echo $RED'This script must be run as root!'$RESET 1>&2 exit 1 fi # Make sure the user understand he is all alone if something goes wrong if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'=> You are using Mountain Lion, the script has been updated to work, however Mountain Lion is 64bits only! It means of course that only the 64bit version will work on your OS.'$RESET echo fi echo '=> The present script has been tested on my current setup and is far from bulletproof, it might not work at all on your system. And there is '$RED'*no uninstall script*'$RESET' for now!' echo echo '=> Again this script touches system files, please be advised you are the sole responsible to run or TO NOT run this script on your machine.' echo # Reminder about Apple JDK updates echo $LIGHT_BLUE'NOTE : It seems that when applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script.'$RESET echo echo -n 'Do you still want to proceed ? (y/n)\ ' read answer [ $answer != 'y' ] && echo 'JDK5 Lion Install script aborted' && exit 1 echo # Here we go if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found.' echo 'Now trying to download the DMG file from Apple website :' echo $javadmgurl curl -# -L $javadmgurl -o $javapkg.dmg if [ ! -f $javapkg.dmg ]; then echo 'Couldn'"'"'t download the uptate. Please download it from Apple at : http://support.apple.com/kb/DL1359' echo 'And place it in the same folder as this script : '$script_location exit 1 fi else echo 'Using '$javapkg'.dmg file as the "Java for Mac OS X 10.5 Update 10".' fi # Extracting the DMG content in temporary location echo echo 'Extracting Java for Mac OS X package' mkdir /tmp/jdk5dmg hdiutil attach -quiet -nobrowse -mountpoint /tmp/jdk5dmg/ $javapkg.dmg cd /tmp/jdk5dmg/ # too bad pkgutil nor xar cannot stream package content pkgutil --expand $javapkg.pkg /tmp/jdk5pkg cd .. hdiutil detach -quiet -force /tmp/jdk5dmg/ rm -rf /tmp/jdk5dmg/ # Prepare the System JVM path if [ ! -e $jvms_path ]; then echo 'Create '$jvms_path', as it does not exist on your system (it might be because you don'"'"' t have another Java install)' mkdir -v -p $jvms_path fi echo echo 'Removing previous Java 1.5 file / directory or symbolic links in :' cd $jvms_path pwd rm -rf 1.5 rm -rf 1.5.0 cd /System/Library/Frameworks/JavaVM.framework/Versions pwd rm 1.5/ > /dev/null 2>&1 || rm -rf 1.5 > /dev/null 2>&1 rm 1.5.0/ > /dev/null 2>&1 || rm -rf 1.5.0 > /dev/null 2>&1 rm -rf $jvmver 2>&1 echo echo 'Preparing JavaVM framework' echo '==========================' @@ -75,7 +157,9 @@ echo echo 'Extracting JDK 1.5.0 from package payload in :' cd /System/Library/Frameworks/JavaVM.framework/Versions pwd gzip -cd /tmp/jdk5pkg/$javapkg.pkg/Payload | pax -r -s \ ',./System/Library/Frameworks/JavaVM.framework/Versions/1.5.0,./'"$jvmver"',' \ './System/Library/Frameworks/JavaVM.framework/Versions/1.5.0' ls -Fld 1.5* rm -rf /tmp/jdk5pkg/ @@ -90,24 +174,49 @@ echo echo 'Changing values in config files to make JDK work with Lion' cd $jvmver /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion "$osx_version".*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Add :CFBundleExecutable string libjava.jnilib" ./Resources/Info.plist ln -siv ./Resources/Info.plist . echo echo 'Linking Apple native wrapper' mkdir ./MacOS ln -siv ../Libraries/libjava.jnilib ./MacOS echo echo 'Preparing Java Virtual Machines' echo '===============================' cd $jvms_path mkdir -v 1.5.0 cd 1.5.0 pwd ln -sivh /System/Library/Frameworks/JavaVM.framework/Versions/$jvmver ./Contents echo echo 'Almost over...' echo if [ $darwin_version == '12.0.0' ]; then echo $YELLOW'REMINDER : You are using Mountain Lion which is 64 bit only, at this point you have to the select the following entry :' echo $PURPLE'\t"J2SE 5.0\t64-bit"'$YELLOW echo 'in Java Preferences, otherwise you will experience segfaults error with the 32-bit version.'$RESET echo fi echo $BROWN'TIP : If you are using applications that need Java 6 :' echo ' - keep the "Java SE 6" entry at the top in "Java Preferences"' echo ' - use the Apple "/usr/libexec/java_home" tool, for example to choose the "J2SE 5.0 64-bit" version :' echo $PURPLE'\texport JAVA_HOME=`/usr/libexec/java_home -F -v 1.5 -a x86_64 -d64`'$RESET echo echo -n 'Yeah I got it ! (Press Enter)' read -s -n 0 key_press echo echo 'Now check that JDK 5 appears in Java Preference App, if yes the install is successful, otherwise try asking the internet :/' echo open "/Applications/Utilities/Java Preferences.app" -
bric3 revised this gist
Jul 29, 2012 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,8 +15,13 @@ fi # Make sure the user understand he is all alone if something goes wrong echo 'The present script has been tested on my current setup, and far from bulletproof, it might not work at all on your system. And there is *no uninstall script* for now!' echo 'Again this script touches system files, please be advised you are the sole responsible to run or TO NOT run this script on your machine.' if [ `uname -r` == '12.0.0' ]; then echo 'You are using Mountain Lion, this script is not yet ready for it. Reported problems : some paths are missing, Java Preferences do not show Java 1.5, maybe some other issues as well.' fi echo -n 'Do you still want to proceed ? (y/n) ' read answer [ $answer != 'y' ] && echo 'JDK5 Lion Install script aborted' && exit 1 @@ -35,7 +40,8 @@ jvmver='1.5.0_30' if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found. Please download it from Apple at : http://support.apple.com/kb/DL1359 And put it in the same folder as this script' fi echo -
bric3 revised this gist
Dec 4, 2011 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,9 +23,10 @@ read answer # Reminder about Apple JDK updates echo 'NOTE : It seems that when applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script. ' #some variables javapkg='JavaForMacOSX10.5Update10' -
bric3 revised this gist
Dec 4, 2011 . 1 changed file with 14 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ #!/bin/bash # By the way this script heavily inspired/copied from http://www.s-seven.net/java_15_lion # # This script is edited by Brice Dutheil # See there in french http://blog.arkey.fr/2011/08/22/script-pour-installer-le-jdk-5-sur-macosx-lion/ # Translate button is broken for now, please use Google to translate this website. # Make sure only root can run the script if [ $EUID -ne 0 ]; then @@ -13,13 +14,19 @@ fi # Make sure the user understand he is all alone if something goes wrong echo 'The present script has been tested on my current setup, and far from bulletproof, it might not work at all on your system. And there is *no uninstall script* for now!' echo 'Again this scripts touches system files, please be advised you are the sole responsible to run or TO NOT run this script on your machine.' echo -n 'Do you still want to proceed ? (y/n) ' read answer [ $answer != 'y' ] && echo 'JDK5 Lion Install script aborted' && exit 1 # Reminder about Apple JDK updates echo 'It seems that when applying a Java update from Apple, some important symbolic names that refer to this install are resetted to factory default values, you can just re-apply this script. #some variables javapkg='JavaForMacOSX10.5Update10' jvmver='1.5.0_30' @@ -55,7 +62,7 @@ rm -rf $jvmver 2>&1 echo echo 'Preparing JavaVM framework' echo '==========================' echo echo 'Extracting JDK 1.5.0 from package payload in :' -
bric3 revised this gist
Aug 25, 2011 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ # By the way this script heavily inspired/copied from http://www.s-seven.net/java_15_lion # script edited by Brice Dutheil # see there in french http://blog.arkey.fr/2011/08/22/script-pour-installer-le-jdk-5-sur-macosx-lion/ # (there's a translate button) # Make sure only root can run the script if [ $EUID -ne 0 ]; then -
bric3 created this gist
Aug 22, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,97 @@ #!/bin/bash # By the way this script heavily inspired/copied from http://www.s-seven.net/java_15_lion # script edited by Brice Dutheil # Make sure only root can run the script if [ $EUID -ne 0 ]; then echo "This script must be run as root" 1>&2 exit 1 fi # Make sure the user understand he is all alone if something goes wrong echo 'The present script has been tested on my current setup, and far from bulletproof, it might not work at all on your system. No uninstall script for now!' echo 'Again this scripts touches system files, please be advised you are the sole responsible to run or TO NOT run this script on your machine.' echo -n 'Proceed ? (y/n)' read answer [ $answer != 'y' ] && echo 'JDK5 Lion Install script aborted' && exit 1 #some variables javapkg='JavaForMacOSX10.5Update10' jvmver='1.5.0_30' if [ ! -f $javapkg.dmg ]; then echo 'The "Java for Mac OS X 10.5 Update 10" DMG ('"$javapkg.dmg"') was not found. Please download it from Apple at : http://support.apple.com/kb/DL1359' fi echo echo 'Extracting Java for Mac OS X package' mkdir /tmp/jdk5dmg hdiutil attach -quiet -nobrowse -mountpoint /tmp/jdk5dmg/ $javapkg.dmg cd /tmp/jdk5dmg/ # too bad pkgutil nor xar can stream package content pkgutil --expand $javapkg.pkg /tmp/jdk5pkg cd .. hdiutil detach -quiet -force /tmp/jdk5dmg/ rm -rf /tmp/jdk5dmg/ echo echo 'Removing previous Java 1.5 file / directory or symbolic links in :' cd /System/Library/Java/JavaVirtualMachines pwd rm -rf 1.5.0 cd /System/Library/Frameworks/JavaVM.framework/Versions pwd rm 1.5/ > /dev/null 2>&1 || rm -rf 1.5 > /dev/null 2>&1 rm 1.5.0/ > /dev/null 2>&1 || rm -rf 1.5.0 > /dev/null 2>&1 rm -rf $jvmver 2>&1 echo echo 'Preparing JavaVM framework' echo '========================' echo echo 'Extracting JDK 1.5.0 from package payload in :' cd /System/Library/Frameworks/JavaVM.framework/Versions pwd gzip -cd /tmp/jdk5pkg/JavaForMacOSX10.5Update10.pkg/Payload | pax -r -s ',./System/Library/Frameworks/JavaVM.framework/Versions/1.5.0,./'"$jvmver"',' './System/Library/Frameworks/JavaVM.framework/Versions/1.5.0' ls -Fld 1.5* rm -rf /tmp/jdk5pkg/ echo echo 'Recreating symbolic links to ./'"$jvmver"' for 1.5 and 1.5.0 :' pwd ln -sivh ./$jvmver 1.5 ln -sivh ./$jvmver 1.5.0 echo echo 'Changing values in config files to make JDK work with Lion' cd $jvmver /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumFrameworkVersion 14.*.*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Set :JavaVM:JVMMaximumSystemVersion 10.7.*" ./Resources/Info.plist /usr/libexec/PlistBuddy -c "Add :CFBundleExecutable string libjava.jnilib" ./Resources/Info.plist ln -siv ./Resources/Info.plist . echo echo 'Preparing native wraping' mkdir ./MacOS ln -siv ../Libraries/libjava.jnilib ./MacOS echo echo 'Preparing Java Virtual Machines' echo '===============================' cd /System/Library/Java/JavaVirtualMachines mkdir -v 1.5.0 cd 1.5.0 pwd ln -sivh /System/Library/Frameworks/JavaVM.framework/Versions/$jvmver ./Contents echo echo 'And finally check that JDK 5 appears in Java Preference App' open "/Applications/Utilities/Java Preferences.app"