Icons in jar

hi
i have a gif files in jar file,
this jar is in the same order of the .Class files
i try to load the gif file, but the URL is ALWAYS null.
what do i do wrong?
thx
the code Snippet :
the location = "open.gif" // this is the gif name
public ImageIcon loadImage(String location)
ClassLoader loader = getClass().getClassLoader();
URL url = null;
try {   url=loader.getResource(location); }
catch(Exception e) { e.printStackTrace();  } ImageIcon icon = new ImageIcon
(Toolkit.getDefaultToolkit().createImage(url));
return icon;
btw, may u tell me how do u send the code snippets as code?

the gif is in a file images.jar, this file is in the same order as the *.class files.
i use this code
    private ImageIcon loadImage()
        URL url = null;
            url = ClassLoader.getSystemClassLoader().getResource("/open.gif");
        System.out.println( "url is : " + url );    
         url = getClass().getResource("open.gif");       
        System.out.println( "url is : " + url );  
        url = this.getClass().getResource("/open.gif");       
        System.out.println( "url is : " + url );  
         url = getClass().getResource("/open.gif");       
        System.out.println( "url is : " + url );  
         url = JFrame.class.getClass().getResource("open.gif");       
        System.out.println( "url is : " + url );  
        ImageIcon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(url));        
        return icon;
    }the url = null always.
i think i have problem with the jar file.
that mean, i cant create a right jar file.
i use WinRAR, u didnt say anything about that.
may u make me a faivour? create a jar file and put a gif in it and send it to [email protected]
pls.
i should not care how to run the class file, SUN ONE Studio do that.
and the problem is the URL is null.
thx

