当前位置: 技术问答>java相关
新手求救:JavaBean编译问题
来源: 互联网 发布时间:2015-09-21
本文导语: helloword.java,源码如下: package test; public class helloWorld { public String name = "My first bean"; public String getHi() { return "Hello from " + name; } } 出错信息如下: java.lang.NullPointerException at java.util.Hashtable.p...
helloword.java,源码如下:
package test;
public class helloWorld
{
public String name = "My first bean";
public String getHi()
{
return "Hello from " + name;
}
}
出错信息如下:
java.lang.NullPointerException
at java.util.Hashtable.put(Compiled Code)
at java.util.zip.ZipFile.readCEN(Compiled Code)
at java.util.zip.ZipFile.(ZipFile.java:61)
at java.util.zip.ZipFile.(ZipFile.java:71)
at sun.tools.java.ClassPath.(Compiled Code)
at sun.tools.javac.Main.compile(Compiled Code)
at sun.tools.javac.Main.main(Main.java:465)
请教高手,是何原因出错,应如何解决???
win2k + j2sdk1.4.1 + tomcat4.1,解决后马上送分
package test;
public class helloWorld
{
public String name = "My first bean";
public String getHi()
{
return "Hello from " + name;
}
}
出错信息如下:
java.lang.NullPointerException
at java.util.Hashtable.put(Compiled Code)
at java.util.zip.ZipFile.readCEN(Compiled Code)
at java.util.zip.ZipFile.(ZipFile.java:61)
at java.util.zip.ZipFile.(ZipFile.java:71)
at sun.tools.java.ClassPath.(Compiled Code)
at sun.tools.javac.Main.compile(Compiled Code)
at sun.tools.javac.Main.main(Main.java:465)
请教高手,是何原因出错,应如何解决???
win2k + j2sdk1.4.1 + tomcat4.1,解决后马上送分
|
经过我测试,刚才的代码好使