Ok, here is what I want to do. I need to make thin wrapper classes that will communicate with existing java sources and I need to make sure mypod will distribute theses classes as well. I skimmed through Java FFI and Build but it still leaves me a little befuddled.
1)If I don't include the respective dotnet/ and js/ folders then I can't use mypod with .NET and JavaScript respectively, right?
2)Since my java sources already have an existing package structure should I replicate its structure inside the java/ folder?
3)Do I need to configure some property to make sure those Java sources are added into classpath?
The FFI don't need sources code,just put your jar to classpath
DanielFathTue 28 Sep 2010
Thanks. However I ran into a problem when doing the Classpath approach. Apparently either Fantom can recognize my CLASSPATH enviroment variable or something equally weird is happening. Anyway I've set my CLASSPATH variable to .;D:\dev\lib\mylib.jar And this short java Test program compiles:
import net.mylib.PartOne;
public class Test
{
public static void main(String[] args)
{
System.out.println("hi");
}
}
however when I call fan compilerJava::ClassPath (and using FFI on it doesn't work either), I can't find this net.mylib in the classpath. Placing it in a folder inside my jdk works but I prefer the CLASSPATH env variable approach. Is there any reason why this wouldn't work?
go4Tue 28 Sep 2010
I like this place {fan}lib/java/ext/*.jar.
brianTue 28 Sep 2010
Are you trying to use Fantom to call Java code? If so, the best solution is to use natives or Java FFI.
If you are trying to bundle Fantom code for use by Java, that is a different problem. Jardist will work ok - although you have to write your Fantom code specially so that it doesn't use functions, etc.
DanielFathTue 28 Sep 2010
I'm using the FFI, it works reasonably well; however I want to guarantee that some version of the .jar will be present in the distribution. Is there a mechanism for that?
brianTue 28 Sep 2010
You can stick a Java jar file in lib/java/ext and it is automatically added to the classpath (see fan.sys.FanClassLoader)
AkcelistoWed 29 Sep 2010
I want to know too. How to distribute my program on Fantom for windows-users?
I can write for users this instruction but this instruction is too complicated for common users.
Install Java.
Download and extract Fantom in {FAN_HOME}.
Download and extract MyProg.zip with my program.
Put jars from MyProg.zip in {FAN_HOME}/lib/java/ext.
Put pods from MyProg.zip in {FAN_HOME}/lib/fan.
Change in start.cmd path to Fantom: {FAN_HOME}/bin/fan.
@Akcelisto. A simple way is packing whole fantom directory as your application.
We need an instrument for loading pods from the network,like JWS.
brianWed 29 Sep 2010
The way we distribute software is as a zip file which just contains the entire Fantom runtime, basically just zip up bin, lib, and etc.
We also make copies of the existing Windows and Unix launchers for our program.
Then installation is fairly simple:
Install Java (although most people have it installed)
Unzip
Run
DanielFathWed 29 Sep 2010
IMO a perfect solution would be a way to temporarily add a .jar to fan's classpath like java -classpath for the duration of the session. Any chance of that happening?
tcolarWed 29 Sep 2010
Since Fantom now uses an UrlClassLoader this should be fairly trivial to implement.
DanielFath Tue 28 Sep 2010
Ok, here is what I want to do. I need to make thin wrapper classes that will communicate with existing java sources and I need to make sure
mypod
will distribute theses classes as well. I skimmed through Java FFI and Build but it still leaves me a little befuddled.1)If I don't include the respective
dotnet/
andjs/
folders then I can't usemypod
with .NET and JavaScript respectively, right?2)Since my java sources already have an existing package structure should I replicate its structure inside the
java/
folder?3)Do I need to configure some property to make sure those Java sources are added into classpath?
go4 Tue 28 Sep 2010
There are two way: Natives and JavaFFI
The FFI don't need sources code,just put your jar to classpath
DanielFath Tue 28 Sep 2010
Thanks. However I ran into a problem when doing the Classpath approach. Apparently either Fantom can recognize my CLASSPATH enviroment variable or something equally weird is happening. Anyway I've set my CLASSPATH variable to
.;D:\dev\lib\mylib.jar
And this short java Test program compiles:however when I call
fan compilerJava::ClassPath
(and using FFI on it doesn't work either), I can't find this net.mylib in the classpath. Placing it in a folder inside my jdk works but I prefer the CLASSPATH env variable approach. Is there any reason why this wouldn't work?go4 Tue 28 Sep 2010
I like this place
{fan}lib/java/ext/*.jar
.brian Tue 28 Sep 2010
Are you trying to use Fantom to call Java code? If so, the best solution is to use natives or Java FFI.
If you are trying to bundle Fantom code for use by Java, that is a different problem. Jardist will work ok - although you have to write your Fantom code specially so that it doesn't use functions, etc.
DanielFath Tue 28 Sep 2010
I'm using the FFI, it works reasonably well; however I want to guarantee that some version of the
.jar
will be present in the distribution. Is there a mechanism for that?brian Tue 28 Sep 2010
You can stick a Java jar file in lib/java/ext and it is automatically added to the classpath (see fan.sys.FanClassLoader)
Akcelisto Wed 29 Sep 2010
I want to know too. How to distribute my program on Fantom for windows-users?
I can write for users this instruction but this instruction is too complicated for common users.
Where MyProg.zip is:
go4 Wed 29 Sep 2010
@Akcelisto. A simple way is packing whole fantom directory as your application.
We need an instrument for loading pods from the network,like JWS.
brian Wed 29 Sep 2010
The way we distribute software is as a zip file which just contains the entire Fantom runtime, basically just zip up bin, lib, and etc.
We also make copies of the existing Windows and Unix launchers for our program.
Then installation is fairly simple:
DanielFath Wed 29 Sep 2010
IMO a perfect solution would be a way to temporarily add a
.jar
to fan's classpath likejava -classpath
for the duration of the session. Any chance of that happening?tcolar Wed 29 Sep 2010
Since Fantom now uses an UrlClassLoader this should be fairly trivial to implement.