Problem with running the app outside NetBeans (loading fxml from jar)

Hello.
this problem occurs only when NOT using NetBeans (becouse NB may use this normal file sctructure, without jars)
here is part of my main class, start method
        //load FXMLs
        FXMLLoader primaryLoader = new FXMLLoader();
        URL primaryLocation = getClass().getResource("PrimaryStage.fxml");
        primaryLoader.setLocation(primaryLocation);
        Parent root = (Parent) primaryLoader.load();
        Scene primaryScene = new Scene(root);
        FXMLLoader secondaryLoader = new FXMLLoader();
        URL secondaryLocation = getClass().getResource("SecondaryStage.fxml");
        secondaryLoader.setLocation(secondaryLocation);
        System.out.println("sec loader = " +secondaryLoader.toString()
                +"\n sec loc from loader = "+secondaryLoader.getLocation()
                +"\n sec loc url = " + secondaryLocation
                +"\n pri loc url = " + primaryLocation);
        Parent secondaryRoot = (Parent) secondaryLoader.load();
        Scene secondaryScene = new Scene(secondaryRoot);and the thing is the 1st url (primaryLocation) is loaded properly, and the secondLocation aint.
those 2 files are both in the same jar, same folder (packege) as main class.
the outcome looks like this
sec loader = javafx.fxml.FXMLLoader@5bde2a20
sec loc from loader = null
sec loc url = null
pri loc url = jar:file:/C:/test_workspace/NetBeans/MZlike/dist/MoreAdvStuff.jar!/moreadvstuff/PrimaryStage.fxml
Exception in Application start method
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.javafx.main.Main.launchApp(Main.java:486)
        at com.javafx.main.Main.main(Main.java:638)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
        at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.load(Unknown Source)
        at moreadvstuff.MoreAdvStuff.start(MoreAdvStuff.java:55)
        at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
        at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
        ... 1 morewhere 55 line is
Parent secondaryRoot = (Parent) secondaryLoader.load();any ideas how to fix it? loading the file manually from the jar may be a way, but its a workaround, not a solution
Edited by: Radosław on 2012-05-17 07:55

Hi,
The root cause of the exception appears is here:
sec loc url = nullThis means that the URL returned here by getResource() was null:
        URL secondaryLocation = getClass().getResource("SecondaryStage.fxml");So the only thing you have to do is figure out why this call returned null. Usually it returns null if the resource is not found in the jar/classpath.
Last time it happened to me it was because I had misspelled the file name.
Check that your file is not named SecondaryStage,fxml instead of SecondaryStage.fxml or something like that. Also check that it's actually present in the jar - or in the build/ directory and at the expected place (next to the class that loads it).
Hope this helps,
-- daniel

