Question

I am trying to use the BGGA closures prototype with an existing JDK 6 (standard on Mac OS X Leopard). The sample code I'm compiling is from a BGGA tutorial:

public static void main(String[] args) {
  // function with no arguments; return value is always 42
  int answer = { => 42 }.invoke();
  System.out.println(answer);
}

I have tried the following, and none work:

  1. Copied closures.jar to /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib
  2. Ran javac with -Xbootclasspath/a:/path/to/closures.jar
  3. Ran javac with -J-Xbootclasspath/a:/path/to/closures.jar
  4. Tried from eclipse ganymede by defining my own system library and attaching it to my project with code utilizing BGGA.

In all four cases, I get compilation errors, indicating that the compiler did not pick up closures.jar on the bootstrap classpath. I'd really like to get this working from eclipse, or at the very least maven. Thanks!

Was it helpful?

Solution

The TAR file distribution includes a modified javac.bat with a complete command line, including "-source 7", which is probably what you are missing here.

OTHER TIPS

Have you tried javac with -J-Xbootclasspath instead? That's used for passing -X arguments to the VM itself, which may be necessary for a change as low-level as this.

I very much doubt this will work with Eclipse, though. System libraries are for APIs, not language changes. You'd need to patch the Eclipse compiler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top