IDEA找不到java.corba模块

时间:2018-12-06 12:01:49

标签: java compiler-errors rmi iiop

我正在尝试从oracle教程https://docs.oracle.com/javase/8/docs/technotes/guides/rmi-iiop/tutorial.html中运行项目 我有类HelloImpl,它扩展了PortableRemoteObject,当我尝试使用

运行它时
javac -d . -classpath . HelloImpl.java

我有错

import javax.rmi.PortableRemoteObject;
        ^
(package javax.rmi is declared in module java.corba, which is not in the module graph)
1 error

但是在我的editor.xml文件中,我具有java-corba模块:

<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
  <component name="CompilerConfiguration">
   <option name="USE_RELEASE_OPTION" value="false" />
   <bytecodeTargetLevel target="8" />
  </component>
  <component name="JavacSettings">
    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
     <module name="CourseProject" options="--add-modules=java.corba" />
    </option>
  </component>
</project>

可能有人知道如何解决它:

import javax.rmi.PortableRemoteObject;

public class HelloImpl extends PortableRemoteObject implements HelloInterface {
   public HelloImpl() throws java.rmi.RemoteException {
       super();     // invoke rmi linking and remote object initialization
   }

   public void sayHello( String from ) throws java.rmi.RemoteException {
       System.out.println( "Hello from " + from + "!!" );
       System.out.flush();
   }`enter code here`
}

0 个答案:

没有答案