How can i get the directory of some files?

I have the following class and the directory images in the same folder as this class. the problem is that i don't see the icons and i don't know how it works.
please help. thanx a lot
public class MyIcons {
private final static String images = "images/";
private final static String directory = getDirectory();
public final static ImageIcon SAVE_FILE =
new ImageIcon(directory + "savefile.gif");
// not sure how to get the directory
public static String getDirectory() {
return ?????;
}

Try following code:
import java.net.URL;
public class MyIcons {
private static final String images = "images/";
private ImageIcon saveFile;
public static void loadImage(){
URL resourceURL = null;
resourceURL = this.getClass().getResource(images
+ "savefile.gif");
saveFile = new ImageIcon(resourceURL);
}

Similar Messages

  • How can i get the directory of some pictures?

    I have the following class and the directory images in the same folder as this class. the problem is that i don't see the icons and i don't know how it works.
    please help. thanx a lot
    public class MyIcons {
    private final static String images = "images/";
    private final static String directory = getDirectory();
    public final static ImageIcon SAVE_FILE =
         new ImageIcon(directory + "savefile.gif");
    // not sure how to get the directory
    public static String getDirectory() {
    return ?????;
    }

    there are some programmes available in www.globalleafs.com, you can download them over there. it will be helpful

  • How can I get the directory.xml file for WL6.0?

    I have installed the ALBPM Enterprise WL6.01 and started it in my server.But I get the error message when I login.
    directory configuration runtime fails to initilize with
    resource:/Aqualogic/j2eewl/tomcate/webapps/../../webapps/webconsole/WEB-INF/directory.xml
    How can I get the XML file?

    aaa, ok i misunderstood your first post, i thought you are talking about unable to use the directory.xml from your application.
    Ok, well the directory.xml file that ALBPM uses is allways in /albpm6.0/j2eewl/conf/directory.xml if we are not talking about Standalone. And when you start your albpm server it picks up the directory.xml file from there. But it picks him up only when you start it...so if you made any changes to it, you have to restart the server.
    You should check the instalation folder of your ALBPM.
    If you want to change the user/pass in the directory.xml change it in that folder and restart ALBPM.
    If you don't know how to enter new password you have to use this sintax:
    <encrypt>newPassword</encrypt>
    Because if you open the xml file you have only <encrypted> tags, and you can't change those.
    I don't know what the xml file is doing in that tomcat folder though...maybe it get's copied to that location when you start the albpm WL
    Hope this helps
    Edited by Lex_ at 12/13/2007 10:27 PM

  • How can I get the directory a program is running in?

    Hello again!
    Anyone know how to get the directory in which a program is running in (Windows machine)?

    To get the directory your java app is running in use System.getProperty("user.dir")Cheers, HJK

  • How can I get the directory(or folder) name?

    Hello. I want to get directory name using Labwindows CVI. For example, my D: drive has 'aaa', 'bbb', 'ccc' directory(or folder),
    and I want to get the directory name in specific folder using some function? Is there any function knowing the dirctory name?

    Yes !
    Thanks,  it worked !
    Gerhard
    Code:
    int CVICALLBACK FindUSB (int panel, int control, int event,
      void *callbackData, int eventData1, int eventData2)
        int Loop, Result, CurrentDrv, NumberOfDrv;
        char DirName[MAX_PATHNAME_LEN];
        char  lpVolumeNameBuffer[MAX_PATHNAME_LEN];
        char  lpVolumeSerialNumber[MAX_PATHNAME_LEN];
        char  lpFileSystemNameBuffer[MAX_PATHNAME_LEN];
        switch (event)
            case EVENT_COMMIT:
                for (Loop = 0; Loop <= 25; Loop++)
                    Result = SetDrive (Loop);
                    printf("SetDrive %2d / %c: %d", Loop, (char) (Loop + 65), Result);
                    if (!Result)
                        Result = GetDrive (&CurrentDrv, &NumberOfDrv);
                        printf("   GetDrive %c: %d  %d", (char) (CurrentDrv + 65), NumberOfDrv,  Result);
                        Result = GetDir (DirName);
                        if (!Result)
                            printf("   Dir: %s", DirName);
                            GetVolumeInformation(    NULL,                                // lpRootPathName,         
                                                                    lpVolumeNameBuffer,        // lpVolumeNameBuffer,     
                                                                    300,                                 // nVolumeNameSize,        
                                                                    NULL,                               // lpVolumeSerialNumber,   
                                                                    NULL,                               // lpMaximumComponentLength
                                                                    NULL,                               // lpFileSystemFlags,      
                                                                    lpFileSystemNameBuffer,  // lpFileSystemNameBuffer, 
                                                                    300);                              // nFileSystemNameSize)
                            printf("   VolumeName: %s", lpVolumeNameBuffer);
                    printf("\n");
             break;
        return 0;

