IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaFX Discussion :

erreur lecture fichier .fxml d'un autre package


Sujet :

JavaFX

  1. #1
    Membre à l'essai
    Homme Profil pro
    dev
    Inscrit en
    Octobre 2020
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : dev

    Informations forums :
    Inscription : Octobre 2020
    Messages : 25
    Points : 16
    Points
    16
    Par défaut erreur lecture fichier .fxml d'un autre package
    Bonjour j'essaye de charger un .fxml qui est dans un package view dans mon main qui est dans un package main mais une grosse erreur apparaît si quelqu'un a une réponse ou des infos svp.
    j'utilise java 11 + sdk 11 pour javafx
    voici mon eclipse que vous voyez l'arborescence et l'erreur
    Nom : 1.png
Affichages : 263
Taille : 181,0 Ko
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    Exception in Application start method
    java.lang.reflect.InvocationTargetException
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
    Caused by: java.lang.RuntimeException: Exception in Application start method
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    	at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.NullPointerException: Location is required.
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3230)
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
    	at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
    	at monModule/main.Main.start(Main.java:20)
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    	... 1 more
    Exception running application main.Main

  2. #2
    Rédacteur/Modérateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Août 2005
    Messages
    6 845
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : Nouvelle-Calédonie

    Informations professionnelles :
    Activité : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Août 2005
    Messages : 6 845
    Points : 22 859
    Points
    22 859
    Billets dans le blog
    51
    Par défaut
    Probablement que l'URL retournée par getClass().getResource([...]) est null. Déjà utilise pas File.separator pour accéder à des données dans un JAR, utilise directement / et ensuite vérifie que le chemin construit est correct par rapport au package courant.

    PS : mettre du code plutôt qu'une grosse image, c'est mieux.
    Merci de penser au tag quand une réponse a été apportée à votre question. Aucune réponse ne sera donnée à des messages privés portant sur des questions d'ordre technique. Les forums sont là pour que vous y postiez publiquement vos problèmes.

    suivez mon blog sur Développez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Lecture fichier fxml à partir d'un autre package
    Par javast dans le forum JavaFX
    Réponses: 3
    Dernier message: 10/05/2013, 08h42
  2. Erreur lecture fichier sur mac
    Par duuh_ dans le forum Fortran
    Réponses: 8
    Dernier message: 14/04/2011, 20h02
  3. erreurs lecture fichier
    Par capucine1983 dans le forum Entrée/Sortie
    Réponses: 3
    Dernier message: 15/07/2007, 08h19
  4. Erreur lecture fichier avi
    Par ooyeah dans le forum Windows XP
    Réponses: 4
    Dernier message: 11/04/2007, 22h19
  5. Erreur dans fichier de test d'un package
    Par momotsurugi dans le forum Oracle
    Réponses: 2
    Dernier message: 27/04/2006, 20h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo