Reading Internationalised Bundles Outside of a Jar File

I have seen this question many times throughout this forum and other forums where a jar file is tryingto load a resource outside of the jar file. The answers are often scattered or partial solutions. This is an attempt to provide a complete solution.
Step 1)
In your manifest file add to the Class-Path attribute the current directory, ie . plus any other library files you require (seperated with spaces).
for example
Class-Path: . lib/log4j.jar
Step 2)
In your code, make sure that you are correctly requesting the resource. If you are requesting a resource from the directory where you are running your jar file from (i.e. the working directory), simply use ResourceBundle.getBundle("Resource"); or equivalent method.
If you bundle is within a directory, you must specify the directory when getting the Bundle as a dot seperated string, i.e.
ResourceBundle.getBundle("etc.i18n.Resource"); would look for the file <working-directory)/etc/i18n/Resource.properties.
I hope this may help people having problems with this excellent tool. Please feel free to add to this tutorial or amend any mistakes I may have made.
Good Luck
codemwnci

I followed the instructions here and had every thing correct. I created the jar with ant using fearly standard build.xml. Things didn't still work out. Spent few hours wondering why things don't work.
Reason: the property-files were not included in indexing.
Basically there is two way around:
1) Add the property files to the index of the jar.
The problem here is that you cannot have new property-files without creating the index again.
2) Don't do the indexing for the jar.
In this case the jar is not so well optimazed, and in some case that may be a little problem.

Similar Messages

  • How to read the contents from the provisioning jar file in 11g

    Hi All,
    I am new to OIM 11g, can anyone please let me know the process of reading the existing jar.
    Actually What I am trying to do is:
    1. I created one process task and added one task 2. Created adapter variables 3. Create java task and select the method.
    Here I am seeing jar name as javatasks.jar:icf-oim-intg.jar.
    method name as public.java.lang.string oracle.iam.connectors.icfcommon.prov.ICProvisoningManager.createObject(java.lang.object).
    I would like to see internal code of that jar files(means need to know how they are handling proviosoing).
    but I searched in all folders I could't able to find that jar. can any one please let me know how to find the icf-oim-intg.jar in 11g.
    Thanks,
    Valli
    Edited by: 988908 on Feb 26, 2013 10:05 PM

    check inside
    <OIM_HOME>/server/icf/intg/

  • How to read a certificate included in a jar-file???

    Hello,
    I have an application who connects via SSL to a JBoss server. Therefore I need a certificate on the client machine.
    Can I include a selfsigned certificate in the jar file which can be downloaded with webstart???
    If that's possible where can I find the certificate??? For now on my machine I use
    System.setProperty("javax.net.ssl.trustStore","c:/Program Files/.../certificate.truststore");
    I suppose I have to change the path, but I have no idee to where???
    Thanks anyway
    Bart

    Write out the trust store to a file in the temp directory on the client machine when your application starts and instruct the java.net classes to use it by setting the system property just like you described.
    note.. I'm just guessing here
    -Spinoza

  • Reading nested jar files

    How to read and display contents of nested jar files
    Let the jar format is something like this.
    Parent.jar
                child11.png
                child12.xml
                child13.jar
                            child21.png
                            child22.xml
                            child23.jar
                 -

    You need to play around with classloaders to do it, and unless you know how to do this, there's little point someone giving you the code to, since you won't be able to debug it

  • Please I can not get a .jar file to run on XP SP3 start/run/cmd/

    I can not get a .jar file to run on XP SP3 start/run/cmd/
    Please help if can figure this out. I'm convinced it is a Windows XP SP3 problem from searching on google and seeing other ppl on XP SP3 with same problem (but no working solution for myself). I'll try to be complete-listing all I've done.
    I had installed: Java SE Runtime Environment v6u14 for Windows Multi-language
    I had checked here it was working properly: http://www.java.com/en/download/manual.jsp
    I'm trying to run this jar file (soht-client-0.6.2.jar):
    http://prdownloads.sourceforge.net/telnetoverhttp/soht-java-client-0.6.2.zip?download
    http://www.ericdaugherty.com/dev/soht/javaclient.html < this is the information for the program.
    (yes the file can be executed and should open the program's window
    I wanted to post screenshot of it but friend that it's working for isn't here)
    _(Please find log of all cmds I did in this post here: http://pastebin.com/f792983df )_
    _I have extracted +'all' the files to: C:\062\+_ (I have tried using other directories, same problem)
    ++I then start/open/run/cmd+
    then I: cd C:\062\+
    then I try various commands - all+ of these do absolutely nothing- meaning no errors, no reply, no window opens, nothing except enters that directoy again:
    java -jar soht-client-0.6.2.jar
    java -jar -client soht-client-0.6.2.jar
    java -client -jar soht-client-0.6.2.jar
    java -jar soht-client-0.6.2.jar soht.properties
    soht-client-0.6.2.jar
    So I try this cmd: java soht-client-0.6.2.jar
    Reply:
    C:\062>java soht-client-0.6.2.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: soht-client-0/6/2/jar
    Caused by: java.lang.ClassNotFoundException: soht-client-0.6.2.jar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: soht-client-0.6.2.jar. Program will exit.
    I try this cmd:
    java -jar soht-client-0.6.2.jar -client
    Reply:
    C:\062>java -jar soht-client-0.6.2.jar -client
    Unable to load configuration file: -client - java.io.FileNotFoundException: -cli
    ent (The system cannot find the file specified)
    SOHT Java Client
    The SOHT Java Client requires a properties file. Either start
    the application in the same directory as the soht.properties
    file, or specify the file name on the command line:
    java -jar soht-cleint-<version>.jar c:\soht.properties
    So then I do these cmds which produce the exact same error/reply just above; Unable to load..:
    j_ava -jar soht-client-0.6.2.jar -client soht.properties_
    java -jar soht-client-0.6.2.jar -client C:\062\soht.properties
    So then I copy soht.properties to C root and do:
    java -jar soht-client-0.6.2.jar -client C:\soht.properties <same error as above
    Then from other information I have read I right click on the .jar file, select open with Always open with:
    _"C:\Program Files\Java\jre6\bin\javaw.exe"_
    Try again.. same problem.
    Then I do cmd:
    _"C:\Program Files\Java\jre6\bin\javaw.exe" -jar "C:\062\soht-client-0.6.2.jar"_
    does nothing, retry the other commands same thing (either nothing or those same replies)
    Then I read (http://forums.sun.com/thread.jspa?threadID=5384879) someone had the same problem as I and they solved it by uninstalling all Java/reboot/ then install JDK 6 Update 14 with NetBeans 6.5.1 start NetBeans and then it worked for them.
    So I unistalled all Java, rebooted and gave the cmd another try (before re-installing), now a new error, of course:
    C:\062>java -jar soht-client-0.6.2.jar
    'java' is not recognized as an internal or external command, operable program or batch file.
    Then I install  Java SE and NetBeans Cobundle (JDK 6u14 and NB 6.5.1) Final Release/ reboot/ open Netbeans/
    go to test java page; all is good, run cmds again -and still nothing..
    C:\062>java -version
    java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
    I reassociate program with: C:\Program Files\Java\jre1.6.007\bin\javaw.exe_
    same thing.. nothing
    Thank you very much for your time :D_
    PS. My computer has been newly reformatted so needing another reformat I'm sure is not the solution.

    Thank you very much for your replies Taggert_77 & swmtgoet_x :D
    Taggert77_: I have never used NetBeans. I only installed it in the bundle as I had read on another post that somehow installing the bundle magically helped another user with the same problem (he didn't know why it worked after that either).
    Before XP SP3 I was able to execute .jar file through cmd prompt. Now I am not.
    This file is executable, grab it and you will see. Here is a screen shot (program in front is FlashFXP, behind is the cmd prompt and what should happen):http://www.freeimagehosting.net/uploads/53273b4ddf.jpg
    swmtgoetx_: I only did the other cmd's to try to make it spit out something, anything lol :D
    The proper cmd is simply: java -jar soht-client-0.6.2.jar
    I did give your cmd a try, and it produced nothing :( (just like the other correct cmds)
    java -client -jar soht-client-0.6.2.jar soht.properties
    Thank you again...the mystery remains
    PS. If you do a search for this you'll find an amazing amount of XP SP3 users with the same problem and no solution posted that I could find except one chap that did the unistall install order that I did above).

  • Jar file and classpath problem

    I0m writing a program that use the kunststoff.jar Look&Feel.
    Now I would like to put all I'm writing into a jar file but I always have a NoClassFoundException when I try to start my application.
    here is a MANIFEST:ME I'm using:
    Manifest-Version: 1.0
    Created-By: 1.4.2-beta (Sun Microsystems Inc.)
    Main-Class: JListaR.JListaR
    Class-Path: kunststoff.jar img\ .why this don't work?

    Unfortunately you can't embed jars within a jar and
    expect them to be referencable for the classpath from
    outside the main jar. The "Class-Path" attribute in
    the manifest is used to refer to other jar files
    outside of your jar file.
    The usual approach to solve this problem is to unpack
    the jar files you want to embed and then rejar
    everything together in one big jar file again. This
    isn't always a great approach though, I know I'm
    looking for an alternative. So far my only alternative
    is dynamic class loading using a classloader, however
    this isn't great if you need to refer to several
    hundreds or even thousands of classes.thank you very mach...now I understand because it dosen't work correctly!

  • Can I include dlls in a jar file for deployment?

    I have a set of dll's I need to deploy (some kind of database driver needed along with my java application) in a client/server situation. Instead of copying these dll's to the client's system32 folder on windows, can I simply include these dll's in the jar file containing my java applications?

    No it was just to make everything cleaner. But if I have to take them outside of the jar file, then like you say there's no benefit in putting them in there in the first place.
    As for having the dll's in the same directory or a sub directory, how can I load them then? Using the function System.loadLibrary?

  • Classpath inside a JAR file...

    Hi there,
    I have recently learned that I cannot use my JDBC driver JAR file from within another JAR file. So now I have two JAR files........my application and associated files in one and the JDBC driver in the other.
    This gives me......
    gatekeeper.jar
    ojdbc14.jar
    My problem is, when running the application I get an exception stating that it cannot load the Oracle driver. I'm assuming that this is because it cannot find the JDBC JAR file from within the manifest Class-Path.
    My manifest is this: -
    Main-Class: GateKeeper
    Class-Path: ojdbc14.jar commonfiles images
    This includes my commonfiles package (all classes) and my images directory. All these things are included. I'm trying to run the gatekeeper JAR file from the same directory as the JDBC driver JAR file.
    I've tried: -
    Class-Path: ojdbc14.jar commonfiles images
    Class-Path: .\ojdbc14.jar commonfiles images
    Class-Path: ..\ojdbc14.jar commonfiles images
    None of these things help. Obviously I could just specify the JDBC JAR file when running the application using: -
    java -cp ojdbc14.jar -jar gatekeeper.jar
    ....but I want to have the user just run it without having to know about the classpath.....i.e.
    java -jar gatekeeper.jar
    DrClap said (and I quote) "In the same directory as your main JAR file is easiest, but at any rate the Class-Path entry in your manifest should include the relative path of the driver jar."
    ...Isn't the relative path to the JAR file outside the JAR this?
    .\ojdbc14.jar
    Basically, to recap....from within my JAR application file I want to add to the classpath in the manifest file the JAR file that is outside the application JAR file in the same directory. Helpy?
    ...I'd offer dukes to you fine folks, but I've only got two left. Since I'm such a newbie, I'm not likely to get any more inthe near future, so I'm saving them for a raining day. :) I hope I can get a little charity without resorting to duke bribary. :)

    Hmmm...still not joy. This is the exception I'm getting with the stacktrace.
    C:\Java\deployment\GateKeeper\JarFile>C:\j2sdk1.4.2_03\bin\java -jar gatekeeper.jar
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at commonfiles.OracleDataConnection.<init>(OracleDataConnection.java:26)
    at GateKeeperFrame$MainAction.actionPerformed(GateKeeperFrame.java:429)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    My gatekeeper.jar file contains the following files: -
    C:\Java\deployment\GateKeeper\JarFile>jar -tvf gatekeeper.jar
    0 Wed May 19 19:06:42 BST 2004 META-INF/
    95 Wed May 19 19:06:42 BST 2004 META-INF/MANIFEST.MF
    0 Wed May 19 19:06:38 BST 2004 commonfiles/
    1185 Mon Apr 26 22:24:30 BST 2004 commonfiles/ErrorDialog.class
    1319 Fri Apr 16 10:50:28 BST 2004 commonfiles/ErrorItem.class
    1381 Tue Apr 27 19:53:32 BST 2004 commonfiles/ErrorList.class
    4207 Mon May 17 12:58:40 BST 2004 commonfiles/FileIO.class
    1371 Fri May 14 12:00:38 BST 2004 commonfiles/Input.class
    1655 Fri Apr 23 15:13:58 BST 2004 commonfiles/OracleConnectionDetails.class
    6653 Fri May 14 14:34:58 BST 2004 commonfiles/OracleDataConnection.class
    8612 Fri May 14 15:06:02 BST 2004 commonfiles/Utility.class
    0 Mon May 17 19:56:40 BST 2004 images/
    116 Wed Apr 21 10:19:50 BST 2004 images/Connect.gif
    119 Wed Apr 21 10:19:28 BST 2004 images/Disconnect.gif
    117 Wed Apr 21 10:16:24 BST 2004 images/Exit.gif
    1024 Mon May 10 14:38:28 BST 2004 GateKeeper.class
    186 Wed May 12 11:08:44 BST 2004 GateKeeperFrame$1.class
    5300 Mon May 17 14:38:28 BST 2004 GateKeeperFrame$MainAction.class
    1740 Fri May 14 15:21:20 BST 2004 GateKeeperFrame$MainButtonListener.class
    11034 Mon May 17 11:07:30 BST 2004 GateKeeperFrame.class
    898 Wed Apr 28 22:10:56 BST 2004 LoginFrame$DataSource.class
    6938 Wed Apr 28 22:10:56 BST 2004 LoginFrame.class
    3261 Fri May 14 12:22:28 BST 2004 UsersDataModel.class
    My manifest file for gatekeeper.jar file contains this: -
    Main-Class: GateKeeper
    Class-Path: ojdbc14.jar
    And the directory where I'm running the gatekeeper.jar file contains this: -
    gatekeeper.jar
    ojdbc14.jar
    which I'm running using: -
    java -jar gatekeeper.jar
    Thanks for your help guys. And no, I don't have a newline at the end of the Class-Path entry in the manifest.

  • Images are not comming out when application is running through jar file.

    I have written an application program using j2sdk1.4.1 that needs your help.
    My application folder's contents.....................................................................................
         C:\Examination\Examination.class <-----This is the main class and application's entry point.
         C:\Examination\ExamBox.class
         C:\Examination\PaperSetterBox.class
         C:\Examination\pspBox.class
         C:\Examination\epBox.class
         C:\Examination\TimerBox.class
         C:\Examination\ReportCardBox.class
         C:\Examination\HelpBox.class
         C:\Examination\AboutBox.class
         C:\Examination\Images\(some jpg & gif files)
         C:\Examination\Sounds\(some au files)
    Compilation Report:     There was no error.
    Execution Report :     Was working properly using the command:- java Examination
    Now, I created a jar file for my application in the following steps.................................
              STEP-1:          Firstly, I created a text file(mainclassInfo.txt) that contains
              the line:--     Main-Class: Examination
              This line would be automatically added to the default manifest file when I would include the                name of that text file with the command to create the jar file.
              Location of the text file I created:     C:\mainClassInfo.txt
              STEP-2:          Then I went to C:\Examination and executed the following command(by using                'Command prompt'):--------------------------------------------------------------------
    jar cmf C:\mainClassInfo.txt Examination.jar Examination.class ExamBox.class PaperSetterBox.class pspBox.class epBox.class TimerBox.class ReportCardBox.class HelpBox.class AboutBox.class Images Sounds
    Finally, I got the jar file:-     Examination.jar
    Double clicking on it application ran as it was expected.
    Then, I thought, that as all the files & folders the application needed to run properly were packaged in the jar file; I should delete all the contents of the folder 'Examination', so that no one could see or use anything of the resources easily. I did that.
    So, then it became only:-- C:\Examination\Examination.jar
    Thereafter, I tried to run the application again and there a problem occurred! The application was running, but the images, those were to be used and shown by the application were missing somehow!!
    Moreover, when I kept a copy of those 2 folders('Images' and 'Sounds') into the C:\Examination and ran the application again all the images came out normally!
    I just can't understand why it's happening so mysterious?
    I don't want to leave anything of the resources in an open place; I mean, outside of the jar file. The images should be used and shown by the application.
    Help me please!

    The Image class itself does not have any methods for loading images from files so you must be using something more. Most methods for loading images from files have an overload that lets you use a URL, so you just need to use that method with a call to getResource like in the other thread. If you can't think of anything else, you can use ImageIcon to load an Image (the Image is returned by a call to ImageIcon.getImage). See also "how to use icons" from the swing tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html

  • Images are not coming out when application running through jar file.

    I have written an application program using j2sdk1.4.1 that needs your help.
    My application folder's contents.....................
         C:\Examination\Examination.class <-----This is the main class and application's entry point.
         C:\Examination\ExamBox.class
         C:\Examination\PaperSetterBox.class
         C:\Examination\pspBox.class
         C:\Examination\epBox.class
         C:\Examination\TimerBox.class
         C:\Examination\ReportCardBox.class
         C:\Examination\HelpBox.class
         C:\Examination\AboutBox.class
         C:\Examination\Images\(some jpg & gif files)
         C:\Examination\Sounds\(some au files)
    Compilation Report:     There was no error.
    Execution Report :     Was working properly using the command:- java Examination
    Now, I created a jar file for my application in the following steps.................................
              STEP-1:          Firstly, I created a text file(mainclassInfo.txt) that contains
              the line:--     Main-Class: Examination
              This line would be automatically added to the default manifest file when I would include the                name of that text file with the command to create the jar file.
              Location of the text file I created:     C:\mainClassInfo.txt
              STEP-2:          Then I went to C:\Examination and executed the following command(by using                'Command prompt'):--------------------------------------------------------------------
    jar cmf C:\mainClassInfo.txt Examination.jar Examination.class ExamBox.class PaperSetterBox.class pspBox.class epBox.class TimerBox.class ReportCardBox.class HelpBox.class AboutBox.class Images Sounds
    Finally, I got the jar file:-     Examination.jar
    Double clicking on it application ran as it was expected.
    Then, I thought, that as all the files & folders the application needed to run properly were packaged in the jar file; I should delete all the contents of the folder 'Examination', so that no one could see or use anything of the resources easily. I did that.
    So, then it became only:-- C:\Examination\Examination.jar
    Thereafter, I tried to run the application again and there a problem occurred! The application was running, but the images, those were to be used and shown by the application were missing somehow!!
    Moreover, when I kept a copy of those 2 folders('Images' and 'Sounds') into the C:\Examination and ran the application again all the images came out normally!
    I just can't understand why it's happening so mysterious?
    I don't want to leave anything of the resources in an open place; I mean, outside of the jar file. The images should be used and shown by the application.
    Help me please!

    double post http://forum.java.sun.com/thread.jspa?threadID=582311

  • How do I create an executable JAR File ?

    Hi,
    Let's say I have several Class Files that perform a special task.
    How do I bundle them in a JAR file and make it executable, so that the user simply types "prog.jar" and is happy.
    I wonder how that works, as I have to tell the starting point for execution.
    Does anybody now ?
    cu
    Oliver

    Three importants things to do :
    - don't forget to indicate in your manifest.mf the main class and the pacckage
    ex:
    Manifest-Version: 1.0
    Main-Class: mypackage.MyMainClass
    Created-By: 1.3.0 (Sun Microsystems Inc.)
    - don't forget to associate the .jar file with the application java.exe -jar -classpath %CLASSPATH%
    - don't forget to set the environment CLASSPATH correctly
    Hope this help
    Jean

  • Best practices for managing jar files

    just wondering what anyone's thoughts are on managing jar files. I have read that instead of adding the jar files to your CLASSPATH environment variable, you can just extend the jdk. This is accomplished by inserting the jar files into the C:\jdk1.3.1_01\jre\lib\ext directory. I suspect that if the latter option is truly feasible, it would be preferred to adding entries to the CLASSPATH variable for every jar file you want to use. You could end up with hundreds of entries into the CLASSPATH variable if you have that many jar files in use.
    Any thoughts, comments, or links to where I can find any info on this?...
    thanks for any information.....

    In my company, we use scripts (in UNIX system) to handle this problem. The following scripts can iterate jar files in a given directory:
    for i in ${YOUR_LIB_DIR}/*.jar
    do
    YOUR_CLASSPATH=${YOUR_CLASSPATH}:$i
    done
    With this simple script, you can use any directory in the same way as the ext\ direcotry (just copy the jar file in it), and you still have the flexibility of maintaining jar files in different directories, say a number of projects.
    but i don't know whether .bat/.cmd scripts for windows have the same function.

  • Jar files won't execute

    "Could not find the main class. Program will exit!"
    no matter what i put in the manifest, i keeps saying that,
    i've read everything i could find at jar files, and nothing works

    Have you put Main-class attribute in manifest file ?
    if yes, did you put a new line after this attribute ?

  • How do I read the images I bundled into the jar file?

    I just wrote an applet that uses
         Toolkit tk = Toolkit.getDefaultToolkit();
         tk.getImage("blah.gif");to load a bunch of image files. The class file and gif images were bundled into a jar file to minimize the number of connections the browser has to make to the server.
    The applet works fine in appletviewer but trips a java.security.AccessControlException: access denied (java.io.FilePermission select.gif read) when run in a browser. I know you normally use Applet.getImage(URL) to load images but wont that circumvent the JAR file and make a seperate connection to the server for each image? That would defeat the purpose of using a JAR file.
    How do I access the image files I bundled into the JAR file?

    From your Applet class, write the following:
    URL imgUrl = getClass().getResource("blah.gif");
    Image img = getImage(imgUrl);The returned URL will be from the Applet class ClassLoader, which will look into the specified archive (jar) file.

  • Bundling all java,html and even images in a jar file

    Hi All,
    When i bundle all my application .java files in a jar along with manifest i give something as,
    jar -cvf Name.jar manifest.txt *.classMy question is if i want to bundle even couple of HTML and even some images like(jpg,png..etc)..How should i do that???
    Thanks in advance.
    regards,
    Viswanadh

    Follow the instructions here:
    [http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]
    Note that if you want to run the html. it must be outside of the jar, not in it.

Maybe you are looking for

  • Migration from G5 to new i5 iMac

    I've been using a G5 iMac with Tiger, then Leopard, for the past 6 years. I've now bought an i5 iMac to get Snow Leopard before the last chance to do so vanishes. I have some questions about migration of all my data. Question 1. Is it better to conne

  • Can't drag and drop adresses in mail anymore

    Hello, Since I upgraded to Maverick (OS X 10.9 (13A603)), I can't drag and drop adresses from the adressbook to mail anymore (even Cc or Cci). (I did the last update of Mail) Never had this problem with Lion or Mountain Lion. I've seen in the forums

  • Customer invoice n delivery note print together at time of Billing

    Hi, Customer want invoice and delivery note attach together. once billing document saved invoice and delivery note print together immediately. plse suggest Thanks in advance..

  • Clearing old data from CO1P

    Historically this has not been checked in all our locations and as such over the years quite a few entries have appeared here and never been processed (some back to 2006) and as they are previous periods / financial years, cannot be processed now. Is

  • JMS persistence problem

              Hi,           I have persistence half working on WLS6.1 Messages are being written to the database           ok. When I crash the server, the message is still there. When I bring the server           back up the message appears in the desti