Why Eclipse shows error with Play Framework render

2019-05-16 09:54发布

I am getting an error at return :

public static Result home(String name)
{           
    return ok(home.render(name));
}

For which Eclipse says, home can't be resolved. I know it is more of Scala than Java, but is there any way I can get rid of such errors. Well, without disabling error messaging (I see lot of such answers here on SO). Also, is there anyway I can make my Eclipse work autocomplete for Scala ?

Ah, I just noticed one more problem there. To use an external jar, all I have too keep jars in a lib folder and run eclipse again from cli. It works fine in browser but a class making use of jars is all wrong, as per Eclipse.

4条回答
Rolldiameter
2楼-- · 2019-05-16 10:29

You could try Project > Properties > Java Build Path > Order and Export and select all less the jre. I solved my problem doing by this way.

查看更多
Bombasti
3楼-- · 2019-05-16 10:33

I had to "activator eclipse" again after starting eclipse.

查看更多
淡お忘
4楼-- · 2019-05-16 10:36

Use eclipse command, build the project from eclipse and refresh the project.

查看更多
叛逆
5楼-- · 2019-05-16 10:53

You have to do 2 things on Play 2.4:

  1. Run activator eclipse (from Activator UI or command line)
  2. Go to Java Build Path > Libraries > Add External Class Folder and point it to the output folder: target/scala-<version>/classes
查看更多
登录 后发表回答