Frege / eclipse-plugin

The eclipse plugin for frege, codename fregIDE
31 stars 6 forks source link

Compiling in Eclipse messes up the file names #2

Closed paasar closed 11 years ago

paasar commented 11 years ago

Hi,

I just tried Frege and fregIDE for the first time.

I noticed following problem: Running Frege-programs in Eclipse works ok, but I cannot use those same compiled files in command line because one filename is broken.

This is the exception I get:

$ java -cp bin:fregec.jar pkg.First
Exception in thread "main" java.lang.NoClassDefFoundError: pkg/First$IJ
    at pkg.First.<clinit>(First.java:156)
...

And looking the source files I have:

$ ls -1 bin/pkg/
First$?.class
First$Lambda1a.class
First.class
First.fr
First.java

So the "IJ" has turned into "?". This doesn't seem to bother Eclipse though.

If I compile the Frege file from command line I get the filenames right:

$ ls -1 build/pkg/
First$Lambda1a.class
First$IJ.class
First.class
First.java

And I can run the program just fine from command line:

$ java -cp build:fregec.jar pkg.First
Hello Frege!
runtime 0.123 wallclock seconds.

System I have is Mac OS X 10.8.4 and Java is:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

And the source of the First.fr:

module pkg.First where

main _ = do
  println "Hello Frege!"

This is not really a problem for me but I decided to let you know.

Ingo60 commented 11 years ago

Hi, thanks for letting me know.

From your description I suspect a codepage issue in eclipse, most probably concerning the Frege generated *.java files. Can you check to locate the bin/pkg/First.java file in the Eclipse Navigator and open it. Does it look all-right? What does Eclipse think the codepage of this file is?

Ingo60 commented 11 years ago

Just rechecked, the eclipse compiler is called with parameter -encoding UTF-8 so my above comment is worthless.

As paasar outlines, it is actually the name of the class file that is wrong.

Unfortunately, I couldn't manage to make this error happen on LINUX, or even Windows, hence I think now it must have to do with interaction between MacOS and Eclipse.

If the above is true, then having a class name including unusual characters in a plain old java project should exhibit the same misbehaviour.

Ingo60 commented 11 years ago

Found out meanwhile, that there are several Eclipse issues filed for MacOS (like her: https://bugs.eclipse.org/bugs/show_bug.cgi?id=397226) that could fit in.

OTOH, I got the same recently on Linux (Ubuntu, via ssh -X), and it turned out that my environment variable LC_ALL was unset, which caused the very same symptoms, along with the strange messages shown below. By doing:

export LC_ALL=$LANG

I could solve the issue.

So please make sure you can start eclipse from the command line and there are no strange messages like:

(process:28321): Gdk-WARNING **: locale not supported by C library

(process:28321): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

In any case, this is definitly not a problem of the frege eclipse-plugin, only insofar as we use certain unicode characters in class names (and even this is done by the compiler, not the plugin, and it's not going to change).

Hence, this issue gets closed.