package uk.ac.hw.oncrpc;
import org.acplt.oncrpc.*;
import org.acplt.oncrpc.server.*;
import uk.ac.hw.quizgame.Game;
import java.io.IOException;
public class quizServer extends quizServerStub {
private double sum;
public quizServer() throws OncRpcException, IOException {
//sum = 0.0; May used quiz globals here
}
@Override
public void start_1(String arg1) {
// TODO Auto-generated method stub
}
@Override
public String requestQuestion_1() {
// TODO Auto-generated method stub
String question = "What is the atomic number of lithium?";
return question;
}
@Override
public String checkAnswer_1(String arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public void quit_1(String arg1) {
// TODO Auto-generated method stub
}
@Override
public void help_1(String arg1) {
// TODO Auto-generated method stub
}
public static void main(String[] args) {
try {
quizServer server = new quizServer();
System.out.println("Quiz ready");
server.run();
} catch ( Exception e ) { e.printStackTrace(System.out); }
}
}
对于上面的代码,我从编译器中获得以下内容
javac quizServer.java quizServer.java:2: error: package org.acplt.oncrpc does not exist import org.acplt.oncrpc.*; ^ quizServer.java:3: error: package org.acplt.oncrpc.server does not exist import org.acplt.oncrpc.server.*; ^ quizServer.java:5: error: package uk.ac.hw.quizgame does not exist import uk.ac.hw.quizgame.Game;
^ quizServer.java:9: error: cannot find symbol public class quizServer extends quizServerStub {
^ symbol: class quizServerStub quizServer.java:12: error: cannot find symbol
public quizServer() throws OncRpcException, IOException {
^ symbol: class OncRpcException location: class quizServer quizServer.java:17: error: method does not override or implement a method from a supertype
@Override
^ quizServer.java:23: error: method does not override or implement a method from a supertype
@Override
^ quizServer.java:31: error: method does not override or implement a method from a supertype
@Override
^ quizServer.java:37: error: method does not override or implement a method from a supertype
@Override
^ quizServer.java:43: error: method does not override or implement a method from a supertype
@Override
^ quizServer.java:53: error: cannot find symbol
server.run();
^ symbol: method run() location: variable server of
输入quizServer 11错误
但我不明白为什么这会导致错误?我没有在eclipse IDE中得到这些错误,为什么它们出现在这里?
如果这是一个愚蠢的问题,真的很抱歉。我很少使用命令编译,但在这种情况下我必须使用一个命令来运行我的服务器代码,而另一个命令则在同一台机器上运行我的客户端。
答案 0 :(得分:1)
package uk.ac.hw.quizgame does not exist import uk.ac.hw.quizgame.Game;
您的申请表中是否包含此名称的包裹?如果没有(或)删除相关代码(或),则需要在类路径中添加适当的jar。