我在寫一些Java類來實現RMI。我編寫了所有的類,程序運行良好。但是從第二天我收到指示編譯器錯誤,缺少文件:找不到符號:編譯java代碼時
文件名:ServerInterface.java
import java.rmi.*;
public interface ServerInterface extends Remote
{
public double sum(double[] temp) throws RemoteException;
};
文件名:ServerImplement.java
import java.rmi.*;
import java.rmi.server.*;
public class ServerImplement extends UnicastRemoteObject implements ServerInterface
{
public ServerImplement() throws RemoteException
{
}
public double sum(double[] temp) throws RemoteException
{
double sum=0;
int len=temp.length;
for(int i=0;i<len;i++)
sum+=temp[i];
return sum;
}
};
即使證明它沒有任何文件名錯誤:
F:\E\java\rmi final>dir
Volume in drive F is My Volume
Volume Serial Number is E0F9-4F89
Directory of F:\E\java\rmi final
22-01-2011 23:23 <DIR> .
22-01-2011 23:23 <DIR> ..
22-12-2009 13:09 1,849 additionImplementer_Stub.class
21-01-2011 21:52 1,076 Client.class
18-01-2011 02:54 649 Client.java
21-01-2011 21:52 1,847 ClientTry.class
18-01-2011 02:54 1,268 ClientTry.java
21-01-2011 21:52 444 ServerImplement.class
18-01-2011 02:30 386 ServerImplement.java
18-01-2011 02:54 1,783 ServerImplement_Stub.class
21-01-2011 21:54 209 ServerInterface.class
22-12-2009 12:07 132 ServerInterface.java
21-01-2011 21:52 919 ServerMain.class
18-01-2011 02:36 409 ServerMain.java
12 File(s) 10,971 bytes
如果我嘗試:javac *.java
,它工作正常(但在任何.class文件的努力的java導致錯誤:Exception in thread "main" java.lang.NoClassDefFoundError: ServerMain
如果我嘗試javac ServerImplement.java
我得到一個錯誤(其實沒有我的Java程序能夠鏈接): (我在同一個目錄)
E:\ java的\ RMI最後>的javac ServerMain.java
ServerImplement.java:4:找不到符號
symbol: class ServerInterface
public class ServerImplement extends UnicastRemoteObject implements ServerInterface
^
1 error
該計劃甚至在我的大學實驗室工作的罰款。我應該重新安裝JDK嗎?或者有什麼辦法明確提供鏈接?
嘗試一個乾淨的和重建。 – BoltClock 2011-01-22 18:49:48
如何用命令提示符做到這一點? – letsc 2011-01-22 18:51:28