#741 Java Integration Question

spelljammer Sun 13 Sep 2009

Hi,

I'm trying to evaluate Fan for future project work. Right now I'm trying to test the Java integration. I'm new to using Fan so please bare with me. I've setup a test Pod using the FAN Netbeans IDE. I've got some example Java code in my main. When I attempt to build the Pod I get the following error:

build.fan(14,82): Facet value is not serializable: @buildJdkHome (call not serializable) ERROR: cannot compile script

I was getting:

javaNative [Fan1] Error: Missing or invalid URI for @buildJdkHome: /C:/dev/tools/java/ BUILD FAILED [962ms]! But that changed when I put the following in build.fan:

@buildJdkHome = "/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0".toUri (this is the change that now complains about the value not being serializable).

I've been going through the documentation but its not clear how or when to set this variable. When I do "fan -version" the java.home is correctly set.

I'm obviously missing something, but not quite sure what.

Any pointers much appreciated!

Thanks,

sj

brian Mon 14 Sep 2009

I believe tcolar is on vacation (he is the NetBeans guy).

That symbols probably shouldn't even be in build.fan. Can you provide a dump of your build.fan and pod.fan files?

spelljammer Mon 14 Sep 2009

Hi Brian,

Here are my files (I've put some quoting in for the Fandoc issues that keep occuring in my posts):

================= build.fan

using build

class Build : BuildPod {

//@buildJdkHome = "/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0".toUri
override Void setup()
{
  podName     = "Fan1"
}

}

pod.fan

@podDepends = [Depend("sys 1.0")] @podSrcDirs = [`fan/`, `test/`] @podJavaDirs = [`java`]

//@podDotnetDirs = [`dotnet`] //@podJsDirs = [`js`] pod Fan1 {

}

You'll notice I commented out the references. I am using Fan 1.0.45. Without any definition, @buildJdkHome is set to: /C:/dev/tools/java/

I've made no changes to any of the files in the Fan distribution.

Thanks,

sj

brian Mon 14 Sep 2009

If you intend your "code" two or more spaces it will show up as a pre-formatted code block. See fandoc

Did NetBeans add that @buildJdkHome or did you?

That value should be configured in {home}/etc/build/pod.fansym

spelljammer Mon 14 Sep 2009

I added the @buildJdkHome (and then commented it out). The pod.fansym changed fixed the error for me (well I have a few other errors, but I can work through them). I must have missed the reference to it the documentation. I'll have to keep reading.

Thanks for your help. Fan is very interesting language. I've been looking for something to replace Java with, and found the lack of typing in Groovy not to my liking (not a bad language, I just want something to catch my fat fingered mistakes).

Thanks again. Hopefully I've got enough to move forward!

sj

spelljammer Wed 16 Sep 2009

Others might find this useful. I was running into a problem in the FANIDE where it wasn't picking up the FAN_HOME environment variable. I think a better solution would be for the IDE to add -Dfan.home=... when launching Fan. However in the meantime, the steps to get Netbeans to pick up new environment variables are not very obvious.

The following link is useful:

http://wiki.netbeans.org/MacOSXEnvForApp

Once you have setup your environment.plist make sure you log out and log back in again, otherwise the changes won't be picked up.

Thanks,

sj

Login or Signup to reply.