eclipse デバッグでエラー

eclipseをインストして使い方のお勉強としてまずはデバッグ。

テストした際は問題なかったのにデバッグするとエラーがでてきた。

ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]

JREの設定とか色々とあるみたいだけど、私の場合はインストした際に「HellowWorld」の出力プログラムをコピペしたんだけどそこに「System.exit(0);」を追加でOK。

最初はこんな感じ。

  1. package hoge.hoge.com;
  2.  
  3. public class HellowWorld {
  4.  
  5.  /**
  6.   * @param args
  7.   */
  8.  public static void main(String[] args) {
  9.   // TODO 自動生成されたメソッド・スタブ
  10.   System.out.println("Hellow Java World!");
  11.  }
  12.  
  13. }

修正したものは下記のような感じ。

  1. package hoge.hoge.com;
  2.  
  3. public class HellowWorld {
  4.  
  5.  /**
  6.   * @param args
  7.   */
  8.  public static void main(String[] args) {
  9.   // TODO 自動生成されたメソッド・スタブ
  10.   System.out.println("Hellow Java World!");
  11.   System.exit(0);
  12.  }
  13.  
  14. }

参考にしたサイトにも書いてるけど2回目以降は「System.exit(0);」がなくてもよさげ。他の新規プロジェクトのときが大丈夫かは不明。

■情報元:はなとゆめ – JDK1.6で妙なエラー

2011/03/14 カテゴリ: eclipse Comment?

Related posts

コメントは受け付けていません。