Load jar from jar in applet

hi i made an applet that read xml files.
i using in jaxp.jar and in parser.jar currently i put them in ext folder in plug in. is there any other way to put them in my jar applet file and to load them from there.

The xml stuff is one of the optional packages you can install and belongs in the /ext (extension) folder just like you have it. Possibly, this will be integrated in the v1.4 release, but I'm not sure about that. Anyway, my best advice for you is to follow the instructions Sun gives on exactly this situation:
http://java.sun.com/j2se/1.3/docs/guide/extensions/extensions.html
Also on this page is a link to Optional Package Versioning that I highly recommend you read, as it details how the v1.3 plug-in will automatically install the xml jars on the client machine for you. It doesn't get any easier than this! :-)
-Ron

Similar Messages

  • Loading library from jar file

    Hi all,
    My question is can we load library from jar file using System.load() method.
    ex:
    myJar.jar
    |
    |----com.test.common.Util
    which conatins a method to load library from jar file itself, before that i used to load from File
    |---libraries/MozillaParser/......
    Iam able load from Local system,
    File parserLibraryFile = new File("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    File mozillaDistBinDirectory = new File("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(parserLibraryFile.getAbsolutePath() , mozillaDistBinDirectory.getAbsolutePath());
    but i am unable to load from jar file
    URL url = ClassLoader.getSystemClassLoader().getResource("libraries/MozillaParser" + EnviromentController.getSharedLibraryExtension());
    URL url1 = ClassLoader.getSystemClassLoader().getResource("libraries/mozilla.dist.bin."+EnviromentController.getOperatingSystemName());
    MozillaParser.init(url.toString(), url1.toString());
    Thanks in advance.

    That's a really confusing post.
    The easiest way to make sure you can use the classes in a jar file is to copy the jar file to the "/jre/lib/ext" subfolder of your JDK. These classes will be visible to all applications.

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • Loading image from jars only once in oracle forms 10g

    Hi,
    I have an oracle forms 10g application which loads image from a jar. Every time i click on a button "A" that loads the image "image" on another button "B" in the same screen, a message is displayed in the java console "Loaded image: jar:https://+IP+/forms/java/+myjar+.jar!/image.gif". So after 10 clicks, i get the same message displayed 10 times. In the form, i've called:
    SET_CUSTOM_PROPERTY(p_object_name, 1, 'IMAGE_NAME_ON', '/'||p_image_name);My question is the following:
    - is there a way to load this image once and use it later without having to load it every time i clik on "A"? if yes, how?
    P.S.: if this thread shouldn't be posted in this forum, please redirect me to the right one.
    Thanks in advance

    Ah okay.
    I'm using the rolloverbutton.jar (RollOver Button PJC) [RolloverButton.java -> authors: Steve Button, Duncan Mills].
    Here is the part concerning the IMAGE_NAME_ON function:
    // make sure we are in rollover mode
    enableRollover();
    log("setProperty - IMAGE_NAME_ON value=" + value.toString());
    // load the requested image
    m_imageNameOn = (String) value;
    loadImage(ON,m_imageNameOn);
    // reset the currrently drawn image if needed
    setImage(ON,m_state);
    return true;where loadImage function is:
        URL imageURL = null;
        boolean loadSuccess = false;
        //JAR
        log("Searching JAR for " + imageName);
        imageURL = getClass().getResource(imageName);
        if (imageURL != null)
          log("URL: " + imageURL.toString());
          try
            m_images[which] = Toolkit.getDefaultToolkit().getImage(imageURL);
            loadSuccess = true;
            log("Image found: " + imageURL.toString());
          catch (Exception ilex)
            log("Error loading image from JAR: " + ilex.toString());
        else
          log("Unable to find " + imageName + " in JAR");
        //DOCBASE
        if (loadSuccess == false)
          log("Searching docbase for " + imageName);
          try
            if (imageName.toLowerCase().startsWith("http://")||imageName.toLowerCase().startsWith("https://"))
              imageURL = new URL(imageName);
            else
              imageURL = new URL(m_codeBase.getProtocol() + "://" + m_codeBase.getHost() + ":" + m_codeBase.getPort() + imageName);
            log("Constructed URL: " + imageURL.toString());
            try
              m_images[which] = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              log("Image found: " + imageURL.toString());
            catch (Exception ilex)
              log("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            log("Error creating URL - " + urlex.toString());
        //CODEBASE
        if (loadSuccess == false)
          log("Searching codebase for " + imageName);
          try
            imageURL = new URL(m_codeBase, imageName);
            log("Constructed URL: " + imageURL.toString());
            try
              m_images[which] = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              log("Image found: " + imageURL.toString());
            catch (Exception ilex)
                    log("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            log("Error creating URL - " + urlex.toString());
        if (loadSuccess == false)
          log("Error image " + imageName + " could not be located");In this case, what shall i modify?
    Thanks in advance

  • Loading resources from jar - problem

    I've got a problem when loading resources from jar.
    My code:
    package game.player;
    import javax.swing.ImageIcon;
    import java.awt.Image;
    import game.map.Map;
    import game.map.MapReader;
    import game.emptyclass.EmptyClass;
    import java.net.URL;
    public class Data
        ClassLoader cl = EmptyClass.class.getClassLoader();
        Image image1 = new ImageIcon(cl.getResource("data/sprites/man6.png")).getImage();
        Image image2 = new ImageIcon(cl.getResource("data/sprites/man5.png")).getImage();
        Image image3 = new ImageIcon(cl.getResource("data/sprites/man4.png")).getImage();
        Image image4 = new ImageIcon(cl.getResource("data/sprites/man3.png")).getImage();
        Image image5 = new ImageIcon(cl.getResource("data/sprites/man2.png")).getImage();
        Image image6 = new ImageIcon(cl.getResource("data/sprites/man1.png")).getImage();
        public Image tile1 = new ImageIcon(cl.getResource("data/maps/test/tile1.png")).getImage();
        public Image bg = new ImageIcon(cl.getResource("data/maps/default/bg.png")).getImage();
        public Map map = new MapReader(cl.getResource("data/maps/test/test.map").getPath()).getMap();
        public int getImageWidth()
            return image1.getWidth(null);
        public int getImageHeight()
            return image1.getHeight(null);
    }I get a NullPointerException.
    Thanks in advance!

    Hi ,
    getResource() method argument is not begin with the
    character '/' , ex.
    Image image1 = new
    ImageIcon(cl.getResource("/data/sprites/man6.png")).ge
    tImage();
    I thought of that, but it's not applicable here because getResource is being called on the ClassLoader, not the Class.

  • Loading file from jar in webstart 1.5.0_16

    Hello all,
    We have recently updated form 1.5.0_15 to 1.5.0_16. Since the update, our application is bombing when it attempts to read an xml file from a jar in cache.
    JDOModin.xml.XMLFileReaderError in building: C:\Documents and Settings\dave.frank\Desktop\jar:lookups\version.xml (The filename, directory name, or volume label syntax is incorrect)
    org.jdom.JDOMException: Error in building: C:\Documents and Settings\dave.frank\Desktop\jar:lookups\version.xml (The filename, directory name, or volume label syntax is incorrect)
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:306)
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:617)
         at odin.xml.XMLFileReader.readFile(XMLFileReader.java:53)
         at odin.xml.XMLFileReader.<init>(XMLFileReader.java:40)
    Clearly the path to the jar file is incorrect.
    The url is retrieved like this:
    private URL getURL(String filePath)
            URL url = getClass().getResource(filePath); // relative path "/lookups/version.xml"
            return url;
    } This worked fine in the previous version. Any help would be much appreciated.

    Hi Andrew,
    We are having huge problems fixing this, and have spent quite a while searching the forums for info about it. The closest I've got is two posts where you mention that there are other posts. I can't find them.... Bloody annoying that Sun hasn't updated the webstart FAQ to tell people how to get around this very annoying problem.
    By the way, if you google 1.5.0_16, your post comes up as the second hit.
    Any pointers to threads that offer solutions to resource loading from Jars (images, auth.conf etc) when using webstart, now that it's broken in 1.5.0_16??
    Any help would be greatly appreciated!
    Thanks,
    Craig

  • Load library from JAR file

    Could I ask you guys a stupid question, please?
    I have a library as an JAR file. I build my application as another JAR file, which includes that library file.
    My manifest file is:
    Manifest-Version: 0.1.0
    Class-Path: lib/mysql-connector-java-3.0.17-ga-bin.jar
    Main-Class: com.myappand the build command:
    jar cvfm hello.jar mymanifest -c com  -c libThe result hello.jar file built OK. But when I run it, I have to copy library file to the same folder to the app file.
    Could you tell me how to load the lib file from hello.jar, instead of the lib file?
    Thanks in advance!
    Best regards,
    Lehoanq

    am I right in thinking you've put the mysql jar inside your application jar? jars don't work like that, I'm afraid. it is possible to write a classloader that will load classes from within a jar-inside-a-jar, but it gets rather complicated and messy and isn't worth the hassle to be honest, anyway. we go to some lengths to keep our software modular and separate. imagine, for instance, that a bug is exposed in the mysql driver you're using, and a new release is needed to fix it. the dependency is rooted inside your application, so the whole shebang has to be re-packaged and re-deployed, whereas if your dependencies were inside a lib folder, all that would be needed is to drop the new version of the mysql driver into the lib directory. think "don't put all your eggs in one basket"
    what you want to do is possible, and there are tools around to do it for you, too, but IMHO it's not worth the effort

  • Loading images from jar

    Found a good solution that works from running in command line, i.e java -jar or normally or using web start and not getting missing image URL loading from jar
    It deserves some dukes :) Also, someone can improve on it to make sure it's 100%
    Asume the function is in a package AWTUtilities class
    Many forums provide close solution but they all forget the vital replacing back slash with forward slash when reading from jar!! :)
    That's what got me stump for a good day trying to figure why it should load the images, but it's not...
    Regards
    Abraham Khalil
       // The subtlety in getResource() is that it uses the
       // Class loader of the class used to get the rousource.
       // This means that if you want to load a resource from
       // your JAR file, then you better use a class in the
       // JAR file.
       public static Image getImageResource( String name ) throws java.io.IOException {
          return getImageResource( AWTUtilities.class, name );
       public static Image getImageResource(Class base, String name ) throws java.io.IOException {
          if (name != null) {
             Image result = null;
             // A must, else won't pick the path properly within the jar!!
             // For file system forward or backward slash is not an issue
             name = name.replace('\\', '/');
             // For loading from file system using getResource via base class
             URL imageURL = base.getResource( name );
             // For loading from jar starting from root path using getResource via base class
             if (imageURL == null) {
                imageURL = base.getResource("/" + name );
             // For loading from file system using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource( name );
             // For loading from jar starting from root path using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource("/" + name );
             // Found the image url? If so, create the image and return it...
             if ( imageURL != null ) {
                Toolkit tk = Toolkit.getDefaultToolkit();
                result = tk.createImage( (ImageProducer) imageURL.getContent() );
             return result;
          else {
             return null;

    The problem is that you use the wrong classloader. The system default classloader is the one that launched the webstart utility. It doesn't contain your classes or jars. You have to get hold of the classloader for your classes.
    Here's my solution as a schetch: probably it won't compile but you get the idea:
    // 1: get hold of the classloader for my classes:
    // - this class cannot possibly be loaded by anyone else:
    Object dummy = new Object(){
    public String toString() { return super.toString(); }
    ClassLoader cl = dummy.getClass().getClassLoader();
    // 2: get an inputstream to read resource from from jar:
    InputStream is = cl.getResourceAsStream("images/myimage.gif");
    // 3: create image from inputstream
    // can be done in many different ways using tmp-files etc.
    ImageIcon icon = new ImageIcon(is);
    Image img = icon.getImage();

  • PJC - Loading Images from JAR Files

    I'm developing a PJC class that involves loading images. I would like to be able to find and use an image contained in a JAR file just like the built-in Forms items do; not the JAR file where my class is contained but any external ones defined in the server archive settings.
    I have seen the loadImage method in the demo RolloverButton class but this only loads images from the class's JAR and not any others.
    Is there a VButton method or an Oracle loader class for finding image resources from the defined JAR archives? If not, could someone supply some code for achieving this.
    Thank you.

    Hi,
    the jar file name the images are in shouldn't matter for the code as long as the package name is preserved. If you want to see it with your own eyes, do the following
    1. Back up demo90.jar
    2. Create a copy of it and call it demo90img.jar
    3. Open demo90.jar in winzip and remove all images
    4. Open demo90img.jar and remove all Java classes
    5. add ,/forms90demo/jars/demo90img.jar to the archive_jini tag of a demo you want to test this on
    6. Run the application and see the images despite the fact they are now in a separate jar file. Note in the Jinitiator console that the new jar files are downloaded and replace the existing, cached, jars
    7. Run an application that doesn't have demo90img.jar configured to see that the images are missing.
    Frank

  • Cannot load component from JAR file.

    I got the message : cannot load component ... from JAR file. The class must be compiled and must be on the classpath of the project...
    I just add a javabean from a JAR file from Palette manager, then drag and drop it, then got this message.
    Can anyone tell me what i was wrong ? Thank you.

    Hi,
    You should paste your error log here to easy for other to help you.
    For your scenario, it is a big chance you didn't include the jar file into your classpath, please check.
    Thanks.

  • Why can I load Image from jar?

    hi,all:
    I've packed all gif images into a jar file,it works well on jdk1.4.2_05 with this command:
    java -jar pos.jar
    but failed on other jdk versions lower than jdk1.4.2_05.
    here is the package structure:
    &#9500;&#9472;resource
    &#9474; &#9500;&#9472;configfile
    &#9474; &#9492;&#9472;images
    here is the code getting url:
    package resource
    public class ResourceLoader {
    public ResourceLoader() {
    public URL getResource(String fileName){
    URL url=ResourceLoader.class.getResource(fileName);
    if(null==url){
    throw new NullPointerException(fileName+" not found");
    return url;
    with this url, I will use
    toolkit.getImage(url);
    to load the image.
    exception on 1.4.1_01:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D2835EB
    Function=JNI_OnLoad+0x249
    Library=C:\j2sdk1.4.1_01\jre\bin\jpeg.dll
    Current Java thread:
    at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
    at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144
    at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
    ava:257)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    Dynamic libraries:
    0x00400000 - 0x00406000 C:\j2sdk1.4.1_01\bin\java.exe
    0x77F80000 - 0x77FFA000 C:\WINNT\system32\ntdll.dll
    0x77D90000 - 0x77DEB000 C:\WINNT\system32\ADVAPI32.dll
    0x77E60000 - 0x77F32000 C:\WINNT\system32\KERNEL32.dll
    0x786F0000 - 0x7875E000 C:\WINNT\system32\RPCRT4.dll
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x6D330000 - 0x6D45A000 C:\j2sdk1.4.1_01\jre\bin\client\jvm.dll
    0x77DF0000 - 0x77E4F000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
    0x77530000 - 0x77560000 C:\WINNT\system32\WINMM.dll
    0x75E00000 - 0x75E1A000 C:\WINNT\system32\IMM32.DLL
    0x6C330000 - 0x6C338000 C:\WINNT\system32\LPK.DLL
    0x65D20000 - 0x65D74000 C:\WINNT\system32\USP10.dll
    0x6D1D0000 - 0x6D1D7000 C:\j2sdk1.4.1_01\jre\bin\hpi.dll
    0x6D300000 - 0x6D30D000 C:\j2sdk1.4.1_01\jre\bin\verify.dll
    0x6D210000 - 0x6D229000 C:\j2sdk1.4.1_01\jre\bin\java.dll
    0x6D320000 - 0x6D32D000 C:\j2sdk1.4.1_01\jre\bin\zip.dll
    0x6D000000 - 0x6D0FB000 C:\j2sdk1.4.1_01\jre\bin\awt.dll
    0x777C0000 - 0x777DE000 C:\WINNT\system32\WINSPOOL.DRV
    0x75010000 - 0x75020000 C:\WINNT\system32\MPR.dll
    0x77A30000 - 0x77B1C000 C:\WINNT\system32\ole32.dll
    0x6D180000 - 0x6D1D0000 C:\j2sdk1.4.1_01\jre\bin\fontmanager.dll
    0x51000000 - 0x51044000 C:\WINNT\system32\ddraw.dll
    0x72800000 - 0x72806000 C:\WINNT\system32\DCIMAN32.dll
    0x72CF0000 - 0x72D63000 C:\WINNT\system32\D3DIM.DLL
    0x6DD30000 - 0x6DD36000 C:\WINNT\system32\INDICDLL.dll
    0x53000000 - 0x53007000 C:\PROGRA~1\3721\helper.dll
    0x70BD0000 - 0x70C34000 C:\WINNT\system32\SHLWAPI.dll
    0x37210000 - 0x3723E000 C:\WINNT\DOWNLO~1\CnsMin.dll
    0x777E0000 - 0x777E7000 C:\WINNT\system32\VERSION.dll
    0x75950000 - 0x75956000 C:\WINNT\system32\LZ32.DLL
    0x12F10000 - 0x12F25000 D:\JBuilder7\lib\ext\jbWheel.dll
    0x6D280000 - 0x6D29E000 C:\j2sdk1.4.1_01\jre\bin\jpeg.dll
    0x77900000 - 0x77923000 C:\WINNT\system32\imagehlp.dll
    0x72960000 - 0x7298D000 C:\WINNT\system32\DBGHELP.dll
    0x687E0000 - 0x687EB000 C:\WINNT\system32\PSAPI.DLL
    Local Time = Fri Jul 16 10:06:45 2004
    Elapsed Time = 2
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
    # An error report file has been saved as hs_err_pid2320.log.
    # Please refer to the file for further information.

    help!!!!

  • 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

  • JEditorPane HTML load GIF from JAR

    I'm using a jeditorpane to display a html page from a local file system with images in it, will the editor pane load the <img src> tags from a jar file or must the images be on the local file system?

    gifs will have to be on the local drive

  • Loading icons from jar file

    Hello,
    i am trying to load ALL imagefiles from my jar file. i do the following:
    Class clazz = Class.forName("com.xxx.IconSelectionDialog");
    String me = clazz.getName().replace(".", "/") + ".class";
    dirURL = clazz.getClassLoader().getResource(me);
    if (dirURL.getProtocol().equals("jar")) {
    String jarPath = dirURL.getPath().substring(6, dirURL.getPath().indexOf("!")); //strip out only the JAR file
    JarFile jar = new JarFile(jarPath );
    Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
    while (entries.hasMoreElements()) {
    JarEntry nextEntry = entries.nextElement();
    String jarEntryName = nextEntry.getName();
    this works fine with my debug local jws installation. when i try to run it online starting i get an error:
    java.io.FileNotFoundException: xentis.jar (Das System kann die angegebene Datei nicht finden)
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:114)
         at java.util.jar.JarFile.<init>(JarFile.java:133)
         at java.util.jar.JarFile.<init>(JarFile.java:70)
    how can i load ALL icons from a jar (without knowing the filename) ?
    is there a generic way to iterate over all entries of a jarfile ?
    thank you
    michael

    Look at "Loading Images Using getResource" on this page
    http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html
    It should provide some ideas.

  • Loading icons from jar - linux problem

    Dear,
    I use the folowing code to load an iconImage from a jar file to be used on JButtons:
    private ImageIcon getImageIcon(String iconName){ //gets icon from a file
    ImageIcon icon = null;
    ClassLoader cl = this.getClass().getClassLoader();
    java.net.URL imageURL = cl.getResource("/ExcelInterface/rsrc/"+iconName);
    if (debug) System.out.println(imageURL.toString());
    try{
    if (imageURL != null) {
    icon = new ImageIcon(imageURL);
    }catch (Exception e){
    System.out.println(e.getMessage());
    return icon;
    } // end of getImageIcon(String iconName)
    this works fine on windows.
    On linux everything looks fine (i.e. there are no exceptions, the URL looks fine...) BUT the Icons are not displayed on the buttons.
    Anyone have an idea why?

    I do something similar and although I've never had any problems on Linux only the server side stuff runs there so I've never tried exactly what you are doing. Anyway, my code doesn't have the leading "/" on the URL and the URL is the full path name from the class root, literally "com/inqwell/any/client/arrowup.gif" in my case. Try that and see if it works.

Maybe you are looking for