简体   繁体   中英

Server side Java application code not compiling - why?

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); }
    }

}

For the code above, I get the following from the compiler

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

type quizServer 11 errors

But I don't see why this is causing errors? I'm not getting these errors within the eclipse IDE, so why are they appearing here?

Really sorry if this is a stupid question. I very rarely use command to compile, but I have to in this case as I need one command to run my server code, and another to run my client on the same machine.

 package uk.ac.hw.quizgame does not exist import uk.ac.hw.quizgame.Game;

Do you have package with this name in your application? If not (or) remove relevant code (or) you need to add appropriate jars to classpath.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM