Why Eclipse shows error with Play Framework render method?
Asked Answered
N

4

3

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.

Nigh answered 23/7, 2013 at 9:56 Comment(4)
What is the error? Be more descriptive. Include any stack traces you can get while running the program (if the program runs correctly as expected, you can ignore or disable Eclipse error).Hermit
possible duplicate of How to make Eclipse see the changes in Play! compiled templates?Bipartite
nico_ekito I don't think it is duplicate. Code is working fine in browser in my case, it just problem that Eclipse can't find method "render" automatically created somewhere by play. @ADTC, there is nothing more to tell than home can't be resolved, no stack trace as it works fine.Nigh
Did you set your project build path correctly? Included the necessary libraries?Hermit
U
5

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

Unstuck answered 23/7, 2013 at 18:37 Comment(0)
A
13

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
Alyssa answered 12/7, 2015 at 1:33 Comment(2)
thank you, finally i found what i need to add in classpath for 2.x version of PF...everywhere i read i should have add classes_managed, but it's right for old versions.Paedo
Upgrade sbteclipse to version 5.1.0 (which was released on January 12th 2017) - you wont need to add the folder to the class path by yourself anymore.Shipmaster
U
5

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

Unstuck answered 23/7, 2013 at 18:37 Comment(0)
T
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.

Tetrabrach answered 23/11, 2013 at 2:49 Comment(0)
L
1

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

Lovins answered 23/2, 2015 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.