UbuntuにJDKとNetBeansを入れる

結果

なんとか出来たが,NetBeans起動中に吐くメッセージが気になる.助けてくれ.無視しても害は無い.

JDK

http://www.hrtdotnet.jp/linux/java.htmlを頼りにする.Oracle Technology Network for Java Developers | Oracle Technology Network | OracleからJDK 6 Update 7を入手する. rpm でなく,単なる bin を選ぶ.

sudo sh jdk-6u7-linux-i586.bin

ライセンスに y と答えると(ライセンス全文表示は q で省略できる)展開が始まる.最後に Enter を求められ,終了する.そして勝手にWebページが開かれる.

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Sun products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the Sun Product Registration form for 
the JDK will be presented. If you do not register, none of
this information will be saved. You may also register your
JDK later by opening the register.html file (located in 
the JDK installation directory) in a browser.

For more information on what data Registration collects and 
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

 
Done.

カレントディレクトリにディレクトリ jdk1.6.0_07 ができあがる.mv して,/etc/profile /etc/profile.d/javaenv.sh を編集して source する.

sudo mv jdk1.6.0_07 /usr/local/jdk1.6
sudo vi /etc/profile
source /etc/profile

/etc/profile /etc/profile.d/javaenv.sh への追記内容はこんなもん.

export PATH=/usr/local/jdk1.6/bin:$PATH # Javaコマンドのパスを追加
export JAVA_HOME=/usr/local/jdk1.6 # Javaのインストールディレクト

記述先を修正したのはUbuntu起動時のコマンド自動実行 - BiBoLoGにて詳しく述べている.これに伴い,source する事はなく,単に sh を実行すれば良い事となる.

NetBeans

http://blogs.sun.com/katakai/entry/install_netbeans_6_1_onからインストールの雰囲気を感じ取る.NetBeans NetBeans 日本語サイトからNetBeansを入手する.

NetBeans 6.1 Linux インストーラ/日本語 (ja)
netbeans-6.1-ml-linux.sh (213.7 MB)
MD5: 13b70308f3b3c47912933a2894a79415

$ sh netbeans-6.1-ml-linux.sh 

インストーラが起動する.次へ次へと進めると,全部入りの設定で ~/netbeans-6.1 にインストールされる./opt に入れるのが普通?Linuxの文化ヨクワカリマセン.次回は /opt に入れてやろうかと思う.さてこの間,端末には不安をあおる文字が並んだ.

$ sh netbeans-6.1-ml-linux.sh 
インストーラを構成しています...
システムで JVM を検索しています...
インストールデータを抽出しています...
インストーラウィザードを実行中...

(:13851): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)

(:13851): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

(:13851): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed

そして完了した.実行してみると,確かにGUIがでた.メニューから終了を選んでみた.端末を確認すると,不安をあおるメッセージが残っていた.

~/netbeans-6.1/bin$ ./netbeans

(:20734): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)

(:20734): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
NetBeans 仕上げ

上記の捕捉です。
「日本語表示が□になる」ことの対処の方法を以下に示します。
おそらく、netbeansをインストールされると/opt以下にインストールされる方が多いと思うので、以下のような対応方法があります。
以下、コマンドです。
※以下のコマンドはjdk-6u2-nb-5_5_1-linux-ml.binをインストールした場合の対応です。

#cd /opt/jdk1.6.0_02/jre/lib/fonts
#mkdir fallback
#cd fallback
#cp /usr/share/fonts/truetype/ipa/ipa* .
#mkfontscale
#mkfontdir

コマンドの4行めの最後の"."(ピリオド)に注意してください。
以上です。

Ubuntu日本語フォーラム / java開発環境

という情報がある.確かに日本語部分が四角になっていた.だから次のコマンドを実行する.

cd /usr/local/jdk1.6/jre/lib/fonts/
sudo mkdir fallback
cd fallback
sudo cp /usr/share/fonts/truetype/ipamona/ipa* .
sudo mkfontscale
sudo mkfontdir

これで期待通りの表示が得られた.