无法编译代码

时间:2016-10-06 06:51:54

标签: java

当我尝试使用intellij或简单的命令提示符编译它时,它告诉我:错误,无法找到或加载主类testing.java。其他所有东西看起来都很完美(IDE中的任何地方都没有错误,也没有其他任何我能说出来的错误。运行" java testing.java"也不起作用并产生相同的错误。

/***********************************************************
 *  Bot test: connection, authorization, I/O               *
 **********************************************************/

// import beam libraries
import pro.beam.api.BeamAPI;
import pro.beam.api.resource.BeamUser;
import pro.beam.api.resource.chat.BeamChat;
import pro.beam.api.resource.chat.events.IncomingMessageEvent;
import pro.beam.api.resource.chat.events.UserJoinEvent;
import pro.beam.api.resource.chat.methods.AuthenticateMessage;
import pro.beam.api.resource.chat.methods.ChatSendMethod;
import pro.beam.api.resource.chat.replies.AuthenticationReply;
import pro.beam.api.resource.chat.replies.ReplyHandler;
import pro.beam.api.resource.chat.ws.BeamChatConnectable;
import pro.beam.api.services.impl.ChatService;
import pro.beam.api.services.impl.UsersService;

import java.util.concurrent.ExecutionException;

public class testing {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        /**************************************************************************************
        *    sets user and pass... these will be passed as arguments on command line for now. *
        *    in the future, use this in the GUI                                               *
        **************************************************************************************/
        String username = username[0];
        String password = password[1];
        BeamAPI beam = new BeamAPI();

        //set connect parameters
        BeamUser user = beam.use(UsersService.class).login(username, password).get();
        BeamChat chat = beam.use(ChatService.class).findOne(user.channel.id).get();
        BeamChatConnectable chatConnectable = chat.connectable(beam);

        // connect to chat server
        if (chatConnectable.connect()) {
            chatConnectable.send(AuthenticateMessage.from(user.channel, user, chat.authkey), new ReplyHandler<AuthenticationReply>() {
                public void onSuccess(AuthenticationReply reply) {
                    chatConnectable.send(ChatSendMethod.of("Hello World!"));
                }
                public void onFailure(Throwable var1) {
                    var1.printStackTrace();
                }
            });
        }

        // ping pong
        chatConnectable.on(IncomingMessageEvent.class, event -> {
            if (event.data.message.message.get(0).text.startsWith("!ping")) {
                chatConnectable.send(ChatSendMethod.of(String.format("@%s PONG!",event.data.userName)));
            }
        });

        // upon user joining, pops up message
        chatConnectable.on(UserJoinEvent.class, event -> {
            chatConnectable.send(ChatSendMethod.of(
                    String.format("Hi %s! I'm BeefBot! Write !ping and I will pong back!",
                            event.data.username)));
        });
    }
}

任何帮助都将非常感谢!我是java的新手。

0 个答案:

没有答案