mperry / frege-gradle-example

2 stars 3 forks source link

Problem with running the example #3

Closed ForNeVeR closed 9 years ago

ForNeVeR commented 9 years ago

I've tried the following:

  1. Cloned the Frege/frege-gradle-plugin.
  2. Installed it with ./gradlew clean install.
  3. Cloned the gradle-frege-example from this repository.
  4. Changed the build.gradle so that it uses classpath 'org.frege-lang:frege-gradle-plugin:0.2-SNAPSHOT' instead of 0.1.
  5. Tried ./gradlew clean run.

As far as I can see the project was built succesfully but it cannot execute:

[skipped some output]
com.github.mperry.frege.External: compiled
runtime 3.903 wallclock seconds.
:frege-java:processResources UP-TO-DATE
:frege-java:classes
:frege-java:run
starting main...
in fregeJava2
in fregeJava
main done
runtime 0.068 wallclock seconds.
:frege-java:jar
:java-frege:compileFrege
runtime 0.13 wallclock seconds.
:java-frege:compileJava
:java-frege:processResources UP-TO-DATE
:java-frege:classes
:java-frege:run
Facade.main
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/mperry/frege/External$?
        at com.github.mperry.frege.External.<clinit>(External.java:177)
        at com.github.mperry.frege.Facade.main(Facade.java:18)
Caused by: java.lang.ClassNotFoundException: com.github.mperry.frege.External$?
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 2 more
:java-frege:run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':java-frege:run'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 1

What is the problem? What can I do to fix that? I have no previous experience with Frege but it's interesting project and I decided to try it with gradle plugin at first.

mperry commented 9 years ago

@ForNeVeR I tried this last night and got the same problem. I will have another look tonight and see what I can do.

ForNeVeR commented 9 years ago

@mperry, I'm sorry but how is it going? Maybe I can help somehow?

mperry commented 9 years ago

@ForNeVeR I could only get it working on a Linux VM, not a Windows machine. I suspect the non ASCII characters in the class names generated mean Windows can't find the right file as it includes these in the class names.

ForNeVeR commented 9 years ago

Aha, that's interesting. Will investigate.

(I'm sorry, I've really forgotten to mention that I'm trying Frege on Windows too)

ForNeVeR commented 9 years ago

I've succeed with executing the project manually as

java -classpath '.\frege-java\build\classes\main;.\java-frege\build\classes\main;c:\Users\ForNeVeR\.gradle\caches\modules-2\files-2.1\com.theoryinpractise.frege\frege\3.22.367-g2737683\9cf61284838ff9def8384d63a0a844f1a6c78d56\frege-3.22.367-g2737683.jar' com.github.mperry.frege.Facade

Now all we need is to understand what it does wrong when executing from gradle.

ForNeVeR commented 9 years ago

Aha! I got it. gradlew run executes java with classpath including JAR frege-java.jar, not raw class directory. And that JAR have class file names such as com\github\mperry\frege\External$_.class or External$_$_main_92257c7e.class (and there should be various unicode characters instead of _). That's frege-gradle-plugin issue, I'll escalate it there.

ForNeVeR commented 9 years ago

https://github.com/Frege/frege-gradle-plugin/issues/9