你说的是类似这样的编译问题吗?1、在当前目录下新建一个打包的RMB.java文件
package money;
public class RMB{
}javac -d . RMB.java后在当前目录下新建了money目录,RMB.class躺在里面2、再在当前目录下新建一个Test.java
import money.*;
public class Test{
Object o = new RMB();
}javac -d . Test.java后出错提示如下:
D:\Test.java:3: cannot access RMB
bad class file: D:\RMB.java
file does not contain class RMB
Please remove or make sure it appears in the correct subdirectory of the classpath.
        Object o = new RMB();
                       ^
1 error

解决方案 »

  1.   

    设置环境变量CLASSPATH=.
    如果有问题,你就应该打 0574-8888 8888来找我了:)
      

  2.   

    环境变量10000000000000%没问题。
    ntzls(三星堆) 大哥快来呀。
      

  3.   

    you did not compile your *.class files  in your correct path !
     shoul know ,java virtual machine use the *.class file !
    the information of compiling error had told you where was the problem !
      

  4.   

    我确实编译好了。比如我 package com.bruceeckel.simple,
    那么我在classpath里建立d:\jdk,
    然后把编译好的class文件放在d:\jdk\com\bruceeckel\simple\里,
    然后在别的源文件里加入 import com.bruceeckel.simple.*   ,
    是这样吧。可是不行啊,我必须按照三星堆的做法才能编译成功,我想知道为什么会这样。