Similar Messages

  • Problem with running the midlet class (Error with Installation suite )

    hi everyone...
    i have problem with running the midlet class(BluetoothChatMIDlet.java)
    it keep showing me the same kind of error in the output pane of netbeans...
    which is:
    Installing suite from: http://127.0.0.1:49296/Chat.jad
    [WARN] [rms     ] javacall_file_open: wopen failed for: C:\Users\user\javame-sdk\3.0\work\0\appdb\delete_notify.dat
    i also did some research on this but due to lack of forum that discussing about this,im end up no where..
    from my research i also find out that some of the developer make a changes in class properties..
    where they check the SIGN DISTRIBUTION...and also change the ALIAS to UNTRUSTED..after that,click the EXPORT KEY INTO JAVA ME SDK,PLATFORM,EMULATOR...
    i did that but also didnt work out..
    could any1 teach me how to fix it...
    thanx in advance... :)

    actually, i do my FYP on bluetooth chatting...
    and there will be more than two emulators running at the same time..
    one of my frens said that if u want to run more than one emulator u just simply click on run button..
    and it will appear on the screen..

  • I ve a problem with running the javabeans

    dear all
    i ve a problem with running javabean in forms 9i all codes, program units are correct. i think there is something with classpath which i dont where to put the path of bean jar files. however the simple code for the Colorpicker and keyFilter dont work when clicking the button to fire the trigger to bring the bean up.
    thank you
    Walaa eddien

    Walaa,
    Make sure you've entered the implementation class (do not append the class extension). For example, if you have a class example.class in the package otn.oracle.forum, the implementation class should be: otn.oracle.forum.example
    Make sure you place the containing java archive in <OH>/forms90/java and do not forget to update the configuration section (default or app specific) parameter archive_jini accordingly.
    Jeroen van Schaijk

  • [SOLVED] Problem with running GUI apps as root

    Hi,
    I have a serious problem with running any kind of software having GUI as root, which is indispensable for editing system files. For example I want to edit /etc/pacman.conf file with KWrite, and here's what I get
    [zbyszek@barca ~]$ xhost +
    access control disabled, clients can connect from any host
    [root@barca zbyszek]# kwrite /etc/pacman.conf
    kwrite(11282): Session bus not found
    KCrash: Application 'kwrite' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    sock_file=/root/.kde4/socket-barca/kdeinit4__0
    Warning: connect() failed: : Nie ma takiego pliku ani katalogu
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi directly
    drkonqi(11284): Session bus not found
    Can anyone help me with this? Can anyone tell me how to login as root?
    Thank you in advance.
    Last edited by Zibi1981 (2010-10-05 19:30:20)

    O.K., but how to run KWrite as root on my account??? That was my main question
    karol wrote:
    Try running 'xhost +' as root.
    https://bbs.archlinux.org/viewtopic.php?pid=817674
    Maybe vim is in edit mode when you press 'i' but it doesn't show '-- INSERT --' at the bottom of the screen.
    Here you are
    [root@barca zbyszek]# xhost +
    access control disabled, clients can connect from any host
    [root@barca zbyszek]# kwrite /etc/pacman.conf
    kwrite(12941): Session bus not found
    KCrash: Application 'kwrite' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    sock_file=/root/.kde4/socket-barca/kdeinit4__0
    Warning: connect() failed: : Nie ma takiego pliku ani katalogu
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi directly
    drkonqi(12942): Session bus not found
    Last edited by Zibi1981 (2010-09-25 10:19:50)

  • Problems with running the interop sample

    Hi,
    I can't seem to run the .NET client that is supplied with the interop samples
    in the workshop that demonstrates the use of a .NET client with an asnyc WebLogic
    web service. Everytime I run the .NET client, it prompts me to save a file called
    "ConversationClient.asmx" and if I open it, its opened in VS .NET. Any ideas/suggestions?
    Thanks,
    August

    August,
    The readme.html which is present in the samples/interop/dotNet directory
    provides detailed instructions for running that example. Please follow the
    steps mentioned in there, and let me know if you face any issues.
    Regards,
    Anurag
    "August" <[email protected]> wrote in message
    news:3e56b164$[email protected]..
    >
    Hi,
    I can't seem to run the .NET client that is supplied with the interopsamples
    in the workshop that demonstrates the use of a .NET client with an asnycWebLogic
    web service. Everytime I run the .NET client, it prompts me to save a filecalled
    "ConversationClient.asmx" and if I open it, its opened in VS .NET. Anyideas/suggestions?
    >
    Thanks,
    August

  • [perhaps stupid] Problem with running the Sun's example

    I am new to RMI and I was reading the tutorial of RMI provided by Sun. Now the question is: suppose I have examples.hello.HelloImpl class compiled and I want to run rmic in order to create stub and skeleton files. In which directory should I run rmic?

    Run rmic from the directory where rmic can pick your classes.
    As an example if your compiled client class is in
    c:\rmitest\classes
    run the rmic from there and make sure you specify -d . then it will generate the stubs and skeletons in the same directory. If you want to compile them somewhere else specify -d option to that folder.
    Example use
    to store stubs and skeletons in the same directory
    c:\rmitest\classes> rmic -d . foo (where foo is your class name)
    to store stubs and skeletons in a separate directory
    c:\rmitest\classes> rmic -d "c:\mystubs\" foo (where foo is your class name)
    Hope this helps :)

  • I am having problem with speaker the sound is not coming properly from it also the right side hinges

    Hi,
    I am having problem with speaker from last few days when ever i tryed to play songs the speaker is not giving sound properly. Secondly the the right side hinges also boken so needed support for both the problems.
    Thanks & Regards 
    Umender Sahani

    First, try to reset the phone by holding the sleep and home button for about 10sec, until the Apple logo comes back again. You will not lose data by resetting.
    If this does not help, set it up as new device, explained here:
    How to erase your iOS device and then set it up as a new device or restore it from backups
    If still no luck, get it checked by visiting an Authorized Apple Service Provider or contact Apple Support to get it serviced:
    iPhone - Contact Support - Apple Support

  • Problems with running modify marshall  in netbeans

    Hello everyone , i am new to jwebservices and read the sun tutorials. So i want to try out the sample codes expecially the marshall ones. but it could not run and gave the following error in netbeans:
    Problem: The project uses a class library called "jaxb20", but this class library was not found.
    Solution: Click Resolve to open the Library Manager and create a new class library called "jaxb20".
    i went to java.net to download the jaxb2_20051223.jar and jaxb2_20060426.jar but it stilled did not see it.
    Please help me out

    Thanks.
    I'm running both applications as the same user. All other aspects of the application and code work perfectly - just running that script using the Runtime method.
    Basically, everything is exactly the same between to the two machines - only the difference in OS version.
    I'm guessing that it well may be a Linux problem, sorry if this is the wrong forum. I'm just at a complete loss with this!

  • HT1430 I have problem with dowloding the apps

    Canot download apps

    Hey peja1971,
    Thanks for the question. Are you receiving an error message when attempting to download applications? When troubleshooting iTunes Store connection issues, the following articles provide the best information:
    First, try signing out of your account in Settings > iTunes & App Store. Once signed out, go ahead and sign back in.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    If the above did not resolve your issue, refer to the following:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    Troubleshoot issues on an iPhone, iPad, or iPod touch
    If you haven't been able to connect to the iTunes Store:
    - Make sure your date, time, and time zone are correct in Settings > General > Date & Time.
              Note: Time Zone may list another city in your time zone.
    - Make sure that your iOS software is up to date by tapping Settings > General > Software Update (iOS 5 or later) or connecting your iOS device to iTunes and clicking Check for Update on your device's Summary page.
    - Check and verify that you're in range of a Wi-Fi router or base station. If you're on a device with cellular service, make sure that cellular data is turned on from Settings > General > Cellular.
              Note: If connected to cellular data, larger items may not download. You may need to connect to Wi-Fi to download apps, videos, and podcasts.
    - Make sure that you have an active Internet connection. You can check the user guidefor your device for help with connecting to the Internet.
    - Make sure that other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the Internet.
    - Try resetting (turning off and then on again) your Wi-Fi router.
    - If the issue persists, try troubleshooting your Wi-Fi networks and connections.
    Thanks,
    Matt M.

  • TS3212 I have a problem with running the itunes download on my new toshiba satellite pro laptop,

    I have downloaded the iTunes software no problems, but when i come to run it a windows pop up comes up saying,
    "This installation package could not be opened. Verify that the package exists and that you can access it, or contact
    the application verifier to verify that this is a valid window installer package"
    as i mentioned it is a brand new Toshiba satellite pro running windows 7 professional,
    any ideas????????????
    mark

    A lot of people have found this works for them:
    Settings/General/Date and Time   Turn OFF Set Automatically
    Set the date to several years in the future
    Try to update again - you will get a different error message
    Go back and turn ON Set Automatically

  • Problems with Running the Examples in J2ee tutorial-asant utility

    Hello,
    I am just working on the examples given in the J2EE tutorials given by SUN.
    When trying to build the examples using the asant utility,I encounter an error message saying
    "BUILD FAILED"
    and it says some error with the build.xml file (C:\lib not found)
    I think i have all my CLASSPATH settings and PATH setting right.Can anyone suggets me a solution to this problem,so that i can go ahead with the details.
    Thanks
    Sandeep

    did you set the build.properties settings properly ?

  • Problems with Running the application with adobe interactive form

    Hi,
    I am pasting the error below. Can you tell me whats happening?
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Error during call to AdobeDocumentServer: Processing exception during a "Render" operation.
    Request start time: Wed Sep 14 13:11:22 CEST 2005
    com.adobe.ProcessingError: File not found error writing stream:
    <Render><Template><Name> "http://inld50047142a:53000/webdynpro/dispatcher/local/IAF29/IAF29/wd_keyFCf_HVR6LN8eiYL61rWjaQ==/sapwebdynpro.xft;jsessionid=(INLD50047142A_F21_30)ID305519150DB14134377352030124527End;saplb_*=(INLD50047142A_F21_30)305519150?sap.session.download=4&sap-wd-cltwndid=4&sap-wd-appwndid=OPCP4&sap-wd-norefresh=true :
    java.io.FileNotFoundException: IO error detected while retrieving input stream for: http://inld50047142a:53000/webdynpro/dispatcher/local/IAF29/IAF29/wd_keyFCf_HVR6LN8eiYL61rWjaQ==/sapwebdynpro.xft;jsessionid=(INLD50047142A_F21_30)ID305519150DB14134377352030124527End;saplb_*=(INLD50047142A_F21_30)305519150?sap.session.download=4&sap-wd-cltwndid=4&sap-wd-appwndid=OPCP4&sap-wd-norefresh=true :
    java.io.IOException: Server returned HTTP response code: 500 for URL: http://inld50047142a:53000/webdynpro/dispatcher/local/IAF29/IAF29/wd_keyFCf_HVR6LN8eiYL61rWjaQ==/sapwebdynpro.xft;jsessionid=(INLD50047142A_F21_30)ID305519150DB14134377352030124527End;saplb_*=(INLD50047142A_F21_30)305519150?sap.session.download=4&sap-wd-cltwndid=4&sap-wd-appwndid=OPCP4&sap-wd-norefresh=true
    Thanks,
    Tarun.

    did you set the build.properties settings properly ?

  • Problems with Mails when stored outside of Mail app as .eml or .rtfd files

    Sometimes I have to archive E-mails, which belong to certain projects, outside of Mail app in a finder folder together with a project, to save them together externally. I save them by one of the following methods:
    (a) Drag the Message right from Mail app into a finder folder. This works fine, but in this case, when I use Spotlight search, it seems that Spotlight does not find these E-mails (.eml files) any more.
    (b) To solve this problem, I use the "Save as" ("Speichern unter") command from Mail app. By doing so a RTF file is created which is properly indexed by Spotlight.
    When the E-mail contains one ore more JPG files, a RTFD file is created. But these pictures are missing in the RTFD file! In Tiger they were properly included in the RTFD file, but in Leopard they are not.
    Seems like two Leopard bugs. I have already sent a feedback to Apple, but I would like to know if others have the same issues and if there is a solution to them?

    Mulder, first let me thank you very much for you taking your time to help me understand.
    Let me more precise: As long as I was using Panther or Tiger, I was able to save any email - be it a sent or received one - that included files - be it pictures or anything else like doc, xls or zip - to an RTFD file by using the "Save as" comand from the file menu. The resulting RTFD file then properly contained the files. I am absolutely certain that it did not make any difference what kind of attachment was included in the original message, they were all perfectly saved within the RTFD container. I did this for years.
    Since I use Leopard, the very same comand produces RTFD files as well, containing the text file, but not a single one of the attached files.

  • I have a 1st gen ipad. Want to play Candy Crush. Installed app from app store. I hit play now, I see the board then the pad goes back to the start screen (the one with all the apps displayed). Do I need additional apps to run? Thanks.

    I have a 1st generation iPad. Want to play Candy Crush Saga. Installed app from Apple Store. When I tap on the app, I wait a long time while it reads "loading" then I hit "play", I see the board then the ipad goes back to the ipad start screen (the one with all the apps displayed). Is there some additional program I need to play this type of game. I know that space is not an issue as I have very little stored. Thanks.
    Just found my answer. Worked perfectly. Instructions very clear.

    try uninstalling the app and reinstalling it. u shouldnt need to install anything else but the app itself to get it running. if that doesnt work then update ur software and see if that works.

  • HT4009 Do you understand me ? I want money back.Because I have problem with LINE In App Purchase.And no one try to resolve this problem.And the answer of NEVER LINE JAPAN they don't have responsibility.I think it will be effect with APPLE image also.I wan

    Do you understand me ? I want money back.Because I have problem with LINE In App Purchase.And no one try to resolve this problem.And the answer of NEVER LINE JAPAN they don't have responsibility.I think it will be effect with APPLE image also.I want you to help me everyways to refound my monet back.Could you?

    Contact iTunes Store Support.

Maybe you are looking for