How does the app know image folder (non class files) wrapped in jar file?

Hi,
I created an jar file, client.jar, which wrap all necessary files, including packaged class files ( in a hierarachy structure), image folder, properties folder, and ext folder (containing other jar files used). When I run the jar file, like
java -classpath c:\tmp\client.jar -jar client.jar
the app does not know where the images go and could not get the properties files. Actually the image and properties files are contained in the same file: client.jar. How can I fix this. I don't want to extract the jar file back to several separated folders and then run it.
Appreciate the help.

Unfortunately you have to make some changes in your code.. to find the pictures you need to replace:
ImageIcon pic = new ImageIcon("pic.gif");
with
URL url = MyClass.class.getResource("pic.gif");
ImageIcon pic = new ImageIcon(url);
where MyClass is the class which needs to load the resource.
I hope this helped you! /Pingu

Similar Messages

  • How does the system knows hire action first

    Hi all,
    Iam new to this community, recently i have joined as an SAP HR trainee ,and i am undergoing SAPHR training Programme.
    why can't the system allow us to do promotion action before Hire action?where do we configure this to make it happen, how does the system knows to do the Hire action first, where are the settings for this..
    Swathi

    hai
    there are a number of programmes running in the back groung when u do any application.
    the validations will be written in them
    when u try to do something through the programe running at the back ground does these validations  like the example u have taken when u do the promotion action it checks whether actions exists or not if not then it throws the error written in the program.
    regards
    nalla

  • How does the system knows age or seniority is crossed for so and so... EE

    Hi Experts,
    In my project we have configured some Health plans based on ages and seniority,
    Employee can enroll in to the plan when they reach the age or seniority,
    my question is how does the system knows  age or seniority is crossed for so and so... EE, where exactly we do this setups
    Pleae let me know your valuable answers
    Regards
    Sreeni

    hr_entry_date and you can use various
    fm to calculate this, It reads 0019, 0041 or Hdate feature
    3QP8                           Time related calculation function mod.
    HR_AUPBS_SENIORITY             Calculate the whole length of service of employee
    3RP3A                          Leave schem proration modules
    SGPS_LS_SENIORITY_CALCULATION  Function for seniority calculation for Singapore Leave Scheme
    HRDO
    HR_DE_PBS_SENIORITY_PERIODS
    HRFPBS4AV0
    HR_PSF_AV_ANC_INPUT_SENIORITY
    HRF_METADATA_IT
    HRF_READ_SENIORITY_IT

  • How does the Photo Download Backups folder work?

    I am wondering how the Photo Download Backups folder works--does it keep backups for just a certain amount of time? I just recently found this in my Downloads folder when I was cleaning out unncessary files for extra hard drive space. Mine has nearly 60GB so it would be great to clear it out if possible. (I already backup to an external drive.) Thanks for any insight.

    You are talking about two different things:
    Are you downloading the pdf to your computer or trying to view it in your browser? These are two different things. If you are trying to view it in your browser, which browser under which OS? How are you trying to view it. If you are trying to download a pdf, again please list the steps.
    As to conversion to pdf, you use the Save AS Other menu.

  • How does the scrollbar know which field it lands on?

    Hi all
    I'm looking at components at the moment. Not how to use them
    but how to create them yourself to increase your workflow.
    When dragging a scroll component on to a dynamic textfield it
    automatically determines which field it land on, and populate the
    targetInstanceName variable in the property inspector.
    How does it do that? I guess it's a jsfl file being run, but
    I can't figure out how to run a jsfl file the moment the user let
    go on the component.
    Thanks in advance,
    Jakob

    Hi Antony,
    There is no need of Sender Agreement and hence sender communication channel. Sender Agreement identifies three things,
    Namespace, Software component version and Outbound Interface. In Idoc communcation there is no need of Sender agreement as we can identify above things without Sender Agreement itself like namespace - Idocs have standard namespace and can be accessed across the sofwatware component versionsn and the idoc type it self specifies the interface name.
    You cannot define a sender IDOC channel in Integration Directory due to fact dat IDOC adapter does not run in J2EE AF but is an 'built in" adapter.
    Thanks,
    Vijay Kumar T.

  • How does the system know...how to read customore pricing procedure

    Hie Guys, Can you please let me know how the system knows How to ready customer pricing procedure.
    system always reads customer pricing procedure from Sold to  party. can you please let me know if there is any setting for the system to know how to ready the customer pricing procedure. what should be done if we want the system to read it from ship to party?
    thaks!
    Marry.

    Dear,
    Seems like you can get the help of abaper and see at what point system check the different combination for pricing procedure determination.
    If there is any EXIT / Enhancement available at this point, you can write a logic to fetch the customer pricing procedure from the SHIP TO PARTY Master data.
    Thanks & Regards,
    Hegal K Charles

  • [Iphone Development] Device or Simulator : how can the App know?

    Hi,
    Since I encountered a few differences from run on Device and the same App on the simulator, I'd like to perform a few tests to be sure of any points. To do that, I need to know whether the App is running on the device or the simulator.
    Is there a way to figure it out?
    I tried
    #if TARGETOSIPHONE
    #endif
    but it is always true, whether I am on device or simulator.
    Thanks in advance.
    Message was edited by: g_Marvin
    Message was edited by: g_Marvin

    The code you're showing is dedicated to the compiler, and the code bewteen #if and #end will or will not be part of your binary depending on the condition.
    If you wish to get the info at runtime you'd better use the UIDevice class.
    [[UIDevice currentDevice] model]
    will return an NSString with the name of the device (i.e. @"iPod Touch") and you'll be able to check for the simulator model string.
    Hope this helps
    Phil

  • How does the map know where I am exactly

    Ok I click on map and find my location and exactly correct it knows my location. Even though the ip address is located in another state. Wondering how it knew the location.

    It uses the registered addresses of the wi-fi routers that it can see.
    From the manual:
    "iPod touch uses location services to determine your location. Location services uses available information from local Wi-Fi networks (if Wi-Fi is turned on). "
    http://manuals.info.apple.com/enUS/iPod_touch_iOS4_UserGuide.pdf

  • How Does The Browser Know The "File Name" field in the "Save As" dialog

    Hi!
    I have a servlet called co.com.SomeStaff who reads a binary file from the server an sends it to the breowser.
    The Browser opens the "Save As" Dialog whith the value "co.com.SomeStaff" in the File name field, but and I need the name "SomeBinariFile.exe" instead.
    How can I change that value?
    Thanks All.

    Use <%
    response.setHeader("Content-Disposition", "attachment; filename=filename.2save");
    %>

  • How does the "Read TDMS" function work when reading part of a data file?

    Hi everyone,
    I have stored some rather large .lvm files that causing me a a big headache when trying to read/analyse the data.... As a work around I first convereted these files to .tdms.... Now the files are much smaller (50%) and can be load/plot within a couple of seconds rather than 10's of seconds.
    Specifically, the files include 7 channels of data that were sampled at 2kHz for about 8-9 mins..... So, each file contains about 700,000 data points or elements.... I am using a producer/consumer architechure to read/plot all the data, then using cursors to identify a data subset, which is send via a queue to the consumer where analysis occurs.... Given the size of the files, when subset is quite large I get "Out of Memory" errors and LabVIEW crashes.
    What I am thinking is that I can down-sample or decimate the data in the producer back to 1kHz (I need to ms resolution so I can see the spikes and can appropriately selected the subset) then index back into the original tdms file to send the undeciated data to the consumer.
    With the "Read TDMS" function, the help states:
    COUNT: Specifies the maximum number of data elements to read from the .tdms file for each channel. The default is –1.
    OFFSET: Specifies the number of data elements into the .tdms file at which the function begins analyzing the .tdms file. The default is 0.
    I am confused by the term "elements". Does this mean actual "data points" as in elements within the 2D array? Or bytes? I am hoping array elements... Would this then mean that given my 7 channels of data, each element value that is a multiple of 7 would index into a new line of data? I also assume this index is zero based... So with no offset, a count value of 0 would return all the data elements at time 0.0000s for all channels (regardless differences in the precision of each channel, unlike bytes), a value of 7 would return all the data elements at time 0.0005s, a value of 14 would return all the data elements at time 0.0010s, etc etc..
    Also, if anyone has any example code for indexing into a file using this method they could shareI would be very appreciative... I would assume a for loop could also be used to read the data subset into the consumer in smaller chunks to reduce the memory load?
    Many thanks,
    Jack

    You should have a different channel in the TDMS file.  So you are reading X elements from a channel starting at element Y.  Yes, those are elements in the array, not Bytes.  NI did a good job of making the API easy to use.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How does the automatic compilation occur for 2 classes in the same package?

    Hi friends,
    This is my first file Base.java
    package Base;
    class Base {
    protected void amethod() {
    System.out.println("amethod");
    }This is my second file :
    package Class1;
    public class Class1 extends Base {
    public static void main(String argv[]) {
    Base b = new Base();
    b.amethod();
    }However even if I compile only Class1,why do I get the output as "amethod" ? I an not compiling Base class also with this.Do the files get automatically compiled if they are in the same package ?
    Thanks.

    coupdegrace wrote:
    JoachimSauer wrote:
    Force1 wrote:
    Do the files get automatically compiled if they are in the same package ?No, but if the class you compile depends on another that's not yet been compiled (or for which the source is newer than the .class file), then it will be compiled as well.Like,say If i add a int parameter, amethod(int i),then I will get a error,isn't it ?It actually gives a error.
    Also it will compile automatically only for the first time and any changes made to any file will have to be compiled into latest .class files ?Yes.
    Did compile the files under the above constraints.
    So it is a smooth "run" for the first time,but not after editions to the either files.
    I would appreciate if experts give some feedback on this.
    Thank you.

  • How does the iPod organize content?

    When I manually add content to my video iPod, how does the iPod know where to put it? Does it go into Movies, Music, TV shows, podcasts, etc? Does it rely on the mp3 id tags??? If yes, can I force a movie to go into the music folder my simply changing mp3 id3 tags?
    30G video ipod   Windows XP Pro  

    1 I by its tag
    2 depends on the files tag
    3 No...mp4 and m4a files have diffrent tags then mp3s
    In iTunes 6.0.5 if you change the "VIdeo Kind" it will sort correctly. Just right click file, and in the options tab change the setting under "VIdeo Kind".
    Besides iTunes if you want to change a tag you have to use a mp4/m4a tag editor program like "YAMB ver 2 preview" it can change your tags and much more and its free http://yamb.unite-video.com/
    you can try YAMB ver 1.6 but I don't think it works very well with tags.

  • How does the boot-process assemble the raid?

    Hi everyone,
    I just switched from Debian and CentOS to archlinux on all my machines and I really love it so far!
    Now I feel that I can really customize my OS the way I want.
    But I was thinking about one thing that I don't really understand yet, and of what I have
    read on this forum I'm certain that someone knows the answer.
    On my primary machine I have an mdadm-raid.
    And the partitions looks like this:
    /dev/sda                          /dev/sdb
    Disk1                              Disk2
    /dev/sda1                        /dev/sdb1
    100mb ext2 (boot)            100mb empty (I did empty partition so that the disks looks the same.)
    /dev/sda2  <- RAID0 ->   /dev/sdb2            /dev/md0
    2500MB ext3 (root)          2500MB ext3
    /dev/sda3  <- RAID0 ->   /dev/sdb3            /dev/md1
    2250MB (swap)                2250MB swap
    /dev/sda4  <- RAID0 ->   /dev/sdb4            /dev/md2
    245150MB ext3 (home)    245150MB ext3
    So there was a little tricky to get it installed and assemble the raid at boot, but now it's working like a dream again.
    And what I did what except loading mdadm-hook of course I used the kernel parameter: ro root=/dev/md0 md=0,/dev/sda2,/dev/sdb2 a.s.o. to
    tell the initrd how to assemble the raid at boot.
    But before archlinux i've done this setup in the installer, and after I've installed for example Debian, the system boots correctly and
    assemble the raid at boot, but without the kernel-parameters, how does the system know how the raid should be assembled?
    I've tried to include the mdadm.conf but with no success, does the initrd contain the raid information is some way?

    To obtain that file, run:
    abs
    This will provide the abs tree of core,extra, and community in /var/abs.
    Then you can get the file:
    # vim: set ft=sh:
    run_hook ()
        input="$(cat /proc/cmdline)"
        mdconfig="/etc/mdadm.conf"
        # for partitionable raid, we need to load md_mod first!
        modprobe md_mod 2>/dev/null
        # if no config file is present create one from command line parameters
        if ! [ -e $mdconfig ]; then
            #Create initial mdadm.conf
            # scan all devices in /proc/partitions
            echo DEVICE partitions > $mdconfig
            for i in $input; do
            case $i in
                    # raid
                    md=[0-9]*,/*)
                        device="$(/bin/replace -s,/ "$i" "=" "")"
                        array="$(/bin/replace -s/ "$device" "," " devices=")"
                        echo "ARRAY /dev/$array" >> $mdconfig
                        RAID_FOUND=1
                    # partitionable raid
                    md=d[0-9]*,/*)
                        device="$(/bin/replace -s=d "$i" "md=" "md_")"
                        array="$(/bin/replace -s/ "$device" "," " devices=")"
                        echo "ARRAY /dev/$array" >> $mdconfig
                        RAID_FOUND=1
                    # raid UUID
                    md=[0-9]*,[0-9,a-z]*)
                        device="$(/bin/replace -s,/ "$i" "=" "")"
                        array="$(/bin/replace -s/ "$device" "," " uuid=")"
                        echo "ARRAY /dev/$array" >> $mdconfig
                        RAID_FOUND=1
                    # partitionable raid UUID
                    md=d[0-9]*,[0-9,a-z]*)
                        device="$(/bin/replace -s=d "$i" "md=" "md_")"
                        array="$(/bin/replace -s/ "$device" "," " uuid=")"
                        echo "ARRAY /dev/$array" >> $mdconfig
                        RAID_FOUND=1
                esac
            done
        else
            RAID_FOUND=1
        fi
        if [ "$RAID_FOUND" = 1 ]; then
            # assemble everything
            /sbin/mdassemble.static
        fi
    The above is what is provided in mine............

  • How does the Oracle DBMS locate the Oratab file?

    I'm new to the Oracle environment. I have also successfully installed Oracle 11g on a Red Hat Enterprise Linux 5.3 platform. How does the DBMS locate the oratab file? My oratab is located under the "/etc" sub-directory. How does the DBMS know to look their? If I wanted to change the location of my "oratab" file how do I point the DBMS to the new location?
    Thanks

    The RDBMs does not care of the oratab file. (why should it?)
    But some other scripts/utilities does. dbca, dbstart, dbshut and possible a lot others.
    So if you want, you can delete or move this file without affecting any RDBMS, but you have to modify all scripts you use if they rely on oratab, and you have to accept some tools will provide unexpected results without it.
    My personal suggestion: move oratab somewhere in your $ORACLE_BASE and create a symbolic link from this location to /etc/oratab.
    hth,
    Martin

  • How does the SecurityManager authorize with JAAS?

    Hello,
    I'm using java 1.3 and JAAS, trying to write my own Permission for authorization. How does the SecurityManager know to authorize a method for a Subject? Does the method that I want protected have to explicitly call checkPermission()?
    The examples given are always for FilePermission. They show a program calling Subject.doAs() to perform an action as a particular Subject, and they imply that checkPermission() is called by the methods doing the file access.
    Thanks

    I think you
    a) create a specific permission class (such as a "canDoThisPermission(String targetMethod)" class)
    b) in your method check that the permission is granted by calling
    checkPermission(new CanDoThisPermission(<methname>))
    be sure your new permission class is being loaded from a trusted location (...lib/ext/... for eg.)

Maybe you are looking for