Hi, if I have a Java FFI Peer class that defines native methods, how would I configure the build.fan, or the Fantom build environment in general, to allow the class to use other pods?
For example, the following Java FFI class and build.fan:
package fan.acme;
import fan.sys.*;
// not sure how to compile these lines??
import fan.web.WebOutStream;
import fan.web.Cookie;
// or these!?
//import fan.graphics.Size;
//import fan.graphics.Point;
public class SomePeer {
...
}
I'm confident I can find a work around for this (Java class path?) issue, but if I'm just missing a line of config, I'd much rather setup, implement, or configure the official Fantom easy way!
brianSat 4 Feb 2023
The build task will automatically put all your dependent pods into the javac classpath. However, all of your depend pods must have their code pre-generated as Java class files for javac to use. The web pod will not since it has no native code. However, in that case you can use the jstub tool to force your dependent pods to be compiled to Java ahead of time.
SlimerDudeSat 4 Feb 2023
Thanks Brian, I had a feeling that would be the case - but wanted to make sure!
SlimerDude Sat 4 Feb 2023
Hi, if I have a Java FFI Peer class that defines native methods, how would I configure the
build.fan
, or the Fantom build environment in general, to allow the class to use other pods?For example, the following Java FFI class and
build.fan
:When built, gives the following error:
I'm confident I can find a work around for this (Java class path?) issue, but if I'm just missing a line of config, I'd much rather setup, implement, or configure the official Fantom easy way!
brian Sat 4 Feb 2023
The build task will automatically put all your dependent pods into the javac classpath. However, all of your depend pods must have their code pre-generated as Java class files for javac to use. The web pod will not since it has no native code. However, in that case you can use the jstub tool to force your dependent pods to be compiled to Java ahead of time.
SlimerDude Sat 4 Feb 2023
Thanks Brian, I had a feeling that would be the case - but wanted to make sure!