在D:\gt3test\gt3tutorial\core\first的目录下有impl和Math两个文件夹.
Math下有我编译好的类MathPortType.class(package gt3tutorial.core.first.Math)
我在impl里的MathImpl.java中调用Math\MathPortType.class我这样写:
...
import gt3tutorial.core.first.Math.MathPortType;
...编译时:javac MathImpl.java出现下面错误:
package gt3tutorial.core.first.Math does not existe;我在classpath中加了D:\gt3test请教各位了!:)

解决方案 »

  1.   

    没办法,你这样是怎么也找不到那个包里面的类的!
    除非把编译好的那个包先打包成jar
      

  2.   

    可以在编译时写成:
    javac -classpath /*** filename记得不清楚了,试试吧!
      

  3.   

    D:\gt3test\gt3tutorial\core\first下两个目录:D:\gt3test\gt3tutorial\core\first\impl

    D:\gt3test\gt3tutorial\core\first\MathMath里有编译好的类:
    MathPortType.classpackage gt3tutorial.core.first.Math;public interface MathPortType extends java.rmi.Remote {
        public int add(int in0, int in1) throws java.rmi.RemoteException;
        public float divide(int in0, int in1) throws java.rmi.RemoteException;
        public int multiply(int in0, int in1) throws java.rmi.RemoteException;
        public int subtract(int in0, int in1) throws java.rmi.RemoteException;
    }我在impl目录下的MathImpl.java中引用Math目录下的MathPortType.class
    MathImpl.java
    package gt3tutorial.core.first.impl; 
    import org.globus.ogsa.impl.ogsi.GridServiceImpl;
    import gt3tutorial.core.first.Math.MathPortType;
    import java.rmi.RemoteException; 
    public class MathImpl extends GridServiceImpl implements MathPortType
    {
    public MathImpl()
    {
    super("Simple Math Service");

    public int add(int a, int b) throws RemoteException
    {
    return a + b;

    public int subtract(int a, int b) throws RemoteException
    {
    return a - b;

    public int multiply(int a, int b) throws RemoteException
    {
    return a * b;

    public float divide(int a, int b) throws RemoteException
    {
    return a / b;
    }
    } 编译时就出现:
    package gt3tutorial.core.first.Math does not existe;
    找不到gt3tutorial.core.first.Math 为什么啊?
    再次请教!:)
      

  4.   

    楼上那个方法可能可以吧
    javac -classpath D:\ MathImpl.java
      

  5.   

    这样你先把MathImpl.java放到D:\gt3test下在这个目录运行试试
      

  6.   

    javac -classpath D:\gt3test\gt3tutorial\core\first\impl\MathImpl.java
    这样还是不行啊?
    错误:
    javac no source files-classpath 怎么用啊?格式是怎么样的?
      

  7.   

    javac -classpath D:\ MathImpl.java
    这个啊,楼主用这个试试啊,晕
      

  8.   

    javac -classpath D:\gt3test MathImpl.java
      

  9.   

    1.用了javac -classpath D:\ MathImpl.java
    错误:
    MathImpl.java:2: package org.globus.ogsa.impl.ogsi does not exist
    import org.globus.ogsa.impl.ogsi.GridServiceImpl;
                                     ^
    MathImpl.java:3: package gt3tutorial.core.first.Math does not exist
    import gt3tutorial.core.first.Math.MathPortType;
                                       ^
    MathImpl.java:5: cannot resolve symbol
    symbol  : class GridServiceImpl
    location: class gt3tutorial.core.first.impl.MathImpl
    public class MathImpl extends GridServiceImpl implements MathPortType
                                  ^
    MathImpl.java:5: cannot resolve symbol
    symbol  : class MathPortType
    location: class gt3tutorial.core.first.impl.MathImpl
    public class MathImpl extends GridServiceImpl implements MathPortType4 errors2.用了javac -classpath D:\gt3test MathImpl.java
    MathImpl.java:2: package org.globus.ogsa.impl.ogsi does not exist
    import org.globus.ogsa.impl.ogsi.GridServiceImpl;
                                     ^
    MathImpl.java:5: cannot resolve symbol
    symbol  : class GridServiceImpl
    location: class gt3tutorial.core.first.impl.MathImpl
    public class MathImpl extends GridServiceImpl implements MathPortType
                                  ^
    2 errors
      

  10.   

    忘了系统的classpath了
    javac -classpath D:\;%CLASSPATH% MathImpl.java
      

  11.   

    我想再问一下:
    “javac -classpath D:\;%CLASSPATH% MathImpl.java”中的
    “D:\”
    在这里起什么作用?
      

  12.   

    恩,我是在环境变量里加了D:\gt3test的
    所以有没有D:\都无所谓的
    呵呵。
      

  13.   

    我觉的是你运行的问题,设了classpathdoc要重新启动javac 加了参数是显示的调用刚开始这样也可以