偶遇奇怪的JVM报错:JVMTI_ERROR_WRONG_PHASE(112)

写了一个很简单的类,代码如下,接着就做简单的测试。

public class Die {
	private int mCurrentPoint;

	public Die() {
		mCurrentPoint = getRandom();
	}

	public int roll() {
		int p = getRandom();
		setCurrentPoint(p);
		return p;
	}

	public int getCurrentPoint() {
		return this.mCurrentPoint;
	}

	private void setCurrentPoint(int p) {
		this.mCurrentPoint = p;
	}

	private int getRandom() {
		int r = (int) (Math.random() * 10) + 1;
		if (r > 6) {
			r -= 6;
		}
		return r;
	}

	public static void main(String args[]) {
		Die d = new Die();
		System.out.println(d.getCurrentPoint());
		d.roll();
		System.out.println(d.getCurrentPoint());

	}

}

在Eclipse下,按F11,运行Main方法进行测试。按了大概六七次那样,突然报出来一个这样的错误。

6
2
FATAL ERROR in native method: JDWP on checking for an interface, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATIONJDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on checking for an interface [../../../src/share/back/util.c:1311]

用的是JDK1.7,没加其它运行参数。再看一下代码,好像也没什么问题啊。

于是继续测试,这一次,连续按F11十几次,也没发现再出现那个错误。又长见识了。。。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值