当前位置: 技术问答>java相关
java.lang.NoClassDefFoundError:MathOps ???????
来源: 互联网 发布时间:2015-10-28
本文导语: 编译时没有问题,但运行时出现错误: java.lang.NoClassDefFoundError: MathOps Exception in thread "main" Normal Termination 请大虾指点!多谢了 //MathOps源码 import java.util.*; public class MathOps { static void prt(String s) { ...
编译时没有问题,但运行时出现错误:
java.lang.NoClassDefFoundError: MathOps
Exception in thread "main" Normal Termination
请大虾指点!多谢了
//MathOps源码
import java.util.*;
public class MathOps {
static void prt(String s) {
System.out.println(s);
}
static void pInt(String s, int i) {
prt(s + " = " + i);
}
static void pFlt(String s, float f) {
prt(s + " = " + f);
}
public static void main(String[] args) {
Random rand = new Random();
int i, j, k;
j = rand.nextInt() % 100;
k = rand.nextInt() % 100;
pInt("j",j); pInt("k",k);
i = j + k; pInt("j + k", i);
i = j - k; pInt("j - k", i);
i = k / j; pInt("k / j", i);
i = k * j; pInt("k * j", i);
i = k % j; pInt("k % j", i);
j %= k; pInt("j %= k", j);
float u,v,w;
v = rand.nextFloat();
w = rand.nextFloat();
pFlt("v", v); pFlt("w", w);
u = v + w; pFlt("v + w", u);
u = v - w; pFlt("v - w", u);
u = v * w; pFlt("v * w", u);
u = v / w; pFlt("v / w", u);
u += v; pFlt("u += v", u);
u -= v; pFlt("u -= v", u);
u *= v; pFlt("u *= v", u);
u /= v; pFlt("u /= v", u);
}
}
编译时没有问题,但运行时出现错误:
java.lang.NoClassDefFoundError: MathOps
Exception in thread "main" Normal Termination
请大虾指点!多谢了
java.lang.NoClassDefFoundError: MathOps
Exception in thread "main" Normal Termination
请大虾指点!多谢了
//MathOps源码
import java.util.*;
public class MathOps {
static void prt(String s) {
System.out.println(s);
}
static void pInt(String s, int i) {
prt(s + " = " + i);
}
static void pFlt(String s, float f) {
prt(s + " = " + f);
}
public static void main(String[] args) {
Random rand = new Random();
int i, j, k;
j = rand.nextInt() % 100;
k = rand.nextInt() % 100;
pInt("j",j); pInt("k",k);
i = j + k; pInt("j + k", i);
i = j - k; pInt("j - k", i);
i = k / j; pInt("k / j", i);
i = k * j; pInt("k * j", i);
i = k % j; pInt("k % j", i);
j %= k; pInt("j %= k", j);
float u,v,w;
v = rand.nextFloat();
w = rand.nextFloat();
pFlt("v", v); pFlt("w", w);
u = v + w; pFlt("v + w", u);
u = v - w; pFlt("v - w", u);
u = v * w; pFlt("v * w", u);
u = v / w; pFlt("v / w", u);
u += v; pFlt("u += v", u);
u -= v; pFlt("u -= v", u);
u *= v; pFlt("u *= v", u);
u /= v; pFlt("u /= v", u);
}
}
编译时没有问题,但运行时出现错误:
java.lang.NoClassDefFoundError: MathOps
Exception in thread "main" Normal Termination
请大虾指点!多谢了
|
java -cp . MathOps
具体原因参见其它帖子,设置classpath包含 .
具体原因参见其它帖子,设置classpath包含 .