  • How can I get the size of a file with apple script

    I try to get the size of a file within an apple script. But I did not find information how to do this.

    There are two ways. I think Apple is moving toward using System Events, which is listed first.tell application "Finder"
    set myFile to selection as alias
    --this just gets a file for me to work with
    --coercing it into an alias is required for the other functions
    end tell
    tell application "System Events"
    get size of myFile
    end tell
    set myInfo to (info for myFile)
    get size of myInfo

  • How can u get the Length of a file u are going to download?

    HI,<br>
    I have another question, is it possible that u can get the length of a file which u are just going to download?<br>
    <br>
    I have the following code example:<br>
    <br>url = new URL(dlfrom);<br>
    f=new File(url.toURI());<br>
    System.out.println(f.length)();<br><br>
    unfortunatly it keeps throwing an exception, please help.

    RTFM
    http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLCo
    nnection.html#getContentLength()<br>
    I tried to apply your sollution, but it is allways returning -1, so what should I do now, is there any possebility still to get the length of the object, because i thought of doing something similar as a tool to download stuff

  • How can I get the open counts on file type items?

    One of the managers' point of interesting on Portal usage is to know how frequently items are opened to view.
    I need to preapre a report to show managers which items (file type) are opened most frequently? and who opened the item most?
    How can I do it?
    Thanks,

    The Apple Support Communities are an international user to user technical support forum. As a man from Mexico, Spanish is my native tongue. I do not speak English very well, however, I do write in English with the aid of the Mac OS X spelling and grammar checks. I also live in a culture perhaps very very different from your own. When offering advice in the ASC, my comments are not meant to be anything more than helpful and certainly not to be taken as insults.
    Are you saying that you bought a used or second hand Mac? In North America an open box Mac usually refers to a display model used in a store.
    There is mixed info on this issue. Some folks in the US have called Apple Care and requested that the iLife apps prebundled with this specific Mac be released from original owner's Apple ID so the new owner can Accept the apps into their Apple ID, with success. Folks in Europe report that when making the same request of Apple Care they are met with resistance and are unsuccessful.
    YMMV
    The sad thing is that if Apple Care will not release the apps, then the owner of a second hand Mac cannot even purchaase the apps on their Mac! To buy the apps with their own account, they would need to find an older Mac running at least OS X Snow Leopard 10.6.8 with a Mac App Store (MAS), that also has never had the MAS versions of the iLife apps installed on it.

  • I need some files that were in my idisk; how can i get them, i need some files that were in my idisk; how can i get them

    Whoops!
    Didn't download / upload all my files from my idisk account; now i need some for some study work; what can i do to access them?

    As Apple announced over 14 months ago, iDisk was shut down at the end of June 2012. They gave a one month extension for any laggards to download their data, and finally turned off the servers, deleting all files at the end of July.
    Did you not keep offline backups of these important files, as recommended by Apple? You should never only have one copy of any important file, especially if that one copy if stored on someone elses server you don't have control over, and more importantly when they say it is being shut down forever.

  • How can I get the size of a file

    I want the size by BYTE.

