package example;public class exceptionthrow {
public static void main(String args[])
{
int a=4,b=0;
try
{
if(b==0)
{
throw new ArithmeticException();
}
else
{
System.out.println(a+"/"+b+"="+a/b);
}
}
catch(ArithmeticException w)
{
System.out.println(w+"throwed");
}
}}
但是eclipse却显示:
java.lang.NoSuchMethodError: main
Exception in thread "main" 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]
public static void main(String args[])
{
int a=4,b=0;
try
{
if(b==0)
{
throw new ArithmeticException();
}
else
{
System.out.println(a+"/"+b+"="+a/b);
}
}
catch(ArithmeticException w)
{
System.out.println(w+"throwed");
}
}}
但是eclipse却显示:
java.lang.NoSuchMethodError: main
Exception in thread "main" 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]
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820] 重新装个试下
没有问题啊,而且这个书里面的类名首写是小写·晕倒·
java.lang.ArithmeticExceptionthrowed