However as this is an example this strikes me as odd. Tell me in what folder is your FwtDemo.fan? Have you moved it or anything?
kheironThu 30 Sep 2010
hi, thanks for a speedy reply, yes I have moved it, I believe to learn I needed to start on a clean slate so I created a folder structure similar to the one used in the example of hello world. for a minute there I thought I needed to pull the dependency pods as well. another question, If Im to deploy a stand alone application, does it need to take the whole fantom library with it? I ask this because I noticed the when building an app, the pod is placed inside the fantom installation. is there a way to define a specific directory where I want my pods to be placed, it will help separate the default ones to the ones I built
Thanks again
kheironThu 30 Sep 2010
Thank you again for the help, I managed to build the demo but when running fan FwtDemo I encounter ERROR: sys::UnknownTypeErr: FwtDemo::Main
I dont know why this error because the Main function is specified, I think I cant run this app as a pod because it has beed created as a script, the only way I managed to get it to work was running it as a script from the console
kheiron$ fan fan/FwtDemo.fan
please confirm or rebuke my assumptions
DanielFathThu 30 Sep 2010
For the Fantom dropping pods into the lib directory well, I'm not sure if the behavior can be changed. As for the other part, see the problem is that FwtDemo is a script not a pod. IIRC when running like a pod you need a class Main with function main() in order to run it.
For example if you started with fwt/hello.fan
using gfx
using fwt
**
** FwtHello is as simple as it gets
**
class FwtHello
{
Void main()
{
Window
{
size = Size(300,200)
Label { text = "Hello world"; halign=Halign.center },
}.open
}
}
using gfx
using fwt
**
** FwtHello is as simple as it gets
**
class Main //Line changed
{
Void main()
{
Window
{
size = Size(300,200)
Label { text = "Hello world"; halign=Halign.center },
}.open
}
}
Would yield result. As for the FwtDemo.fan I tried altering it but in the same manner but there seems to be a null coercion error when just renaming it into FwtDemo -> Main and I don't have the time nor patience to debug it. So if you really wanna run it as a pod I leave it to you :P
kheironThu 30 Sep 2010
thanks, I think I get it now, I will play with it some more while trying to understand it. thanks again for your help
brianThu 30 Sep 2010
check out docTools for how to run code within pods
if your main class is called FwtMain then you can use:
fan mypod::FwtMain
DanielFathThu 30 Sep 2010
@brian: didn't know that, thanks. One issue still remains unsolved; is there a way to make Fantom run pods without it being dropped in the FAN_HOME\lib\fan folder?
brianThu 30 Sep 2010
One issue still remains unsolved; is there a way to make Fantom run pods without it being dropped in the FAN_HOME\lib\fan folder?
That is the simplest way. Although in Fantom, the sys::Env API provides a similiar role as Java's ClassLoader in that you can create your own pod loading designs.
kheiron Thu 30 Sep 2010
Hi guys, just started with fantom, I like what I see, but its hard to get some examples running
I get this error fan/FwtDemo.fan(10,1): Using
gfx
which is not a declared dependency forFwtDemo
How do I declare dependencies in fantom, do I need those pods in the same folder as the .fan files
Please help, Im stuck
DanielFath Thu 30 Sep 2010
Hi kheiron in order to be able to use
using gfx
you need to go to your build.fan and add a dependency.However as this is an example this strikes me as odd. Tell me in what folder is your FwtDemo.fan? Have you moved it or anything?
kheiron Thu 30 Sep 2010
hi, thanks for a speedy reply, yes I have moved it, I believe to learn I needed to start on a clean slate so I created a folder structure similar to the one used in the example of hello world. for a minute there I thought I needed to pull the dependency pods as well. another question, If Im to deploy a stand alone application, does it need to take the whole fantom library with it? I ask this because I noticed the when building an app, the pod is placed inside the fantom installation. is there a way to define a specific directory where I want my pods to be placed, it will help separate the default ones to the ones I built
Thanks again
kheiron Thu 30 Sep 2010
Thank you again for the help, I managed to build the demo but when running fan FwtDemo I encounter ERROR: sys::UnknownTypeErr: FwtDemo::Main
I dont know why this error because the Main function is specified, I think I cant run this app as a pod because it has beed created as a script, the only way I managed to get it to work was running it as a script from the console
kheiron$ fan fan/FwtDemo.fan
please confirm or rebuke my assumptions
DanielFath Thu 30 Sep 2010
For the Fantom dropping pods into the lib directory well, I'm not sure if the behavior can be changed. As for the other part, see the problem is that FwtDemo is a script not a pod. IIRC when running like a pod you need a
class Main
with functionmain()
in order to run it.For example if you started with fwt/hello.fan
You'd get this
But changing one little line.
Would yield result. As for the
FwtDemo.fan
I tried altering it but in the same manner but there seems to be a null coercion error when just renaming it into FwtDemo -> Main and I don't have the time nor patience to debug it. So if you really wanna run it as a pod I leave it to you :Pkheiron Thu 30 Sep 2010
thanks, I think I get it now, I will play with it some more while trying to understand it. thanks again for your help
brian Thu 30 Sep 2010
check out docTools for how to run code within pods
if your main class is called
FwtMain
then you can use:DanielFath Thu 30 Sep 2010
@brian: didn't know that, thanks. One issue still remains unsolved; is there a way to make Fantom run pods without it being dropped in the
FAN_HOME\lib\fan
folder?brian Thu 30 Sep 2010
That is the simplest way. Although in Fantom, the sys::Env API provides a similiar role as Java's ClassLoader in that you can create your own pod loading designs.