对于大学项目,我们需要实现一个服务器“注册器”,它通过 SSL RMI 连接与客户端“barowner”进行通信。构建客户端时,出现错误 java: No enum Constant javax.lang.model.element.Modifier.SEALED 构建错误。服务器构建没有任何问题。
BarownerMain.java
package com.example.BarOwner;
import com.example.registrar.RegistrarInterface;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class BarOwnerMain {
public static void main(String[] args) throws RemoteException {
String pass = "password";
System.setProperty("javax.net.ssl.debug", "all");
System.setProperty("javax.net.ssl.keyStore", System.getProperty("user.dir") + "/keys/raynaud.jks");
System.setProperty("javax.net.ssl.keyStorePassword", pass);
System.setProperty("javax.net.ssl.trustStore", System.getProperty("user.dir") + "/keys/raynaud.jks");
System.setProperty("javax.net.ssl.trustStorePassword", pass);
Registry registrarRegistry;
RegistrarInterface registrarInterface;
try {
registrarRegistry = LocateRegistry.getRegistry(
InetAddress.getLocalHost().getHostName(), 1112,
new RMISSLClientSocketFactory());
registrarInterface = (RegistrarInterface) registrarRegistry.lookup("RegistrarService");
BarOwnerMenu.showMenu(registrarInterface);
} catch (RemoteException | NotBoundException e) {
throw new RuntimeException(e);
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试按照JDK-8244367中的描述编辑 javax.lang.module但 IntelliJ 不允许我这样做。任何帮助,将不胜感激!
Try to change the SDK version to 15, and then return it to the updated version. You can change your DSK version in the "Project Structure", shortcut to get there:
ctrl+alt+shift+S
Make sure you click the "Apply" button.
它帮助我解决同样的问题。
| 归档时间: |
|
| 查看次数: |
10409 次 |
| 最近记录: |