Reputation:
I am trying to write a simple program to plot a line graph using javafx.
I have the following code:
public class Plot extends Application {
public void start(Stage stage){
}
public static void main(String[] args) {
launch(args);
}
}
I want to be able to pass a .csv file as a command line argument when running the program. And access the file from within:
public void start(Stage stage){
}
Upvotes: 1
Views: 371
Reputation: 11050
You can use the getParameters()
method from the Application class (docs).
public class MyApp extends Application {
@Override
public void start(Stage primaryStage) {
// for example list all given parameters
getParameters().getRaw().forEach(System.out::println);
// ...
}
public static void main(String[] args) {
launch(args);
}
}
Upvotes: 3