尽管有错误,Java播放应用程序仍在运行 - 如何解决此错误? [英] Java play application running despite of having errors- how to resolve this errors?

查看:126
本文介绍了尽管有错误,Java播放应用程序仍在运行 - 如何解决此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用激活器进行游戏,我使用

I just started with play using activator, I created new play app using

activator new firstApp play-java

然后我使用激活器打开播放控制台并运行应用程序,应用程序运行良好。
然后我在我的intellij中打开了项目作为SBT,项目打开并开始显示错误。

Then I opened play console using activator and run the application, app was running fine. Then I opened the project in my intellij as SBT, the project opened and started showing errors.

在路径文件中有行

GET     /                        controllers.HomeController.index
GET     /count                   controllers.CountController.count
GET     /message                 controllers.AsyncController.message

此错误是因为方法索引,计数和消息不是静态的。
这是一个明显的错误,因为我们无法调用这样的静态方法,为什么代码应用程序仍在运行。

This errors are because method index, count and message are not static. This is an obvious error since we cannot call to static method like this, why the code application is still running.

我得到的另一个错误是代码

another error I am getting is in code

actorSystem.scheduler().scheduleOnce(
        Duration.create(time, timeUnit),
        () -> future.complete("Hi!"),
        exec
    );

它说这是一个模糊的方法调用。

It says this is an ambiguous method call.

我的问题是,如果有错误导致应用程序运行而没有

我创建了运行配置作为SBT任务并尝试运行app我有一堆错误。

I created run configuration as SBT task and tried to run the app an I got bunch of errors.

推荐答案

这些对我有用:

打开文件root \ build.sbt并单击导入项目或刷新项目。
打开文件项目\plugins.sbt并单击导入项目或刷新项目。

Open file root\build.sbt and click 'Import Project' or 'Refresh Project'. Open file project\plugins.sbt and click 'Import Project' or 'Refresh Project'.

这将导入所有必需的库,完成库后将在项目视图窗格外部库树下可见。

This will import all required libraries and after completing libraries will be visible under project view pane 'External Libraries' tree.

转到文件>设置,选择'语言&存储区'下的'播放2'。构架'。
在右侧编译器选项卡下,选中'对此项目使用Play 2编译器'和应用设置。

Go to File > Settings, select 'Play2' under 'Languages & Frameworks'. Under right side Compiler tab check 'Use Play 2 compiler for this project' and Apply settings.

这篇关于尽管有错误,Java播放应用程序仍在运行 - 如何解决此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