Read file when runing application only having filename and without path

Hi everyone, I am writing a simple program call ReadAP to read a text file. the text file are putting in a same directory with the Class of ReadAP when running
To execute this program, in the DOS mode should input the following command which contain the filename :
java ReadAP text.txt
text.txt is the text file I want to read from this application
The most important things is that, the filename enter in the command line when execute ReadAP should not be include the path (e.g C:\text.txt)
The specification is that the user should not enter the pathname and filename when exceute such as
java ReadAP C:\text.txt ------> is not allow
It only should enter the filename when excute, and that text file should be exist in the same directory of the class of ReadAP when runningof this project such as java ReadAP text.txt ------> is allow
It is due to RandomAccessFilem, File, InputStream when create file it should mention the path and the filename,
if I only having the filename, I cannot read the file.
So Is there having any method to get the path of the application runing?
If no, Is it having any another method for doing the above?
Can everyone be help me? Thank you very much attentation

Look into System.getProperty("user.dir"). It provides the current working directory.
#

Similar Messages

  • How do I compress a file on a Mac.  I do not see and option to compress a file when I right click on it and the Apple help does not provide and accurate answer

    How do I compress a file on a Mac.  I do not see and option to compress a file when I right click on it and the Apple help does not provide and accurate answer

    Select the file with one click, then go to File in the menu bar and select Compress...
    By the way Niel's post says control - click. This means click with the control key held down. It produces the same result as going to File in the menu bar and selecting Compress...

  • HT2476 I have just downloaded Mountain Lion for my MacBook Pro and now when my applications open they close and the error "This has just quit unexpectedly" message pops up. Does anybody know what is happening?

    I have just downloaded Mountain Lion for my MacBook Pro and now when my applications open they close and the error "This has just quit unexpectedly" message pops up. Does anybody know what is happening/how to fix it?

    Welcome to Apple Communities
    Press Command and R keys in boot and reinstall

  • .dmg files forced into .xls files when downloading applications

    Why are dmg files being forced into xls files when I'm attempting to download applications from websites?
    MacBook1,1   Mac OS X (10.4.8)  

    Hi mospirit,
    first of all: WELCOME TO THE DISCUSSIONS!
    Sometimes files lose connection to their application. This can be solved quite easily though:
    1. Download Cocktail, OnyX or Tiger Cache Cleaner and reset the "Launch Services Database".
    2. Click any .dmg and type Apple-i to get the Information window. In the pop-up called "Open With" select "Other" and navigate to /System/Library/CoreServices. There select DiskImageMounter as default application. Finally back in the Information window click "Change All".
    If this answered your question please consider granting some stars: Why reward points?

  • Problem with Reader file when we try to save a pdf version of filled in file.

    We currently create fillable forms in Acrobat XI and enable them for fill-in with Acrobat Reader.  Our end users are able to key information and save it to the enabled pdf file with Reader, but they want to create a protected version of the form so nothing can be modified once they have approved it.  They have been creating "locked" pdf versions of the completed form using CutePdf software.  The PDF files they are creating open fine with Acrobat Pro XI or our free FoxIT reader, but when we try to open the files they created with CutePDF with Acrobat Reader, they are quite distorted.  According to users, this worked with older versions of Acrobat Reader.  Please let us know if you have any suggestions (other than switching from Acrobat Reader to the free FoxIT reader.
    Thanks for the help!!
    Ken K. - 2191

    Can't endorse FoxIt or CutePDF, since I don't use either of them, and Adobe doesn't like us endorsing thrid party products in their forums anyway. On top of that I know several people who had really bad adware experiences with FoxIt, so I'd say stay away from it.
    Most likely neither of these software developers has updated THIER software to work with Acrobat/Reader XI and the problem lies with them, since PDF is an Adobe format and they must follow the lead from here, not vice-versa.

  • Deleting files when installing application using package maker

    Hello,
    I have made package maker for my application. It is made such that it will be installed in Application directory.
    I want to delete directory at ~/Library/Application Support/TestApp.
    This is necessary for me, because when user install my application i need to remove all the files that my application has created.
    So, how can i use package maker to remove this files and folders if there exist?
    Thanks
    xmax

    Hi xmax
    I'm not sure I understand your meaning.
    When you drag a file (that you're going to install) into the left hand side of package maker, more options open up, including the ability to add pre and post flight scripts.
    To change what your user will see during the installation process, run Package Maker and click on Edit Interface.
    Bob

  • How to get only the filename and extension for a text item?

    Suppose there is a non-database text item called :myfilename
    :myfilename := 'C:\SomeFolder\SomePath\myfile.doc';
    I would like to get the file name only without the full path,
    i.e. myfile.doc
    and the file extension, i.e. 'doc', 'bat', 'java', 'xhtml' etc., i.e. the last few chars from the right to the period.
    Any help is welcome.

    Thanks for the hints.
    I defined the non-database Text Item called FULLFILENAME and another two text items called FILE_NAME, FILE_EXTENSION. The following can extract the file extension,
    select substr(:FULLFILENAME,instr(:FULLFILENAME,'.')+1) into :FILE_EXTENSION from dual;
    e.g.
    :FULLFILENAME := 'C:\MyFolder\AnotherFolder\file.doc';
    FILE_EXTENSION becomes 'doc'
    but I would also like to extract only the filename without path into FILE_NAME,
    i.e. file.doc
    Please give more hints. Thanks.

  • I need to open and use a DFX file in Illustrator CS6 only displaying digits and letters

    I need to open and use a DFX file in Illustrator CS6 but it is only displaying digits and letters as opposed to fashion patterns. I believe the original file was  created in Gerber

    Thank you.
    I will see if I can access/download a CS2 version. Thats a kind offer, I will see how I go with the download first, as I will be needing to open several files over the next few weeks.
    Maxine

  • Logical filename and logical path in lsmw

    Hi all,
           I am doing a lsmw for purchasing info record . i created a logicalpath and assigned a physical path to that . i created a logical filename and assigned the logical path .but when i assign that to the lsmw it is throwing error as 'LOGICAL PATH DOES NOT POINT TO PHYSICAL DIRECTORY' .
    can anybody provide a solution for that .
    Thanks & regards
      Magesh anandan

    hi ,
      goto the tcode file then u find the relation between the logical and physical paths ...and their assignment..
    hope it will helps u..
    regards,
    venkat.

  • [b]HOW TO:[/b]  Copy and Paste THE Filename AND its PATH from Finder

    HOW TO DO THIS: Copy and Paste THE selected Filename AND its entire PATH from Finder to another application as in document footer reference, or document database which has a path field to aid in locating the file later.
    Finder, Spotlight and File Info (can be used to display Path) or using Command F, command I, etc. but user is not allowed to copy the path to clipboard.
    This is rudimentary, yet the word Path, is unknown to Mac Help.
    Message was edited by: jbov

    AJ,
    Isn't it amazing....There is no Command Key for this action? Apple Care was confounded too. And thanx, it'll be a help....
    Jim
    its tedious, but this should work:
    open a terminal window.
    Drag and drop the icon for the file in the terminal
    window.
    This will put the full path including the filename on
    the command line.
    Copy the path from the command line, and paste
    (wherever).
    Close the terminal window.

  • Get filename and full path from Forms on local directory in MS Windows

    I am writing a Form, when clicking a Push Button, I can click on sub-directory and select a filename, and the filename and the full path are then passed to a Text Item.
    Does any one know how this could be done?

    which version of forms?
    webforms you can use the webutils bean thing.
    client server forms there is/was the hierarchical tree object

  • Tables used when creating a sales return with and without refrence

    Hiya gurus,
                    I am developing a report to display sales order and sales return created from one partiular storage location and for one particular division. I need to get the tables used when creating the sales order and the sales return's.
                   For sale order I would be using VBAK and VBAP but for sale return with refrence and without refrence i am not sure which tables to look for.
                 kindly please let me know which tables i go for to get the sale return data.
                Thanking you very much, your efforts are deply appreciated
    Cheers,
    ZIa

    Hi,
    U can see VBFA tablefor CompleteDocu flow with differentconditions.
    Regards,

  • How to access unread mails of all users in Exchange server without having Passwords and without giving mailbox access to other user.

    Hi all,
       I am using Exchange server 2013, my task is to create
    Service , that
    need's to  monitor continuously for new mails of all Mailboxes in
    my server. if any user got new mail i need to get that Mail Subject, Mail Body, Sender Email Address [From emailId] .  
    Limitation
    : I don't have Passwords of mailboxes , so i gave all mailbox access permission  to one user , then i completed this   service using below code.
     But now, Client
    not willing to give Mailbox Permissions to one user because of security problems.
    How can i do this without passwords and without giving permissions to other user ?
    i don't want all mailbox access , i just need only
    access Mail Subject , Body and Sender mail address .
    How can i achieve
    this ?
    Process i follow
    => I created new user in server , and then i gave full permissions of all Mailboxes to newly created user[ex: james] in database level.
         i use below command for giving permissions in database level.
    Get-MailboxDatabase -Identity <Database Name> | Add-ADPermission -User <User> -AccessRights GenericAll
     => using below code i am searching unread mails of all user Mailboxes and then getting Subject, body and Sender Email            address . here i am have list of users,
    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
    service.Credentials = new WebCredentials("[email protected]", "password");
    service.AutodiscoverUrl("[email protected]");  foreach (Object obj in usersList) // here i have Mailbox users list in usersList
                 { var userMailbox = new Mailbox(obj.user);
    var folderId = new FolderId(WellKnownFolderName.Inbox, userMailbox);
    SearchFilter.IsEqualTo filter1 = new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false);
    var itemView = new ItemView(50);
    var userItems = service.FindItems(folderId, filter1, itemView);
    foreach (var item in userItems)
    item.Load();
    var senderEmail = ((EmailMessage)item).From;
    var subject = item.Subject;
    var body = item.Body;

    You would need to check that possibilities via WebServices but suggest you to post this in Development forum to get help from programmers....
    http://social.technet.microsoft.com/Forums/office/en-US/home?forum=exchangesvrdevelopment
    Blog |
    Get Your Exchange Powershell Tip of the Day from here

  • Accessing files from jar file when running application?

    I have an application that when run should read an xml file (test.xml) from a jar file located in a resource folder. I do this:
        File f = null;
        URL url = this.getClass().getClassLoader().getResource("test.xml");
        try {
          f = new File(url.getPath());
    //      f = new File(url.toURI());
        } catch (Exception e) {
          throw new GeneratorException("Preload input not found!");
        }The file is found in the jar but when I want to use it I get problems:
    when doing:
    f = new File(url.getPath());
    this file is not found and when doing:
    f = new File(url.toURI());
    I get and:
    URI is not hierarchical exception
    Is there now way to convert the xml file in the jar file to a File object?

    fedevaps wrote:
    But is there now otherway to create a File from the URL?Only if the URL refers to a file in the first place. Which it doesn't when the URL refers to an entry in a ZIP file because an entry in a ZIP file is not a file.
    java.io.File refers to physical files in the sense that the operating system uses it. It can't refer to Files on remote machines, it can't refer to "files" stored in .ZIP files and it can't refer to some random String that you construct.
    Usually when you think you need a File object in Java, you don't actually need it. There are only a handful of operations that you can do with a File object that can't be done with a URL as well (deleting, renaming are two that come to my mind). Reading from it and writing to it works with a File as well as with an URL.

  • Pages gives an error, 'Cannot read file' , when trying to open pages document

    I recently deleted a pages file. I recovered it using disk drill and now Pages refuses to open it. It gives me an error that it cant read the file. The file size is exactly the same as i had created earlier. Please help me out on this. This is a very important essay and i spent weeks tyiping it. The file size is about 10.6 mb with all graphics and images. Please help me out

    Hi
    Thank you for using
    Microsoft Office for IT Professionals Forums.
    From your description, we can Create a trusted location follow these steps
    Click the Microsoft Office Button , and then click Excel Options.
    Click Trust Center, click Trust Center Settings, and then click
    Trusted Locations.
    If you want to create a trusted location that is not local to your computer, select the Allow trusted locations on my network (not recommended) check
    box.
    Click Add new location.
     IMPORTANT   We recommended that you don't make your entire
    Documents or My Documents folder a trusted location. Doing so creates a larger target for a hacker to potentially exploit and increases your security risk. Create a subfolder within Documents or My Documents, and make only that folder a trusted location.
    In the Path box, type the name of the folder that you want to use as a trusted location, or click Browse to
    locate the folder.
    If you want to include subfolders as trusted locations, select the
    Subfolders of this location are also trusted check box.
    In the Description box, type what you want to describe the purpose of the trusted location.
    Click OK.
    More detailed information you can refer to this link:
    http://office.microsoft.com/en-us/word-help/create-remove-or-change-a-trusted-location-for-your-files-HA010031999.aspx?CTT=1#BM12
    Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything
    I can do for you, please feel free to let me know.
    Hope that helps.
    Sincerely
    William Zhou CHN
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Maybe you are looking for

  • Created IDVD Watch on a Blue Ray

    I created an IDVD as I always have. It is still pictures only. A Main Page with 5 slide shows to choose from. I can watch it on my computer after it is burned. I can watch it on my insigna dvd player. However, when I put it in my new BlueRay player w

  • How to use RHINTE00/10/20/30?

    Dear all, I have used BDC to hire an employee.  However, once it done, I found that employee has not been appeared in OM.  Checked some of the messages, RHINTE reports are suggested.  However, I have no idea on how to use them.  May anyone give some

  • How to see all the spools created by one job

    hi, i'm schedulling one job for a program and that program in deed summiting another program with in a loop. if loop contains 5 entries it submits 5 times and creates 5 spool. the total number of spool created 5+1 = 6 which is right. but when i see i

  • IOS 8 Photo Time Delay - Photo Burst

    I have uncovered a potential bug with the iOS 8 installation on my iPhone 5S.    When I use the Camera and select either the 3 second or 10 second time delay option, and then take a picture, it takes a 10-shot photo burst every time similar to if you

  • TRANSMIT uploaded pdf corrupt after upload (and download)

    i have created a pdf which i uploaded to my website using TRANSMIT and when i download normally, i get the attached error. this is a file that I created and i think the corruption is due to an upload issue with transmit that they were kind enough to