詳細
openSUSE(Linux)で、EclipseでAntビルドした際に、 以下の内容のエラーが表示される
エラー内容
java.lang.NoClassDefFoundError: gnu/classpath/Configuration
原因
JDKが、OracleのSDKではなく、OpenJDKでビルドしていたため
解決策
1) 「java -version」を入力し、OpenJDKがインストールされているか確認する => 「... openjdk ...」と表示されたら、ほぼ間違いなく、原因はOpenJDKでビルドしていたため? 2) ターミナルを起動し、以下のコマンドを入力する sudo update-alternatives --config java sudo update-alternatives --display java => 「... openjdk ...」と表示されたら、openjdkが優先されている状態? sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_05/bin/java" 1 sudo update-alternatives --config java => 入力すると以下のように表示されるので、インストールしたJDKの番号(この例だと「2」)しEnterキー押下 ~~~~~ There are 3 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------------- * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode 2 /usr/java/jdk1.8.0_05/bin/java 1 manual mode Press enter to keep the current choice[*], or type selection number: ~~~~~ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_05/bin/javac" 1 sudo update-alternatives --config javac => 同様に入力する 3) 念のため、「java -version」を入力し、OracleJDKがインストールされているか確認する 詳細は、以下の関連記事を参照のこと。http://blogs.yahoo.co.jp/dk521123/33684436.html
参考文献
* 原因判明のヒントになったサイトhttp://mail-archives.apache.org/mod_mbox/ant-user/201003.mbox/%3C6c81069d1003080123g6d812970n2f698c08a836ecb4@mail.gmail.com%3E
より抜粋 Thanks Antonie. Yes that was the issue. I had uninstalled gcj from my system and it worked fine :). But apparently my JAVA_HOME was fine even before. Looks like ant had picked up the gnu jdk path from somewhere else. ・・・略・・・ > > Are you using a GNU JDK ? > > You might want to use a Sun JDK. Ant uses normally the JDK pointed to by > the environment variable JAVA_HOME. > > It is possible that there is a bug or limitation of ant and that ant does > not work with the GNU JDK.* 解決策のヒントになったサイト
http://astah.change-vision.com/ja/feature/install-linux-debian.html