Open Java applications fail silently on OS X Mavericks

后端 未结 5 487
梦谈多话
梦谈多话 2020-12-06 05:04

When opening Intelli J or Android Studio after the Mavericks update nothing happens, fails silently.

Java and javac all work from the command line.

Opening

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 05:57

    This is due to android studio/intellij is still using the old "JavaLaunching" framework which has deprecated with Java 7. Either you install an End-Of-Life version of JDK 6, or request Android Studio to upgrade to use oracle's JDK appbundle.

    I really hate to install a JAVA 6 so I'll have two JDKs on my machine. so I hacked the Android studio files such that they can be launched from the dock:

    1. Change the studio (in /Applications/Android Studio.app/Contents/MacOS) file from a JavaLauncher stub to a shell script, here's how it look like:
    #!/bin/bash
    export JAVA_HOME=`/usr/libexec/java_home`
    echo JAVA_HOME=$JAVA_HOME
    export APP_PACKAGE='/Applications/Android Studio.app'
    exec $JAVA_HOME/bin/java -cp $JAVA_HOME/lib/tools.jar:"$APP_PACKAGE"/lib/bootstrap.jar:"$APP_PACKAGE"/lib/extensions.jar:"$APP_PACKAGE"/lib/util.jar:"$APP_PACKAGE"/lib/jdom.jar:"$APP_PACKAGE"/lib/log4j.jar:"$APP_PACKAGE"/lib/trove4j.jar:"$APP_PACKAGE"/lib/jna.jar -Didea.platform.prefix=AndroidStudio -Didea.paths.selector=AndroidStudioPreview -Dfile.encoding=UTF-8 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:"$APP_PACKAGE"/lib/boot.jar -XX:MaxPermSize=256m -Xdock:icon="$APP_PACKAGE"/Contents/Resources/AndroidStudio.icns com.intellij.idea.Main
    

    make sure to chmod +x ./studio to it.

    1. Remove the java section in the Info.plist file in the /Applications/Android Studio.app/Contents directory. Otherwise, Apple will still ask you to install JDK 6: edit the file and remove the whole java section. The diff will look like: http://pastebin.com/QS8M45cr

提交回复
热议问题