Similar Messages

  • Create a custom dock/application icon for .jar files built in eclipse

    I've spent the better part of the afternoon trying to figure out how to apply a custom icon to jar file that I created in eclipse. I am presently using eclipse v3.5 on Mac OS X 10.6.2 and have yet to find a way to change the java coffee cup logo in the document icon for my jar files created in eclipse. Is there some way I can call a specific Apple class in Eclipse to change the dock/application icon of my .jar file?
    I found this link that uses a class that seems to be specific to XCode to change the icon of the .jar file.
    What I mean by change the icon of the jar file, I mean change the icon used in the dock, and also the icon used when the "command+tab" switcher pops up. Presently, I have the black console icon with the text "exec" in the upperleft.
    If anyone has any good links on this topic or even better knows the code I need insert into my program I would be highly greatful.
    cheers
    -ipatch

    See http://www.centerkey.com/mac/java/

  • Icons in JAR are downloaded but doesn't show up in application

    I've tried following all the advice in the Deploying icons on the web guide, but there's just something not quite right.
    What goes right:
    From java console: "Downloading http://oiatst01.tdk.dk:7778/forms90images/kassimages.jar to JAR cache"
    And I can see the file in the Oracle Jar Cache. I can also type in the url and get the kassimages.jar file. It's there and it's accessible.
    That also means the virtual folder /forms90images/ works properly:
    Alias /forms90images/ "E:\KASSForms\gifer/"
    Registry.dat / default.dat has:
    default.icons.iconpath=/forms90images/
    default.icons.iconextension=gif
    In the HTML substitutions are made correctly:
    <PARAM NAME="imageBase" VALUE="codeBase">
    and
    <EMBED ....imageBase="codeBase" ...>
    formsweb.cfg has:
    archive_jini=f90all_jinit.jar,/forms90images/kassimages.jar
    archive_ie=f90all.cab,/forms90images/kassimages.jar
    archive=f90all.jar,/forms90images/kassimages.jar
    # 3) Values for the Forms applet parameters:
    serverURL=/forms90/l90servlet
    codebase=/forms90/java
    imageBase=codeBase
    Errors are:
    ORACLE_HOME/Apache/Apache/logs/error_log: "File does not exist: e:/kassforms/gifer/last.gif"
    It's as if it's not using the JAR file, and the tricky thing is that if I place the actual "last.gif" file inside the folder e:/kassforms... it shows up! Now, it isn't even supposed to do that as imagebase=codebase. It's not supposed to even LOOK at the files.
    # java console start #
    Loading http://oiatst01.tdk.dk:7778/forms90/webutil/webutil.jar from JAR cache
    Loading http://oiatst01.tdk.dk:7778/forms90/webutil/jacob.jar from JAR cache
    Loading http://oiatst01.tdk.dk:7778/forms90/java/f90all_jinit.jar from JAR cache
    RegisterWebUtil - Loading Webutil Version 1.0.2 Beta
    Loading http://oiatst01.tdk.dk:7778/forms90images/kassimages.jar from JAR cache
    Loading http://oiatst01.tdk.dk:7778/forms90/java/SmileyBridge.jar from JAR cache
    connectMode=HTTP, native.
    MessageManager: key VERSION bundle oracle.forms.engine.RunformBundle exception java.lang.IllegalArgumentException: unknown format type at
    [[[Note here: I don't know what the MessageManager is talking about here as the error message isn't complete. I _may_ be related to wrong parameters in formsweb.cfg or some such]]]
    # java console end #
    Sincerely,
    Jesper Vad Kristensen
    Aarhus, Denmark

    If I change the line:
    codebase=/forms90/java
    to:
    codebase=/forms90images/
    Then my iAS stops working, and I guess it's because the other jars can't be found now (jinit for example). Maybe it uses the /forms90/java path for both. It kinda seems that I need a separate instruction that tells the imageBase parameter where to look in the file system. I don't know how to do that?!
    Maybe it's simply impossible to locate the image jar file anywhere else but in the standard directory where the other jars are located?
    Sincerely,
    Jesper Vad Kristensen
    Aarhus, Denmark
    PS: the html page used is:
    <HTML>
    <!-- FILE: webutiljini.htm (Oracle Forms) -->
    <!-- -->
    <!-- This is the a HTML template file for running a form on the -->
    <!-- web using JInitiator-style tags to include the Forms applet. -->
    <!-- and a certificate regsitration applet for the WebUtil utility -->
    <!-- -->
    <!-- IMPORTANT NOTES: -->
    <!-- Default values for all the variables which appear below -->
    <!-- (enclosed in percent characters) are defined in the servlet -->
    <!-- configuration file (formsweb.cfg). It is preferable to make -->
    <!-- changes in that file where possible, rather than this one. -->
    <!-- -->
    <!-- This file uses several extra tags that are not present in the -->
    <!-- default template files. You should ensure that these are -->
    <!-- present in the configuration that uses this template -->
    <!-- The extra substitution Tags are: -->
    <!-- %webUtilArchive% = jar file containing the WebUtil code -->
    <!-- (by default this should be webutil.jar) -->
    <!-- %WebUtilLogging% = Defines the current logging mode. -->
    <!-- Valid values: off|on|console|server|all -->
    <!-- (on == console) -->
    <!-- %WebUtilErrorAlert% = Should errors be displayed in an alert -->
    <!-- as well as the programmer defined -->
    <!-- locations -->
    <!-- Valid values: true|yes|false|no -->
    <HEAD><TITLE>%pageTitle%</TITLE></HEAD>
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <!-- Registration applet definition (start) -->
    <OBJECT classid="%jinit_classid%"
    codebase="/forms90/jinitiator/%jinit_exename%"
    WIDTH="0"
    HEIGHT="0"
    HSPACE="0"
    VSPACE="0">
    <PARAM NAME="TYPE" VALUE="%jinit_mimetype%">
    <PARAM NAME="CODEBASE" VALUE="%codebase%">
    <PARAM NAME="CODE" VALUE="oracle.forms.webutil.common.RegisterWebUtil" >
    <PARAM NAME="ARCHIVE" VALUE="%webUtilArchive%" >
    <COMMENT>
    <EMBED SRC="" PLUGINSPAGE="%jinit_download_page%"
    TYPE="%jinit_mimetype%"
    java_codebase="%codebase%"
    java_code="oracle.forms.webutil.common.RegisterWebUtil"
    java_archive="%webUtilArchive%"
    WIDTH="0"
    HEIGHT="0"
    HSPACE="0"
    VSPACE="0"
    >
    <NOEMBED>
    </COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!-- Registration applet definition (end) -->
    <!-- Forms applet definition (start) -->
    <OBJECT classid="%jinit_classid%"
    codebase="/forms90/jinitiator/%jinit_exename%"
    WIDTH="%Width%"
    HEIGHT="%Height%"
    HSPACE="0"
    VSPACE="0">
    <PARAM NAME="TYPE" VALUE="%jinit_mimetype%">
    <PARAM NAME="CODEBASE" VALUE="%codebase%">
    <PARAM NAME="CODE" VALUE="oracle.forms.engine.Main" >
    <PARAM NAME="ARCHIVE" VALUE="%archive_jini%,%webUtilArchive%" >
    <PARAM NAME="serverURL" VALUE="%serverURL%">
    <PARAM NAME="networkRetries" VALUE="%networkRetries%">
    <PARAM NAME="serverArgs"
    VALUE="module=%form% userid=%userid% sso_userid=%sso_userid% %otherParams%">
    <PARAM NAME="heartBeat" VALUE="5">
    <PARAM NAME="separateFrame" VALUE="%separateFrame%">
    <PARAM NAME="splashScreen" VALUE="%splashScreen%">
    <PARAM NAME="background" VALUE="%background%">
    <PARAM NAME="lookAndFeel" VALUE="%lookAndFeel%">
    <PARAM NAME="colorScheme" VALUE="%colorScheme%">
    <PARAM NAME="serverApp" VALUE="%serverApp%">
    <PARAM NAME="logo" VALUE="%logo%">
    <PARAM NAME="imageBase" VALUE="%imageBase%">
    <PARAM NAME="WebUtilLogging" VALUE="%WebUtilLogging%">
    <PARAM NAME="WebUtilLoggingDetail" VALUE="%WebUtilLoggingDetail%">
    <PARAM NAME="WebUtilErrorMode" VALUE="%WebUtilErrorMode%">
    <PARAM NAME="WebUtilDispatchMonitorInterval" VALUE="%WebUtilDispatchMonitorInterval%">
    <COMMENT>
    <EMBED SRC="" PLUGINSPAGE="%jinit_download_page%"
    TYPE="%jinit_mimetype%"
    java_codebase="%codebase%"
    java_code="oracle.forms.engine.Main"
    java_archive="%archive_jini%,%webUtilArchive%"
    WIDTH="%Width%"
    HEIGHT="%Height%"
    HSPACE="0"
    VSPACE="0"
    serverURL="%serverURL%"
    networkRetries="%networkRetries%"
    serverArgs="module=%form% userid=%userid% sso_userid=%sso_userid% %otherparams%"
    heartBeat="5"
    separateFrame="%separateFrame%"
    splashScreen="%splashScreen%"
    background="%background%"
    lookAndFeel="%lookAndFeel%"
    colorScheme="%colorScheme%"
    serverApp="%serverApp%"
    logo="%logo%"
    imageBase="%imageBase%"
    WebUtilLogging="%WebUtilLogging%"
    WebUtilLoggingDetail="%WebUtilLoggingDetail%"
    WebUtilErrormode="%WebUtilErrorMode%"
    WebUtilDispatchMonitorInterval="%WebUtilDispatchMonitorInterval%"
    >
    <NOEMBED>
    </COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!-- Forms applet definition (end) -->
    %HTMLafterForm%
    </BODY>
    </HTML>

  • Icon for Jar File?

    Is it possible to include an Icon in a Jar file
    that will be displayed for the jar file instead
    of a default Icon give to it by Windows 2000? If
    so, how is it done?
    Thanks

    no it's not possible as the JAR file does not know anything about the operating system. this is windows dependend. if you want a custom icon for one jar file, create a shortcut to the jar and adjust the icon of this shortcut.

  • Storing Icons in JAR Files

    As per the optimization best practices for web deployed forms , Image Icons( which are GIF images) on the buttons can be placed in a JAR file so that it can be cached by the client side JVM . Can anybody help me out and tell me the steps of how to do it. Thanx in advance.

    Sorry, you're correct it does need to be on the "archive_jini=" as well!
    If your using rollover images, I found the best way to get these working was just to include them in the Rolloverbutton.jar file. I did this by loading the rolloverbutton project into JDeveloper, adding the icons into the project and re-deploying. There are some good notes at http://otn.oracle.com/formsupgrade to explain how to generate JPCs.
    If your using standard Forms Iconic buttons...
    Once your form has loaded, double click the Java Console Icon in the system tray, you should see lines that state;
    Loading http://<myserver>/forms90/java/f90all_jinit.jar
    Loading http://<myserver>/forms90/java/calendar.jar
    Loading http://<myserver>/forms90/java/rolloverbutton.jar
    Loading http://<myserver>/forms90/java/gs.jar
    If these are loading ok, in the Java console hit the 5 key. Then re-load the form so that images are reloaded and check for lines that state;
    "Loaded image" It should state "Loaded Image Jar:http://<myserver>/forms90/java/gs.jar!<image>.gif."
    If it gives a different URL, then the imagebase must be set incorrectly.

  • Deploying icons as jar file in Forms 9i

    We (Cancer Research UK) don't quite understand what is happening -
    We followed the guidelines in the white paper "Oracle 9IAs Forms Services - How to Deploy Icons"
    to deploy the images in a jar file:
    Altered the formsweb.cfg file to contain
    archive_jini=f90_jinit.jar, our_images.jar
    imagebase=codebase
    Seemed to work, jar file downloaded to browser (IE 6 ) ok , web deployed form shows toolbar icons, great..
    However, when we removed an existing entry in orion-web.xml which maps our application/icon directory
    or remove the *.gif files from this directory, our web deployed form no longer shows the icon images.
    Does it still need these to be present on the server, if we direct it to use cached images ?
    We are test running just the Application server components installed with the IDs 9.0.2 on a Windows 2000 server.

    Hi Steve,
    I have the exact same problem. The jar is downloaded and everything is 100% best practises, but there is no way I can make the damn system use the files in the JAR file. No matter if imagebase=codebase: it will only use files on the server, and if I remove the gif files they don't show up.
    I think there must be a glitch in the system somewhere. I don't completely understand this part of it: the codebase is mapped to /forms90/java - but how does that add up when you put your files in c:\my_gifs (as detailed in Best Practices section of the Deploying Icons paper). How does the server know where to look when codebase are two different places - I'm thinking it can't for some reason.
    My Apache/Apache/logs/error_log clearly states that files (real files) are not found in c:\my_gifs if I remove them from the file system. The JAR is downloaded, but the server doesn't use it.
    However, most people have all their gif files in the same folder as their images.jar file, so they don't ever discover that the server ignores the jar and uses the files instead.
    Regards,
    Jesper Vad Kristensen
    Aarhus, Denmark

  • Icons in .jar files...

    Hi ,
    I have configured successfully and see some icons on buttons. Next day , i took the .jar file , copied it in \java folder and i have configured appropriately the formsweb.cfg file - calling this .jar file among others- according to my system (where the icons are displayed as wanted)...
    But the icons are not appeared in the 'destination' computer.....
    What may be the problem....????
    Should i have to make an archive (jar file) in the 'destination' computer ... as i have done on my own...?????
    NOTE: both computers run on Windows XP , and Dev10g have been installed....The only difference is that the one has Oracle10gXE... whereas the other Oracle10gEE
    Many thanks,
    Simon

    Note that the filenames within the JAR are case sensitive. So, if the files in the JAR have lowercase names, make sure the property in Forms also uses a lowercase name. Also remove the extension (if any) from the icon property in Forms.
    If that's all ok and it still does not work, have a look at http://www.oracle.com/technology/products/forms/pdf/webicons.pdf. Looking at your question it seems you've done what the white paper says, but you never now what you might pick up from reading it (again).

  • Forms - Icons without jar file

    Hi!
    I´m trying con configure my standalone weblogic (10.3.6), running in development mode,
    to find my forms 11 applications icons without use a jar file.
    So, at formsweb.cfg i changed imageBase to documentBase and at Registry.dat i set
    default.icons.iconpath=/img/ 
    default.icons.iconextension=gif 
    Now I´m trying to map /img/ to may local directory (/img/ -> C:\repo\img)
    I tried to change httpd.conf and didn´t work. When I access http://localhost:7001/img/myimage.gif, it returns 404.
    Alias /img/ "C:\repo\img\" 
    <Directory "C:\repo\img"> 
        AllowOverride None 
        Order allow,deny 
        Allow from all 
    </Directory> 
    Then, i tried to change forms.conf
    AliasMatch /img/(..*) "C:\repo\img\$1" 
    But No change at all.
    Does anyone know how to create a alias in weblogic in development mode?

    If you chose the "Development" install type you will not have OHS although you might have its config file (httpd.conf).  Further, creating an Alias in WLS is a little more painful than doing it in OHS.  My recommendation is that you keep it simple for testing.  You can use an existing Alias and extend it.  For example consider the Forms \java directory (e.g.
    C:\Oracle\Middleware\Oracle_FRHome1\forms\java)
    Simply add a sub-directory to it and store your images there.  In the form, simply reference the complete image name without a path.  For example:  myimage.jpg.  Then in the Registry.dat include the virtual path to the images.  So, here are the steps.
    1.  Create a sub-directory C:\Oracle\Middleware\Oracle_FRHome1\forms\java\images
    2.  Copy your images to this directory
    3.  In the form, refer to the images by name only.  If your images use a different extension from what is stored in Registry.dat, include the extension in the form.  If the extension is the same then ommit it.
    4.  In Registry.dat, set default.icons.iconpath=/forms/java/images/  (be sure to include the trailing slash)
    5.  On the client machine, close all open browsers and open the Java Control Panel.  Clear the jar cache ("Temporary Internet Files")
    Your done.  Because the form does not have a hard coded path to the images, you can easily move the forms to production without worrying about the need to change the code to handle the image location.
    Oh, one last thing.... If you are using a newer JRE version you will get a securty warning suggesting that there may be unsafe code being executed.  It will then ask if you want to Block or Don't Block.  This dialog is the result of retrieving your image from a source other than the applet jar.  You will need to select Don't Block in order for it to work correctly.  This is another reason why we (Oracle) recommend using signed jar files.
    Message was edited by: Michael Ferrante (Oracle)

  • Image Icon with JAR

    Hi,
    I would like to replace the standard coffee cup window icon with a custom image for a stand-alone Swing application, all packaged as a JAR file. As a quick test, I wrote the following:
    package me.swinginfo1;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    public class IconWindow extends JFrame {
         public IconWindow() {
              this.setSize(300, 200); //set the window size
              this.setLocationRelativeTo(null); //centers window on screen
              this.setTitle("Window with Icon"); //set the window title
              this.setDefaultCloseOperation(EXIT_ON_CLOSE); //end the program when window closed
              java.net.URL imageURL = this.getClass().getResource("images/red_circle.png");
              this.setIconImage(new ImageIcon(imageURL).getImage());
         * Executes Swing window... no arguments.
         public static void main(String[] args) {
              IconWindow myWindow = new IconWindow();
              myWindow.setVisible(true);
    When I run this class from the IDE (Eclipse, in this case), the program runs fine, and my icon image appears in the corner of the window as desired. However, when I package the program into a JAR, the JAR will not execute. My method of packaging is simply to use File -> Export -> JAR.
    Note: if I comment out the two lines related to the Icon Image, then the JAR executes as expected (but without my custom image icon, of course).
    I am concerned that perhaps the resource folder containing the image is not being included in the JAR. Is there an easy way to check this? Or is there something else I am doing wrong?
    Thanks!

    Thanks for the information atmguy. After checking the jar contents, I found that my resource files (the "red_circle.png" in this case) were not being packaged into the jar. It looks like the reason for this was that I had just added the directory to my project "src" directory by hand, rather than importing the files with Eclipse. Thus, when I packaged the jar using Eclipse, it was unaware of the resource files and therefore did not include them in the jar.
    Also, I found that in Windows a handy way of quickly viewing jar files is to rename the jar as a .zip, and then just explore the zip file. (As mentioned here: http://en.kioskea.net/faq/sujet-556-to-see-the-content-of-a-jar-file).
    The jar now executes as expected. Thanks!

  • Iconic (gif) jar files

    Just curious, how does forms know the name of the jar file in the codebase directory to search when loading icon (gifs). Or does it search every jar file in that directory?
    thx,
    r.b.

    > how does forms know the name of the jar file in the
    codebase directory to search when loading icon (gifs).
    You add the jar file to the archive_jini parameter. The gif in the jar file has a path. (If there's no path, then it's just /.) Your serverApp file (registry.dat) has the path where the icons reside.
    So if your registry.dat file has, say, /myicons as the path, then your jar file, called appicons.jar contains the icons in the path /myicons.
    You specify appicons.jar in the archive_jini parameter. That way it gets downloaded to the client.
    Now the client has the jar, which has the icons. And client has the path. Voila!
    > and what happens when it doesn't find a specific gif
    in the jar file?
    Don't do that. :)
    Seriously, I don't know what happens. I suspect the Form runs fine but there's no image where the icon should be.
    You may get an error in the java console, I'm not sure.
    Regards
    Robin Zimmermann
    Forms Product Management

  • Icons in JAR file did not appear on runing web form

    Hi
    I am testing web application built using Forms6i with path 9. I configured the form server to run as a servlet and I put all the icons used in the application in JAR file I name it ICONS.JAR, I put this file in \FORMS60\JAVA\ directory.
    I made the following configurations:
    In Apache listner configuration file httpd.conf :
    Alias /forms60java/ "D:\orant\forms60\java\/"
    In forms confuguration file formsweb.cfg:
    imageBase=CodeBase
    archive=icons.jar
    serverApp=Default
    in registry.dat file:
    default.icons.iconpath=
    default.icons.iconextension=gif
    In base HTML file:
    <PARAM NAME="imageBase" VALUE="%imageBase%">
    <PARAM NAME="serverApp" VALUE="%serverApp%">
    <PARAM NAME="CODEBASE" VALUE="/forms60java/"
    The forms are run with nao problem except that the icons do not appear. I see java console on the client machine, and I see that ICONS.JAR was downloaded and saved in jar cache.
    In Apache access log file I see that there is an attempt to load the icons from the path <server_name>/forms60java/icon_name.gif but not from the archived JAR file.
    What could be goes wrong or missing?

    Hi Amin,
    Maybe the icons.jar file doesn't contain the files (try opening it with WinZip or some other tool and verify the files are indeed there).
    Maybe some case sensitivity issues are at play?
    Or the GIF files are the wrong size so maybe you're only seeing the transparent upper left corner of alle the icons displayed on your iconic buttons or whatever.
    Just a couple of wild shots (cause it doesn't appear you're having errors - but check all your log files including error_log)
    Regards,
    Jesper

  • Need help getting icons from jar

    I switched to the latest java plugin, 1.4.2 and now I can't get the applet to retrieve the GIF image within its jarfile. The class files and imagery are all located in the same jarfile. If I use the following code:
    ivjJToggleButton20.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/MoveVertex2.gif")));
    The jarfile is downloaded again and the image is retrieved from the downloaded jarfile instead of the jar currently displayed in the browser.
    any help or ideas are greatly appreciated!

    I usually do something like this to load an icon from a JAR:
    java.net.URL iconURL = getClass().getResource("/yourImageFile.gif");
    if (iconURL != null) icon = new javax.swing.ImageIcon(iconURL);
    JButton.setIcon(icon);
    This should work.

  • 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.

  • Deploy Icon Using  .Jar files?

    Hi !
    i have created the .jar file using following command..
    D:\myapp\icon> jar -cvf myappicon.jar *.gif
    then 'Copy' this myappicon.jar file to the D:\frs\forms90\java directory
    then i open formsweb.cfg and edit this as following..
    [myApp]
    …
    archive_jini=f90all_jini.jar,myAppIcons.jar
    imagebase=codebase
    Then i set icon name property some button to "save" and some button to "save.gif"
    Then i start the form by giving the following URL in the Browser
    http:\\mymachine.com:7778/forms90/f90servlet?config=myapp
    then the browser show this message
    java.lang.classNotFoundException:oracle.forms.engine.Main
    Now what i should do or what are the error or what i missed??
    Do i need to make changes in registry.dat file???
    How to define default.icons.iconpath in registry.dat file give example plz??
    Please guide me
    thanks
    Rana Adnan

    Rana,
    please - no duplicate questions. Please help to keep this forum clean.
    thanks
    Frank
    Ps.: I provided an answer in the first question I found with this topic.

  • Icons and JAR files

    How do I change the desktop icon assoicated with a JAR file?

    I would like to know it too.
    This is a way that give you almost the same thing, but you'd probably already know:
    You can click with the right on your jar File, create a shortcut to your Jar File, click with the right on the shortcut you have just created, proprieties, change icon.

Maybe you are looking for