无法解析 java.rmi.RemoteException 类型。它是从 Java 中所需的 .class 文件错误间接引用的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13721982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files error in java
提问by Shirish Herwade
I'm really new to Java and trying to call web-service. I have taken a code from net
我对 Java 真的很陌生,并试图调用 Web 服务。我从网上拿了一个代码
String message = "";
static Map output;
public static void main(String args[]) {
try {
String inputparam = "10000";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(""));
call.setOperationName(new QName("http://testPackage.fc.com/, doBasicStuff"));
call.addParameter("Hello", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
Object responseWS = call.invoke(new Object[] { inpurparam });
System.out.println("ReceivingResponse: " + (String) responseWS);
output = call.getOutputParams();
String firstName = (String) output.get(new QName("", "firstName"));
} catch (Exception e) {
System.err.println(e.toString());
}
}
which gives a syntax error
这给出了一个语法错误
The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files
on the line
在线上
Object responseWS = call.invoke(new Object[] { inpurparam });
So I'm added "import java.rmi.RemoteException;" statement it gives error to the import statement "The import java.rmi.RemoteException cannot be resolved", so please tell how to remove this error
所以我添加了“import java.rmi.RemoteException;” 声明它给导入语句错误“无法解析导入java.rmi.RemoteException”,所以请告诉如何消除这个错误
回答by
You need to add
你需要添加
import java.rmi.RemoteException;
import java.rmi.RemoteException;
before your class declaration
在你的班级声明之前
回答by Ian Roberts
The java.rmi
packages are part of the standard Java SE library, so they should be available to all Java code by default. If your IDE can't find these classes, check your settings, project build path, etc. and make sure they are correct and that the project is set up to use a Java SE runtime as opposed to, for example, Android (which provides some java.*
packages but not java.rmi
).
这些java.rmi
包是标准 Java SE 库的一部分,因此默认情况下它们应该可用于所有 Java 代码。如果您的 IDE 找不到这些类,请检查您的设置、项目构建路径等,并确保它们是正确的,并且项目被设置为使用 Java SE 运行时而不是 Android(它提供一些java.*
包但不是java.rmi
)。