first things first that need to be said: I am really new at java developement and also this is my first post on StackOverflow. So i would really appreciate, if you people could give me general tips if i am doing something wrong with this thread i am opening. Now i have never built an executable java project before and i tried building my first project with Eclipse. Somehow though, i get an error when starting the jar file which is as follows:
`java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at application.Main.start(Main.java:46)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Unknown Source)`
And here is my class that causes the problem. I am sorry for any weird comments or println's i was trying to debug.
package application;
import java.util.ArrayList;
import java.util.HashMap;
import controller.SplendorController;
import controller.TurnController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import model.Bank;
import model.Card;
import model.Player;
import model.Resource;
import model.Tree;
import model.Turn;
import view.MainScreenController;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
System.out.println("test");
SplendorController splendorC = new SplendorController();
/* ArrayList<Player> players = new ArrayList<>();
players.add(new
Player("Klaus", model.Mode.HUMAN)); players.add(new
Player("Dieter", model.Mode.HUMAN));
players.add(new
Player("Dieter2", model.Mode.HUMAN));
Turn currentTurn =
splendorC.getGameController().setUpGame(players);
Tree<Turn> currentTurnTree = new Tree<Turn>(currentTurn);
//System.out.println("Das ist der Baum : " + splendorC.getAIController().
//generateTreeRecursiveUntilDepth(currentTurnTree, currentTurnTree, 2));
long startTime = System.nanoTime();
System.out.println("Das ist der errechnete Zug" + splendorC.getAIController().turnHard());
System.out.println((double)(System.nanoTime() - startTime)/ 1_000_000_000 + " seconds.");*/
FXMLLoader loader = new FXMLLoader(getClass().getResource("../view/main1610.fxml"));
BorderPane root = (BorderPane) loader.load();
MainScreenController _MainScreenController = (MainScreenController) (loader.getController());
_MainScreenController.setSpc(splendorC);
splendorC.getIOController().save("./saved_games/game");
// MainScreenController.setSplendidController(_SplendidController);
// Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
// StyleManager.getInstance().addUserAgentStylesheet(getClass().getResource("application.css").toString());
Scene scene = new Scene(root);
// new JMetro(scene, Style.LIGHT);
// scene.getStylesheets().add("./application/application.css");
primaryStage.setScene(scene);
primaryStage.setTitle("Splendid");
primaryStage.setFullScreen(true);
primaryStage.show();
String uriString = new String(
getClass().getResource("/sounds/Ascence - About You [NCS Release].mp3").toURI().toString());
/*
* Media media = new Media(uriString); MediaPlayer player = new
* MediaPlayer(media); MediaView mv = new MediaView(player);
* root.getChildren().add(mv);
*
* player.cycleCountProperty().set(MediaPlayer.INDEFINITE);
* player.setVolume(0.30); player.play();
*/
_MainScreenController.setSpc(splendorC);
_MainScreenController.init(primaryStage);
/*
* SampleViewController sampleViewController = new
* SampleViewController(); Scene scene = new
* Scene(sampleViewController,400,200);
* scene.getStylesheets().add(getClass().getResource(
* "application.css").toExternalForm());
* primaryStage.setScene(scene); primaryStage.show();
*/
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}