简体   繁体   中英

Desktop launcher for Android Studios can't find JDK but same studio.sh script works in terminal?

I can run my studio.sh script to start Android Studios from the command line just fine. If I use my desktop launcher it says it can't find the JDK! I recently created a .desktop to add in my applications folder to be able to just click on a desktop icon to run this script using:

[Desktop Entry]
Type=Application
Terminal=true
Name=unmount-mount
Icon=/path/to/icon/icon.svg
Exec=/path/to/file/mount-unmount.sh

When I use this new icon with the correct paths added in, I get a No JDK Found error. If I go back to manually running studio.sh from the command line, it starts up just fine. I know the script is running because the error comes directly from it. Is a path different because the launcher is running it? This doesn't make sense. I have checked permissions as well and everything should be fine.

I know this answer comes late for the question. Thing is I have this same issue today 29/9/2015 and I managed to fix it.

The problem is in the Exec property. The command will try to find a value for JAVA_HOME or a variable holding your JDK location.

The fix is to add the following:

Exec=bash -i /path/to/your/studio.sh

So this will execute your .bashrc file first, which will initialize the JDK or JAVA_HOME vars.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM