Topic: 为什么老是提示线程错??!!

  Print this page

1.为什么老是提示线程错??!! Copy to clipboard
Posted by: litshJV
Posted on: 2005-07-15 10:12

本来我用Textpad运行程序没有任何问题,自从运行了以下程序以后就出现了,线程出错的提示

/**
* @version 1.00 11 Mar 1997
* @author Cay Horstmann
*/

import java.lang.reflect.*;
import corejava.*;

public class ArrayGrowTest
{ public static void main(String[] args)
{ int[] a = { 1, 2, 3 };
Day[] b = { new Day(1996, 1, 1), new Day(1997, 3, 26) };
a = (int[])goodArrayGrow(a);
arrayPrint(a);
b = (Day[])goodArrayGrow(b);
arrayPrint(b);
System.out.println
("The following call will generate an exception.");
b = (Day[])badArrayGrow(b);
}

static Object[] badArrayGrow(Object[] a)
{ int newLength = a.length * 11 / 10 + 10;
Object[] newArray = new Object[newLength];
System.arraycopy(a, 0, newArray, 0, a.length);
return newArray;
}

static Object goodArrayGrow(Object a)
{ Class cl = a.getClass();
if (!cl.isArray()) return null;
Class componentType = a.getClass().getComponentType();
int length = Array.getLength(a);
int newLength = length * 11 / 10 + 10;

Object newArray = Array.newInstance(componentType,
newLength);
System.arraycopy(a, 0, newArray, 0, length);
return newArray;
}

static void arrayPrint(Object a)
{ Class cl = a.getClass();
if (!cl.isArray()) return;
Class componentType = a.getClass().getComponentType();
int length = Array.getLength(a);
System.out.println(componentType.getName()
+ "[" + length + "]");
for (int i = 0; i < Array.getLength(a); i++)
System.out.println(Array.get(a, i));
}
}

之后,我无论运行任何程序都提示一下错误
Exception in thread "main"java.lang.NoclassDefFoundError:ManagerTes
ManagerTes为public class 名
什么原因阿??!!

本人刚接触java 不久,请高手解答!谢谢!

2.Re:为什么老是提示线程错??!! [Re: litshJV] Copy to clipboard
Posted by: 剑过无痕
Posted on: 2005-07-15 16:06

是不是找不到ManagerTes

3.Re:为什么老是提示线程错??!! [Re: litshJV] Copy to clipboard
Posted by: dqgh0
Posted on: 2005-08-10 11:38

corejava包是自己编的吧,把他传上来,我给你试一下

你这个有可能是classpath设置的事。

4.Re:为什么老是提示线程错??!! [Re: litshJV] Copy to clipboard
Posted by: InnocentBoy
Posted on: 2005-08-18 14:13

这确实是个classpath问题。如果你是纯控制台运行,使用java -cp 你的类所在文件夹路径 myClass.java(回车)


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923