I'm trying to load an FXML document into a Fantom application but I'm getting the error: java.lang.ClassNotFoundException: javafx.scene.layout.AnchorPane
using [java] javafx.application::Application
using [java] javafx.scene.layout::AnchorPane
using [java] javafx.stage::Stage
using [java] javafx.scene::Scene
using [java] javafx.scene.control::Label
using [java] javafx.scene.control::Button
using [java] javafx.scene::Parent
using [java] javafx.fxml::FXML
using [java] javafx.fxml::FXMLLoader
using [java] javafx.fxml::Initializable
using [java] java.net::URL
using [java] java.util::ResourceBundle
using [java] java.io::File
class Hello : Application {
Void main(Str[] args) {
Application.launch(Hello#->toClass, args)
}
override Void start(Stage? stage) {
URL fxml := File("fxmlapp.fxml").toURI().toURL()
fxmlLoader := FXMLLoader(fxml)
fxmlLoader.setController(Controller.make())
root := fxmlLoader.load()
stage.setTitle("FXML-App in Fantom!")
stage.setScene(Scene(root))
stage.show()
}
}
class Controller : Initializable {
@FXML protected Void action() {
echo("TOUCHDOWN!")
}
override Void initialize(URL? location, ResourceBundle? resources) {}
}
Lastly I wanted to say: "Wow! What a terrific language this is! Keep up the good work!"
brianWed 22 Jan 2014
It sounds like just a classpath issue. You can run this command to debug your Java classpath to see what classes the compiler has visibility to:
fan compilerJava::ClassPath
inyourcornerWed 22 Jan 2014
brian - I was thinking the same. I looked around a bit and on http://fantom.org/doc/docTools/Setup.html I saw you can run fan with the java commandline java -cp "%CLASSPATH%;%FAN_HOME%\lib\java\sys.jar" fanx.tools.Fan fxmlapp.fan works great so I'll use that and in my spare time continue to debug the classpath issue through your suggestion. Helpful and responsive community here!
inyourcorner Wed 22 Jan 2014
I'm trying to load an FXML document into a Fantom application but I'm getting the error:
java.lang.ClassNotFoundException: javafx.scene.layout.AnchorPane
Here is my FXML document (fxmlapp.fxml)
And my fxml application: (fxmlapp.fan)
Lastly I wanted to say: "Wow! What a terrific language this is! Keep up the good work!"
brian Wed 22 Jan 2014
It sounds like just a classpath issue. You can run this command to debug your Java classpath to see what classes the compiler has visibility to:
inyourcorner Wed 22 Jan 2014
brian - I was thinking the same. I looked around a bit and on http://fantom.org/doc/docTools/Setup.html I saw you can run fan with the java commandline
java -cp "%CLASSPATH%;%FAN_HOME%\lib\java\sys.jar" fanx.tools.Fan fxmlapp.fan
works great so I'll use that and in my spare time continue to debug the classpath issue through your suggestion. Helpful and responsive community here!