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.AnchorPaneHere is my FXML document (fxmlapp.fxml)
<?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.paint.*?> <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml"> <children> <Label fx:id="label" layoutX="204.0" layoutY="162.0" prefHeight="37.0" prefWidth="225.0" text="Label Here!" /> <Button fx:id="button" layoutX="204.0" layoutY="218.0" mnemonicParsing="false" onAction="action" prefHeight="24.0" prefWidth="156.0" text="Button" /> </children> </AnchorPane>And my fxml application: (fxmlapp.fan)
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!"
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.fanworks 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!