rightsstatements / rights-app

Web application to serve the rightsstatements.org vocabulary
http://rightsstatements.org/vocab/1.0/
European Union Public License 1.1
1 stars 3 forks source link

Compilation error following Readme instructions? #39

Closed aisaac closed 8 years ago

aisaac commented 8 years ago

In the call today I've mentioned having trouble setting things up on my confused machine (too much old software lying around). But I'm raising the issue in case there would be a real problem.

After the sbt.run in the current README.md I'm getting in my browser at http://localhost:9000/:

Compilation error
 illegal start of type
In /Users/aisaac/Europeana/OpenData/RightsWDPLA/Technical/github/rights-app/app/controllers/Application.java:39
36 */
37public class Application extends Controller {
38
39  private static Map<String, String> mimeTypeExtensionMap = new HashMap<>();
40  static {
41    mimeTypeExtensionMap.put("text/turtle", "ttl");
42    mimeTypeExtensionMap.put("application/ld+json", "jsonld");
43    mimeTypeExtensionMap.put("application/json", "json");
44    mimeTypeExtensionMap.put("*/*", "json");

My terminal shows:

[info] Compiling 4 Scala sources and 6 Java sources to /Users/aisaac/Europeana/OpenData/RightsWDPLA/Technical/github/rights-app/target/scala-2.10/classes...
[error] /Users/aisaac/Europeana/OpenData/RightsWDPLA/Technical/github/rights-app/app/controllers/Application.java:39:  illegal start of type
[error]   private static Map<String, String> mimeTypeExtensionMap = new HashMap<>();
[error]                                                                         ^
[error] /Users/aisaac/Europeana/OpenData/RightsWDPLA/Technical/github/rights-app/app/controllers/Application.java:199:  illegal start of type
[error]     Map<String, Object> main = new HashMap<>();
[error]                                            ^
[error] (compile:compileIncremental) javac returned nonzero exit code
[error] application - 

! @6opon57jm - Internal server error, for (GET) [/] ->
 play.sbt.PlayExceptions$CompilationException: Compilation error[ illegal start of type]
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
    at scala.Option.map(Option.scala:145) ~[scala-library-2.10.5.jar:na]
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:49) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) ~[na:na]
    at scala.Option.map(Option.scala:145) ~[scala-library-2.10.5.jar:na]
    at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44) ~[na:na]
    at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]

Again: feel free to close instantly if it because this betrays me as using some super old library, or not having installed something crucial!

literarymachine commented 8 years ago

I believe this is due to your Java version being < 1.7. Because it uses Play Framework 2.4, rights-app requires JDK 8.

aisaac commented 8 years ago

In my terminal:

java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)

This being said if there's a call in the rights-app code (or more probably in the components it relies on) to a java that's not the shell's "main" jave, then I'm indeed screwed (I've installed 1.8 just today)

literarymachine commented 8 years ago

Is javac also at 1.8? If so, we'll have to figure out why sbt is not using it.

aisaac commented 8 years ago

Ooops of course I should have remembered that all these messages after sbt run may have compiled something :-/ My version of javac is indeed 1.6.0_65. OK I'll try to update and check tomorrow. Should I clean anything besides the 'target' folder to get a clean slate on which to re-run sbt? Btw you can assign the issue to me after answering this question.

literarymachine commented 8 years ago

Should I clean anything besides the 'target' folder to get a clean slate on which to re-run sbt?

$ sbt clean run

should do the trick!

literarymachine commented 8 years ago

No follow, closing.