JDK path for Android Studio on Linux

為{幸葍}努か 提交于 2021-01-28 08:39:48

问题


I am running Manjaro 17.0.1

I have an issue running android studio.

When I run ./studio.sh I have:

  • A graphical error message from Android Studio saying

No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation

  • A console error message

    which: no java in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
    /usr/bin/dirname: missing operand
    Try '/usr/bin/dirname --help' for more information.
    /usr/bin/dirname: missing operand
    Try '/usr/bin/dirname --help' for more information.
    Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

-------------------------------------------------------------------

I have a directory named /Android in which I have both android studio installation directory and jdk1.8.0_151 directory. I then set JAVA_HOME to point to the jdk directory (/home/myuser/android/jdk1.8.0_151).

I tried to run again android studio and now i get another error message saying

./studio.sh: line 207: /home/joub/android/jdk1.8.0_151/bin/java: cannot execute binary file: Exec format error

EDIT

I can not put the jdk directory into /usr/java because i do not have any free space on my disk. This is why I created a new partition and mounted it to /android so I can install both android-studio and JDK inside that directory.


回答1:


Try putting your JDK directory here

/home/myuser/android/jdk1.8.0_151

then set your JAVA_HOME to /home/myuser/android/jdk1.8.0_151

Now try

$ which java

and

$ java -version

You should have something now.

And try running studio.sh again



来源:https://stackoverflow.com/questions/47831422/jdk-path-for-android-studio-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!