问题
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:
- Run
activator eclipse(from Activator UI or command line) - 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