我正在開發Java中的RMI Chat應用程序。我試圖在eclipse IDE中運行簡單的RMI應用程序。但它會發出以下問題。我知道如何從命令提示符下運行它,而且它的運行沒有任何問題。如果你可以建議我在Eclipse IDE中運行RMI應用程序的方法,我真的很感激。謝謝!如何在Eclipse IDE中使用JAVA運行RMI Chat應用程序
錯誤:
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: examples.credit.CreditChecker
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: examples.credit.CreditChecker
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadProxyClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(Unknown Source)
at java.io.ObjectInputStream.readProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 13 more
錯誤是說清楚「ClassNotFound」。引起:java.lang.ClassNotFoundException:examples.credit.CreditChecker。請檢查此課程是否可用於您的課程路徑。 – KSHiTiJ
@kshitij,謝謝。那麼,你能告訴我如何配置課程路徑。此外,我從錯誤中建議的代碼庫路徑。但它沒有解決。 –
如果你的這個類是在jar文件中,那麼你只需要在你的eclipse項目的lib文件夾中添加那個jar文件。如果它是由你製作的類,那麼你只需要把它放在eclipse項目的src文件夾中。 – KSHiTiJ