android studio 135.1339820在openSuse 12.3上启动了错误的java版本

时间:2014-10-13 18:05:00

标签: java android

我正在运行openSuse 12.3并安装了Java 7兼容版本:

user@machine:~/saug/android-studio/bin$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

然而,当我启动android studio 135.1339820时,它会启动java 1.5.0,因此会失败:

user@machine:~/saug/android-studio/bin$ ./studio.sh 
java version "1.5.0"
gij (GNU libgcj) version 4.7.2 20130108 [gcc-4_7-branch revision 195012]

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Exception in thread "main" java.lang.NoClassDefFoundError: javax.swing.UIManager
   at java.lang.Class.initializeClass(libgcj.so.13)
   at javax.swing.UIManager.getUI(libgcj.so.13)
   at javax.swing.text.JTextComponent.updateUI(libgcj.so.13)
   at javax.swing.text.JTextComponent.<init>(libgcj.so.13)
   at javax.swing.JEditorPane.<init>(libgcj.so.13)
   at javax.swing.JTextPane.<init>(libgcj.so.13)
   at com.intellij.idea.Main.showMessage(Main.java:237)
   at com.intellij.idea.Main.showMessage(Main.java:224)
   at com.intellij.idea.Main.main(Main.java:87)

有没有办法指定使用哪个java版本(或路径)? 感谢

1 个答案:

答案 0 :(得分:0)

我通过在studio.sh中添加此行来解决此问题 &#34; JDK_HOME =的/ usr /爪哇/最新&#34;

 #!/bin/sh
 #
 # ---------------------------------------------------------------------
 # Android Studio startup script.
 # ---------------------------------------------------------------------
 #

 JDK_HOME=/usr/java/latest
 ...

你应该替换&#34; / usr / java / latest&#34;如果不在这里,请使用您的Java位置。