のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

GingerBreadビルドでエラー

(You are attempting to build with the incorrect version of java.)

ubuntujavaの環境を切り替える。
update-alternative

 $ make
 Checking build tools versions...
  ************************************************************
 You are attempting to build with the incorrect version
of java.
 
 Your version is: java version "1.5.0_19". <===JAVA
 The correct version is: 1.6.
 
 Please follow the machine setup instructions at
    http://source.android.com/download
  ************************************************************
 build/core/main.mk:129: *** stop.  中止.
 $
sudoが必要
 $ sudo update-alternatives --config java
 There are 2 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                      優  Status
  ----------------------------------------------------------
  0            /usr/lib/jvm/java-6-sun/jre/bin/java       63 auto mode
 *1            /usr/lib/jvm/java-1.5.0-sun/jre/bin/java   53 manual mode
  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63 manual mode

 Press enter to keep the current choice[*], or type selection number: 0
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java to provide /usr/bin/java (java) in auto mode.
>>
 sudoがないとき:以下のようにでる。
 update-alternatives: error: /etc/alternatives/java.dpkg-tmp から /usr/lib/jvm/java-6-sun/jre/bin/java へのシンボリックリンクを作成できません: Permission denied
<<

0を選んだ。

 $ make
 ************************************************************
 You are attempting to build with the incorrect version
of javac.
 
 Your version is: javac 1.5.0_19. <===JAVAC
 The correct version is: 1.6.
 
 Please follow the machine setup instructions at
   http://source.android.com/download
 ************************************************************
 build/core/main.mk:145: *** stop.  中止.
 $ sudo update-alternatives --config javac
 There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                   優        Status
  ------------------------------------------------------------
   0            /usr/lib/jvm/java-6-sun/bin/javac       63        auto mode
 * 1            /usr/lib/jvm/java-1.5.0-sun/bin/javac   53        manual mode
   2            /usr/lib/jvm/java-6-sun/bin/javac       63        manual mode

 Press enter to keep the current choice[*], or type selection number: 0

0を選んだ。

28.3. update-alternatives コマンドの使い方