To compile code using JavaFX from Windows, you must leverage the Java Compiler and specify the correct classpath.
Oracle Java 8 and Newer: JavaFX classes are included in the default runtime classpath, allowing you to compile and run code using:
javac Fxservidor.java java Fxservidor
OpenJDK 8: JavaFX sources require compilation and inclusion of the resultant jfxrt.jar in the classpath:
javac -classpath "$JAVAFX_SDK_HOME/rt/lib/jfxrt.jar" Fxservidor.java java -classpath "$JAVAFX_SDK_HOME/rt/lib/jfxrt.jar:." Fxservidor
For Java 7, the process is slightly different:
"%JDK_HOME%\bin\javac" -classpath "%JAVAFX_SDK_HOME%\rt\lib\jfxrt.jar" Fxservidor.java java -classpath "%JAVAFX_SDK_HOME%\rt\lib\jfxrt.jar;." Fxservidor
Tips:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Fxservidor extends Application {
public static void main(String[] args) {
launch(args);
}
@Override public void start(Stage primaryStage) {
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3