Getting current directory for JFileChooser

I'm trying to construct a JFileChooser that uses the current directory as its view (and not the default Windows "My Documents" directory path). How can I get the current directory path? File definately doesn't have anything, Toolkit neither.

I had the same exact question a while ago. The solution is quite simple.
JFileChooser j = new JFileChooser(".");

Similar Messages

  • How to get current date for posting date

    hi,
    how to get current date for posting date ? any sample code ?
    Thanks

    Hi......
    Use
    Select getdate()
    for current date.......
    Regards,
    Rahul

  • Cd_links: could not get current directory

    I am installing Oracle8 in Linux and that's the error that I am
    getting: cd_links: could not get current directory
    Does anyone know where is cd_links?
    null

    Claudia (guest) wrote:
    : I am installing Oracle8 in Linux and that's the error that I am
    : getting: cd_links: could not get current directory
    : Does anyone know where is cd_links?
    Which Oracle version are you installing? It's the Enterprise
    Edition or the Standard Edition, did you download it from the
    web? or you got the cd?
    null

  • Getting current directory from an applet

    Hi. How can I get the current directory of my applet running on web without having to worry about permissin. I used the one below:
    curDir = System.getProperty("user.dir");
    but I get this error:
    ava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
    any substiture for this? Thanks.

    You should be using URLs or similar approaches, and avoiding File, which will
    never work with an ordinary applet.
    InputStream in = this.getClass().getResourceAsStream("file.txt");That assumes the txt file is in the same place as the current classes .class file.
    For example, the same folder or that they are jarred in the same "folder" in the jar.
    You can also use a URL directly:
    URL url = ...
    InputStream in = url.openStream();and you can construct that URL with the help of Applet methods getDocumentBase or getCodeBase:
    URL url = new URL(this.getDocumentBase(), "file.txt");That assumes the txt file is in the same folder as the html file in which the applet is embedded.

  • Get current directory(without user.dir)!!!!

    Dudes,
    need help badly... i need to get the current directory of the jar file where it gets launched from. Since the launching takes place from an html file, the system property "user.dir" does not get set to the current directory. Both the html as well as the jar file is in the same location.
    so in short, i need to get the current dir without using the user.dir that i can later set it explicitly thru my program(to the current dir)

    "Search the CLASSPATH for the first occurence of your jar file... but FFS only do it once, and save the result"
    Cud ya elaborate that statement.
    Also, the reason i wanna know is this : my jar file references all the images that it uses, thru a relative path(./a/b/c.....). So wen i simply double click the jar file, the relative path("./") gets replaced with the current workin directory(from user.dir) and fetching of images works perfectly. But if it is launched via html, the user.dir does not get set to the current working dirctory and as a result the jar file looks for its images in the default location which is the desktop. so it doesnt work
    Now that the context is clear, is there a way out???? or is there any way in which i can set the user.dir from the html itself(maybe by using javascript or somethin??)

  • How to get current directory and enviroment variables

    Hello, 
       1.- Is there a global variable to get the actual (project, where is DSB and DSQ files) directory? 
       2.- Is there a way to get User directory like reading enviroment variables from Operative System? 
    Thanks in advance.
    PD: I'm using Dasylab12
    Solved!
    Go to Solution.

    Yes, use System Strings
    For example, ${DATA_FOLDER}.
    The easiest way to get the list is to right click and select Global Strings. The bottom half of the dialog box lists system strings, including date, time, the name of the worksheet, with or without path, the DEFAULT folders for worksheet, data, other, black box, etc. 
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • Getting current directory

    Is there some way to get the current directory path in java?
    -Kevin

    Use
    System.getProperty("user.dir")
    you can get the directory in which you start your java application.

  • Get Sequence Directory for property loader

    Hi,
    Im using the property loader in order to retrieve test parameters for my different testroutines.
    How do i get the directory where my sequence file is placed, so that my property loader wont care where the entire Folder is dropped and launched from, when trying to load my settings.
    I know i can do this "RunState.SequenceFile.Path", but thats the FULL path to my sequence file, what if i only wanted the directory where the sequence file is placed.
    It just seems obvious that there should be a function for this.
    (Vers. 3.1)
    Thx in Advance

    I know this thread is a few years old but I thought I would append to it for the bennifit of anyone else looking for this specific answer, like I was.
    In your property loader setup, on the source tab, select "Use Expression To Specify File" and type in:
    Left(ThisContext.RunState.SequenceFile.Path, Find( ThisContext.RunState.SequenceFile.Path, "\\",0,False,True  )) + "\\Limits.txt"
    Where Limits.txt is whatever file name you want to use and the properity loader will look for the file in the same directory as the loaded sequence file.
    Cheers
    Gregory Osenbach, CLA
    Fluke

  • How to read files from current directory for applet

    I have an applet that needs to read some audio files located in its current directory on the server and I just can't seem to figure it out...maybe I am being dumb...any help?

    You can use the ListSorter File Adapter Configuration property to sort based on timestamp. Basically add the following property to the inbound JCA file:
    <property name="ListSorter"
    value="oracle.tip.adapter.file.inbound.listing.TimestampSorterAscending"/>
    <property name="SingleThreadModel" value="true"/>
    More info see section 4.2.6 in http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm

  • Get current directory?

    Hello
    How do I get the directory a java program is running in?

    System.getProperty("user.dir")

  • How to get current user for WS

    Hello
    I've created Web Service from Stateless Session Bean with Basic Authentification & Support Logon Ticket features.
    I need to determine current logged user in bean methods.
    UMFactory.getAuthenticator().getLoggedInUser() method requires Request & Response.
    WDClientUser.getCurrentUser() throws NullPointerException when i try call it.

    Hi Aliaksandr,
    try this,
    WDClientUser.forceLoggedInClientUser().getSAPUser().
    getUniqueName();
    In order to the User ID, you have to run your WD application in the Portal.
    Hope it helps,
    - Teecheu

  • How can I make an applet look to the current directory to read a txt file in?

    I am using a File class passing only the file name as the contructor but forte still looks in "C:\forte_jdk\forte4j\bin\Events.txt" which is not my current directory for the project.
    If leave it and ftp this applet to my web site I get an IOException.

    I always find visual aids helpful. See below for screenshots & discriptions.
    01. The Basics
    When you create a new site & go into design view (in the example below it's the Home page), you'll see the following.
    The white box is your page.
    The grey box outside of that is your browser area.
    The black & white checkered area is the Adobe Muse CC application chrome.
    02. Add Box
    Draw / Add your rectangle or text frame (text tool). I drew a rectangle, gave it a fill color of blue & turned the stroke from 1 to 0.
    03. Extend & Snap to Browser Edge (Left)
    Click, hold  and drag your mouse on the center adorner (adorner is the little squares that you can grab to resize your rectangle) until you resize your rectangle to the browser edge (the dark grey area) until you see a red line. This means you've 'snapped' one of the rectangle's edge to the browser edge.
    04. Extend & Snap to Browser Edge (Right)
    Repeat the process except do this for the right edge. In truth, it doesn't matter in which order you resize your rectangle to snap to the browser edges. The key thing is to be sure to do this for both sides of the rectangle & snap it to the browser edge (see the red line).
    05. You're done! Preview.
    06. Bonus!
    Once again, you can make rectangles or text frames 100% width, BUT you can't do this with placed images.
    However, you can do this with a rectangle or text frame. Then set the Fill of either the rectangle & text frame to be an Image & set the Fitting to 'Scale to Fill.'
    (see below for example - I used a rectangle & changed it's Fill property)
    Now when I preview, the image is 100% width. In truth, it's a 100% width rectangle with a fill of an image.

  • Javac.Main current directory

    I am trying to compile a java class file written by a static method of an abstract class, which the new class extends. I then tried to compile said class with the javac.Main tool, but it gives me compilation errors.
    In short, it does not recognize that it extends the abstract class which is in the same directory as the new class, and so it does not compile.
    If I open up my terminal, navigate to the particular directory in which the source files exist, and then type in "javac -source 1.4 -d ./ -classpath ../:/selenium-remote-control-0.8.1/selenium-java-client-driver.jar ./test1Bot.java", it will compile just fine, and has no problems.
    If I try to run javac from a directory other than the one with my source files, it will not work, no matter how absolute I make the paths.
    When I try to run the command above with absolute paths in the javac.Main.compile() method, it does not seem to work.
    Is there some way in which I can set a current directory for the javac.Main object or compile() method, or can I simply call my command line and use it to navigate to my directory, and execute my javac string which I know works in that location?
    Thanks.
    [email protected]
    [email protected]

    I don't know why you're getting that particular error, but the <> around the classpath looks wrong.
    Also, you don't javac Main.class
    You javac. Main.java and then java Main.

  • Issue in getting current row value using getCurrent Value

    Issue:When I call ththe method executeSearchVO from controller class
    with Row row = personalActionSearchVO.first();
    I am getting the corresponding value.
    but my requirement is I have multiple record , If i press action on any of the record, I need to read SITName value for the particular record and need to pass it as parameter to other pager(i mean If i select any record, I need to get corresponding value in the attribute for the record.)
    if i comment personalActionSearchVO.first(); i am getting null pointer exception.
    Pl. helpme how to get current row instead of first row always.
    AMIMPL Clause
    public void executeSearchVO(String loginPersonId)
    XXHRPersonalActionSearchVOImpl personalActionSearchVO =getXXHRPersonalActionSearchVO1();
    personalActionSearchVO.initQuery(loginPersonId);
    // Row row = personalActionSearchVO.first();
    row = personalActionSearchVO.getFirstFilteredRow("action","1");
    Row masterRow = row;
    personalActionSearchVO.setCurrentRow(masterRow);
    OARow Row1 = (OARow)personalActionSearchVO.getCurrentRow();
    System.out.println("Org "+Row1.getAttribute("Organization"));
    calling this method from controller clause
    if("action".equals(pageContext.getParameter(EVENT_PARAM)) )
    System.out.println("Person Id "+ pageContext.getParameter("XXHRPersonId"));
    Serializable methodParams[] = {pageContext.getEmployeeId()+""};
    applicationModule.invokeMethod("executeSearchVO",methodParams);
    need it urgently. pl. help
    thanks
    siva

    Timo,
    I am new to Jdevloper. I will explain the issue in detail.
    Version: Oracle 9i Jdeveloper
    I have a query page with multiple records. when I perform action , I need to pass 2 parameters from query screen to my actual page.
    1 parameter is Login person Id,. Now the issue is with getting current value for 2nd paramenter. 2nd Parameter will be changed depends upon record i am choosing in my query page: column is : Information Name.
    when I use getcurrentrow , I am getting null pointer exception.
    My controller class when I click action button :
    if("action".equals(pageContext.getParameter(EVENT_PARAM)) )
    Serializable methodParams[] = {pageContext.getEmployeeId()+""};
    applicationModule.invokeMethod("executeSearchVO1",methodParams);
    {color:#993300}
    // Here I need to get InformationName value based on the record I am choosing{color}
    HashMap hashMap = new HashMap(2);
    hashMap.put("XXHRPersonId", pageContext.getParameter("XXHRPersonId"));
    // hashMap.put("InformationName", methodParams);
    pageContext.forwardImmediately(
    "OA.jsp?page=/xxhr/oracle/apps/xxhr/selfservice/personalaction/webui/XXHRPersonalActionPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    hashMap,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO
    my AMIMPL Clause :
    I am just pasting whatever I have tried. Pl. suggest me If my code is wrong.
    *{color:#993300}I need to get current row information value from the below method*
    *{color}*
    public void executeSearchVO1(String loginPersonId)
    XXHRPersonalActionSearchVOImpl personalActionSearchVO =getXXHRPersonalActionSearchVO1();
    personalActionSearchVO.initQuery(loginPersonId);
    System.out.println("Row count "+personalActionSearchVO.getRowCount());
    // Row row = personalActionSearchVO.first();
    Row row = personalActionSearchVO.getCurrentRow();
    System.out.println("Informaton Name "+row.getAttribute("InformationName");
    In this , If i initialzie with Row row = personalActionSearchVO.first();I am able to get value for my column Information Name.
    whereas, if I use directly Row row = personalActionSearchVO.getCurrentRow();, i am getting null pointer exception.
    Pl. let me know how to get current row value for Information Name.
    Looking for the reply at the earliest.
    Thanks
    siva

  • JFileChooser: changing file type resets current directory

    I create a JFileChooser with multiple file types and set the current directory. It comes up with the first file type and the current directory. If I select another file type, the files shown are not in the current directory, which I set -- they are files in the application default directory. Is there a way to keep my current directory, while changing the file type? Or is this a feature?

    Are you talking about your own CDs imported to iTunes or are you talking about songs purchased from the iTunes Music Store (iTMS)? If the latter, the iTMS, you do not get any choice in the format downloaded. You get protected AAC files and that is all.
    If you want to change how you import files, go to the iTunes preferences for importing and choose the format you want to use from now on.
    Patrick

Maybe you are looking for

  • TS3276 I cannot add contacts to the address book by clicking "add sender to address book."

    In Apple Mail, OS 10.7.3, when I click on add sender to address book, nothing gets added. The address book doesn't change. When I try adding addresses via previous recipients, the button is active, but when I click, nothing is added to the address bo

  • Get Serial ID!

    How can I get Serial ID of HDD (Hard Drive Device)? Write,please, source code or some words about it. Thanks!

  • Backup through DB13 take long time

    Hi, I am using Oracle 9.0 DB in SAP ECC 6.0 (windows 2003) & Size of DB is around 118 GB.For last one week i m facing a problem of slow processing  speed of backup in Tape.Its take 2 Hrs for complete backup(previously it was take only 30 mins). Pleas

  • Only had to restart about 10 times today - making progress (not)

    Hi Creator Team, I have been using JSC2 for 8 hours today, as I getting close to UAT and doing a lot of work in it. My patience is wearing very, very, very thin with this tool. How may times should a developer with a decent PC have to restart both ID

  • Social media icons not showing in safari

    Hi NEED SOME HELP - HEADACHE - On a simple html site/page only the manually added icons show, none of the java icons display - facebook and twitter just dont appear http://digitalcinemafilms.co.uk/ Is there a special workaround code you have to add j