• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Big obstacle to running JavaFX

 
Phil D'Agostino
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry...I am not exactly a beginner in Java - have built some
programs in the pre-javaFX days...but am having a problem
with FX...and hope someone here can help.

I downloaded and installed the latest SDK for my OS ( Windows XP )
which is 7u79. This is supposed to contain the JavaFX classes.

Then I copied a simple helloworld source file from a website - using
FX of course - and tried to compile it ( command line ).

19 errors - mostly "Cannot find symbol xxx" all of them from
JavaFX..

I've uninstalled and reinstalled...nothing works...how to do this??

Thanks for any suggestions...

JPhil
 
Phil D'Agostino
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an addition to my previous post.
Here is the code I used ( from the Oracle site):

package helloworld;

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 HelloWorld extends Application {
public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {

@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});

StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
}

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, the JavaFX jar (jfxrt.jar) is not part of default compiler classpath in JDK1.7. So you have to explicitly specify the JAR as part of compilation classpath.


Alternately, install JDK1.8, where this is not necessary because JavaFX is already part of default classpath. Another reason to use JDK1.8 is that its JavaFX version (JavaFX 8) has many more goodies than the older JavaFX 2.2.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Shiraly wrote:Unfortunately, the JavaFX jar (jfxrt.jar) is not part of default compiler classpath in JDK1.7. So you have to explicitly specify the JAR as part of compilation classpath.

Good catch, and good advice. Have a cow!

Karthik Shiraly wrote:Alternately, install JDK1.8

Unfortunately that isn't an option for WinXP.
Phil D'Agostino wrote:I downloaded and installed the latest SDK for my OS ( Windows XP ) which is 7u79.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! I had no idea till now JDK1.8 is not supported on WinXP. However, a search turned up this advisory which seems to suggest JDK 8 update 25 onwards should be good on WinXP? Not sure. But anyway something new (and I must say a tad shocking ) learnt today.

Thanks for the cow and the education, Darryl!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic