我的java.lang包居然不会自动引入, 我的天!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/28 17:56:55
我的操作系统是Windows XP Home Edition, 我用的是Java 1.6.0版本.
熟悉Java编程的人都知道 java.lang包在每个程序中都是会自动调用的, 但我的JVM 很诡异, 居然不会自动import java.lang. 以至于我每次都得在我编写的每个程序中显式地写明 import java.lang.*; 这样编译才不会报错. 对于这种糟糕的状况, 我真的是极度郁闷. 请各位大侠给我指条明路吧. By the way, 我重装JVM 与 电脑都没有用!!!
Maybe because this situation is rare, none of answers below is satisfying!

重装JVM 与 电脑都没有用???

你是直接用 JDK 里的编译器吗?
你的 JDK 是从 http://java.sun.com/javase/downloads/index.jsp 来的吗?

=========================================================

Calm down, man. Even if none of the answers you got are truly useful to you, what good would knocking people do?

Anyway, if what you've described is truly happening, then you've got a broken compiler, since java.lang package is guaranteed by the language to be automatically imported for each compilation unit. It's stated in the spec:

http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.5

So be sure to download from Sun again since it's not impossible that you've got a corrupted copy. Or test the c