#672 Calling Fan from Java

tcolar Thu 16 Jul 2009

I thought it would be cool to implement the Fan Netbeans plugin in Fan, however netbeans is written in Java, and I need to implement some SPI's (implement/subclass things defined by Netbeans language support API's).

So basically the Java would call those Fan implementation at runtime.

I've seen a few (mostly old) posts about this but could not conclude whether it's doable at this time ?

It seem I could implement / subclass in Fan and compile that against the Java just fine (build).

Then I would use the tool(jstub) to convert the pod into a java jar, then i could put that jar and other fan runtime jars(pods?) and ... then it would work (classloader ?)?

Any advice / step by step instructions on this process, or wether i should just bag it for now (fine with me, just asking )

Thanks.

tcolar Thu 16 Jul 2009

Since it seem fanlauncher just call a standard jvm it should work.

I see it adds the fan libs in the classpath when it starts.

I think as far as Netbeans go, i would probably ask the user for path to fan distro anyway (so i can run compiler etc...), then I could probably register/load the libs then.

Anything else i'm missing ?

brian Thu 16 Jul 2009

As long as you don't hit the override restrictions, then you should be able to subclass a normal Java class with a Fan class.

You can use jstub to generate the jars (or use the pods themselves as jars). You still need the pod files for Fan reflection stuff.

Do you have a simple use case you can use to get everything working end to end? If so I can help walk thru the steps and potentially fix anything you run across. I think it would be well worth trying to do the plugin in Fan proper.

tcolar Thu 16 Jul 2009

I'll do a dummy thing first to test.

Will do an implementation of FileFilter in fan and have that called from a small java App and see how that goes and what steps are involved (and maybe rig an ant script for that)

If all goes well, then I'll try the real stuff.

Thanks.

cheeser Thu 16 Jul 2009

If you look at the code in tradewinds, I bootstrap a fan environment in a servlet container. http://kenai.com/projects/tradewinds/

tcolar Thu 16 Jul 2009

Thanks, will have a look. I like Kenai a lot by the way.

Login or Signup to reply.