kangabo 2021-11-07 07:32 采纳率: 85.1%
浏览 57
已结题

错误: 找不到或无法加载主类 app.App咋办呀


package app;

import io.javalin.Javalin;
import io.javalin.core.util.RouteOverviewPlugin;


/**
 * Main Application Class.
 * <p>
 * Running this class as regular java application will start the 
 * Javalin HTTP Server and our web application.
 *
 * @author Timothy Wiley, 2021. email: timothy.wiley@rmit.edu.au
 * @author Santha Sumanasekara, 2021. email: santha.sumanasekara@rmit.edu.au
 */
public class App {

    public static final int         JAVALIN_PORT    = 7000;
    public static final String      CSS_DIR         = "css/";
    public static final String      IMAGES_DIR      = "images/";

    public static void main(String[] args) {
        // Create our HTTP server and listen in port 7000
        Javalin app = Javalin.create(config -> {
            config.registerPlugin(new RouteOverviewPlugin("/help/routes"));
            
            // Uncomment this if you have files in the CSS Directory
            config.addStaticFiles(CSS_DIR);

            // Uncomment this if you have files in the Images Directory
            config.addStaticFiles(IMAGES_DIR);
        }).start(JAVALIN_PORT);


        // Configure Web Routes
        configureRoutes(app);
    }

    public static void configureRoutes(Javalin app) {
        // ADD ALL OF YOUR WEBPAGES HERE
        app.get(Index.URL, new Index());
        app.get(MoviesList.URL, new MoviesList());
    }

}

img

  • 写回答

1条回答 默认 最新

  • D狂风R 2021-11-07 14:39
    关注

    到app包同级下执行的吗

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 11月8日
  • 赞助了问题酬金 11月7日
  • 创建了问题 11月7日