Why Eclipse shows error with Play Framework render method?

回眸只為那壹抹淺笑 提交于 2019-12-22 09:26:15

问题


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.


回答1:


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




回答2:


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



回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/17806947/why-eclipse-shows-error-with-play-framework-render-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!