Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

macos - Android Studio IDE with private jre/jdk? OSX

I'm running OSX 10.8 and was trying to run the Android Studio app bundle using a private jdk rather than one that is globally installed.

EDIT: I don't have any java installation globally accessible.

I have done this successfully in the past with Eclipse by editing the plist.info file and specifying what JRE/JDK I want to use via the eclipse.ini file.

I haven't found the magic on how to do this with Android Studio.

After editing the plist file unsuccessfully I opened a terminal and added the JDK/bin directory to the PATH and set a JAVA_HOME but that wasn't enough for the idea_applauncher to find a Java installation where I had specified.

I'm not sure what else I could try to make this happen. Any ideas?

EDIT: I don't have enough rep to post a screenshot, but below that what the command-line looks like with the output.

When I try to run the bundle I get a pop-up window saying there's no JDK installed and it has two buttons asking me to either "Install" or "Not Now"

$ ./idea_appLauncher

No Java runtime present, requesting install.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Another solution for OSX: go to the Applications folder, right click on Android Studio, choose "Show Package Contents".

Open the Info.plist file. Locate the JVMVersion key, and set the string value you need.

In my case, I needed to be 1.7 and up to be able to run the RoboVM plugin, and the value was 1.6*,1.7+, so I left it only on 1.7+.

Restart Android Studio and it should be using the version of the JVM you need.

This works if you have root access on your Mac.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...