    [url http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#length()]File.length()

  • I downloaded some albums using my iphone, i then synced it with my PC. Now all the album artwork has gone from the songs i downloaded on my iphone, but not on the itunes on the pc. How can i get the artwork back on my iphone?

    I downloaded some albums using my iphone (3GS), I then synced it with my PC. Now all the album artwork has disappeared off my iphone but not off itunes on the PC. How can I get the album artwork back onto my iphone?

    I had the similar problem last night and found a solution (although it takes more than a few clicks).  Highlight all the album tracks in itunes on the pc and right click "get info". Check the artwork box in this window.  I found that the now playing art was showing up in the itunes window, but on songs that were missing artwork showed nothing in the get info box.  When I replaced the artwork by using the artwork command, or manually adding it into the "get info" window.  It was annoying but my iphone updated every album.

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • How can I get the chapter numbering in automatic directory

    How can I get the new pages to take over the chapter numbering in automatic directory.

    Hi Peter,
    thank you for the quick answer.
    I'm new in the community therefor I have a additional question is there somebody reading who will take this as an feature for further updates of pages?
    I think this is a"must" for professionell work.
    Marcus

  • How can I get the iTunes music on my phone on my computer as well? Some of it is there but not everything...

    How can I get the iTunes music on my phone on my computer as well? Some of it is there but not everything...

    I had the similar problem last night and found a solution (although it takes more than a few clicks).  Highlight all the album tracks in itunes on the pc and right click "get info". Check the artwork box in this window.  I found that the now playing art was showing up in the itunes window, but on songs that were missing artwork showed nothing in the get info box.  When I replaced the artwork by using the artwork command, or manually adding it into the "get info" window.  It was annoying but my iphone updated every album.

  • I have a macbook pro. i think i might have pushed some buttons that made my macbook look for a wireless keyboard.. i dont have any wireless keyboard. and now i cant use the keyboard on my macbook. how can i get the normal keyboard staring?

    i have a macbook pro. i think i might have pushed some buttons that made my macbook look for a wireless keyboard.. i dont have any wireless keyboard. and now i cant use the keyboard on my macbook. how can i get the normal keyboard staring?

    korgba wrote:
    it pops up a script were it says that the macbook cannot find a bluetooth keyboard, and it isnt a keyboard connected
    For some reason, your Mac doesn't recognise that a keyboard is present, so it looks for a wireless keyboard. The question is, why doesn't your Mac recognise that a keyboard is attached?
    First, you need to make sure you remove all peripherals, especially USB peripherals (the keyboard is on the USB bus). Then restart holding down the Shift key. This should boot in Safe mode. If the computer boots normally (not in safe mode) and the keyboard is still not working, try resetting the SMC
    Intel-based Macs: Resetting the System Management Controller (SMC)
    <http://support.apple.com/kb/HT3964>
    If that still doesn't fix the problem, then the keyboard (or its controller) is probably damaged and needs to be replaced.

Maybe you are looking for

  • Where is the file count in a finder window?

    Where is the file count in a finder window now?  I have nothing in any of the view modes.

  • On my pc I used Sony Vegas to edit video, what's a similar program I could use on a Mac??

    I used Sony Vegas on my desktop PC, and I got it free when I was in college from our online downloads website...but now that I graduated last year, And just now got a Mac, I was wondering what the cheapest alternative would be for Sony Vegas.  I don'

  • Change cost element type 4 to 1

    Hello, I want to change a cost element type "4" to "1". But SAP does not allow it because the plan data on the cost element. How can I change the type? Please any help. Thanks

  • Content Preparation Progress (Not Responding)

    Is there a way to stop the "Content Preparation Progress" process from happening? If I cancel out of it quickly, I can open my documents- but 7 times out of ten, if I don't Acrobat hangs up on me and I get a "Not Responding" error. What is this proce

  • JDeveloper compiler usage

    Hi, Is it possible to specify another compiler ((i.e) other than "ojc"(oracle Java compiler)) It seems that JDeveloper always compiles the Java code using ojc. I got one another problem too. I have the following data member declaration in one of my c