Reading from home directory in linux using ~/ or $HOME and BufferedReader

I'm working on an app that reads in a number from a user's home directory using BufferedReader. The file is written by an external script to ~/filename. I don't know if the user of the app's home directory will be /homes/username, /home/username, or something else. I would prefer to read in a similar fashion:
BufferedReader in = new BufferedReader( new FileReader("~" + File.separator + ".AppDisableUntilDate") );
Unfortunately, this causes the following error:
java.io.FileNotFoundException: ~/.AppDisableUntilDate (No such file or directory)
less ~/.AppDisableUntilDate does read the file. Using $HOME in place of ~/ also fails. Any ideas what might work?
Thanks,
Joel

~ is understood only by the shell. And not by every shell either.
Korn and Bourne-again shell (ksh and bash) understand it, I would conjecture, Bourne shell (good old sh) does not.

Similar Messages

  • Utl_file can't read from my directory

    hello
    I am trying to load XML data from an xml file into a CLOB object and i am getting an error in the unlikely segment of the code. The following code can't read from the directory specified by the utl_file_dir parameter.
    I am setting the "utl_file_dir" parameter at the sys level and dont have it in the SPFILE (initialization) file.
    sys@LOCAL> ALTER SYSTEM SET UTL_FILE_DIR='C:\XMLBOOK\Examples\Chapter25\src\xml' SCOPE=SPFILE;
    System altered.
    sys@LOCAL> shutdown
    sys@LOCAL> startup
    sys@LOCAL> select name,value from v$parameter where name like '%utl_file_dir%';
    NAME VALUE
    utl_file_dir C:\XMLBOOK\Examples\Chapter25\src\xml
    sys@LOCAL> DECLARE
    2 v_xmldoc DBMS_XMLDOM.DOMDocument;
    3 v_parser DBMS_XMLPARSER.parser;
    4 v_out CLOB;
    5 v_dir VARCHAR2(200) :=
    6 'C:\XMLBOOK\Examples\Chapter25\src\xml';
    7 BEGIN
    8 -- New parser
    9 v_parser := DBMS_XMLPARSER.newParser;
    10 -- Setting up the parsing parameters
    11 DBMS_XMLPARSER.setValidationMode(v_parser, FALSE);
    12 DBMS_XMLPARSER.setPreserveWhiteSpace(v_parser, TRUE);
    13 -- The v_dir has to be a valid directory in the UTL_FILE_DIR
    14 DBMS_XMLPARSER.setBaseDir(v_parser, v_dir);
    15 -- Parsing the XML file
    16 DBMS_XMLPARSER.parse(v_parser, 'contact.xml');
    17 -- Getting the XML DOMDocument
    18 v_xmldoc := DBMS_XMLPARSER.getDocument(v_parser);
    19 -- Print out the result
    20 DBMS_LOB.createtemporary(v_out,FALSE,DBMS_LOB.SESSION);
    21 DBMS_XMLDOM.writetoClob(v_xmldoc, v_out);
    22 DBMS_XMLDOM.writetoFile(v_xmldoc,v_dir||'/out.xml');
    23 :out := v_out;
    24 DBMS_LOB.freetemporary(v_out);
    25 END;
    26 /
    DECLARE
    ERROR at line 1:
    ORA-29280: invalid directory path
    ORA-06512: at "SYS.UTL_FILE", line 18
    ORA-06512: at "SYS.UTL_FILE", line 424
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 15
    ORA-06512: at "XDB.DBMS_XMLPARSER", line 90
    ORA-06512: at line 16
    sys@LOCAL>
    It would be great if i get some help here.
    Thanks.

    try this:
    create directory test_d as 'F:\OracleXML';
    DECLARE
    v_xmldoc DBMS_XMLDOM.DOMDocument;
    v_parser DBMS_XMLPARSER.parser;
    v_out CLOB;
    -- v_dir VARCHAR2(200) := 'F:\ORACLEXML'; don use this
    BEGIN
    v_parser := DBMS_XMLPARSER.newParser;
    DBMS_XMLPARSER.setValidationMode(v_parser, FALSE);
    DBMS_XMLPARSER.setPreserveWhiteSpace(v_parser, TRUE);
    DBMS_XMLPARSER.setBaseDir(v_parser, 'TEST_D');
    DBMS_XMLPARSER.parse(v_parser, 'newtab.xml');
    v_xmldoc := DBMS_XMLPARSER.getDocument(v_parser);
    DBMS_LOB.createtemporary(v_out,FALSE,DBMS_LOB.SESSION);
    DBMS_XMLDOM.writetoClob(v_xmldoc, v_out);
    DBMS_XMLDOM.writetoFile(v_xmldoc,'TEST_D'||'/out.xml');
    -- :out := v_out;
    DBMS_LOB.freetemporary(v_out);
    END;

  • How can I do mirroring of a screen from new iPad to hdtv using apple tv and still work on something else in my ipad

    How can I do mirroring of a screen from new iPad to hdtv using apple tv and still work on something else in my ipad

    You don't. Mirroring is duplicating your ipad screen on another projector - so you can't have another app going on your iPad without it also showing up on the projected image. Some apps are designed so that you see a different image in the iPad than the mirrored out display, but even then you're within the app itself.

  • I am considering purchasing the Mac mini for home studio audio production using Adobe Audition and a USB microphone.  Will the base mini model run these programs?

    I am considering purchasing the Mac mini for home studio audio production using Adobe Audition and a USB microphone.  Will the base mini model run these programs?

    The base mini has 4GB and a 5400 RPM hard drive. It is slow to start up and slow to launch large application such as Word (and I'd assume Adobe Audition) due to the slow drive. I've not used a new 4GB model, just the 8GB model, and the 8GB model (except for the slow drive) handles everything I've thrown at it, including running Photoshop, Word, Safari, and Mail at the same time but there is sometimes a delay switching between programs as the swapfile is updated. Overall I was not happy with the 5400 RPM drive (perhaps because I have MBA and iMac with Fusion drive) so I eventually upgraded it with an SSD. Now the mini is truly a warrior.

  • I am trying to finish the installation of Reader from Adobe Creative Suite 5.5 Design Premium and it will not let me proceed because it says "Please close the following applications to continue. Google Chrome.exe" ,  I don't have any Chrome applications o

    I am trying to finish the installation of Reader from Adobe Creative Suite 5.5 Design Premium and it will not let me proceed because it says "Please close the following applications to continue. Google Chrome.exe" ,  I don't have any Chrome applications open and I have even gone to Add/Remove Programs and removed Chrome from my PC. Still get error. Any advice?

    ctrl-alt-del > start task manager > processes

  • Do you know if it's possible to generate Word 2003 files from RoboHelp if we're using Office 2007 and RoboHelp 2007?

    Do you know if it's possible to generate Word 2003 files from
    RoboHelp if we're using Office 2007 and RoboHelp 2007? We are
    thinking of upgrading, but have customers that would still require
    Word 2003 formats because they won't have 2007 installed.
    Thanks!

    Hi NewtoRobohelp
    Unfortunately I don't have Office 2007 in front of me to test
    with. But I'm thinking that as long as Office 2007 still produces
    the same formats as 2003, you could do it this way.
    From RoboHelp 7 and using Office 2007, generate Printed
    ouptut. Open said printed output in Office 2007 and perform a Save
    As. Save the document as a RTF (Rich Text Format) document.
    RTF is more universal. So I'm thinking this may be a possible
    way around it. There is also the possibility that Word 2007 offers
    up an ability when saving a file to save in an older format.
    Cheers... Rick

  • Not receiving mail sent to and from my own accounts! using latest OS8 and X10.9.5.Using Apple Mail account. Used to be able to do this!

    Not receiving mail sent to and from my own accounts! using latest OS8 and X10.9.5.Using Apple Mail account. Used to be able to do this!

    My system is OS8 and X10.9.5

  • Run program from any directory on Linux

    Hi, I'm using a shell on a Sun computer to run a Java program.
    The program requires the user to specify the name of an output file and and then an input file, manipulates the text in the input file, and prints it to the output file.
    I would like to be able to run the program from any directory.
    An IOException occurs if the input file is not in the same directory as the directory where you run the program.
    If I have an input file which I want to manipulate in a different directory to where the actual program files are located (.java and .class), how do I specify that?
    Thanks

    When you execute a java program from a given directory, all relative file paths (i.e. foo.txt) are resolved using the current directory. You can most likely run the program from anywhere as long as you specify an absolute path to your files and have permissions to both read and write. I say most likely because you could be doing something incorrectly in your code.
    If you want to run a program from anywhere, it must be:
    1) on your PATH
    2) be able to find its classes
    An easy way to do that is write a small "wrapper" shell script and put that on your path.
    I guaruntee you that a wise combination of terms used in this reply to compse a search engine query will yield you a useful tutorial or example.

  • How can I write to port C and read from port A&B simultaneously using 6503 DIO-24

    I attempting to read from Port A and B which are grouped together and at the same time I want to write to Port C. The problem I having now is that every time I want to read from Port A and B, Port C seems to be effected. I have only used the easy dio's vi this may be the root of my prblem

    Hello,
    You will need to use the advanced digital VIs to accomplish what you are trying to do.
    The Easy DIO VI's are simply a combination of two DIO advanced VI, so you will use the same two advanced VI with a little different calling method. We want to call both PORT Config VI first to configure two ports for read and one port for write. Then we can simply read and write to the ports as desired, perhaps in a loop.
    The best place to start would be to look at the LabVIEW examples for Digital Input and Output operations. In LabVIEW, go to Search Examples then under I/O interfaces select DAQ (or Data Acquisition)-> Digital Input and Output->Immediate Digital Input and Output. From her you will want to look at the examples under the 8255 chip which is the chip on
    the DIO-24. I would recommend looking at Read from two digtial ports and the Write to one digital port VI's.
    From here you will simply need to combine the two together. One note: you will want to make sure that both port config VI are called before either Port Read or Port Write VIs.

  • Portable Home Directory WITH a Windows Server/AD and WITHOUT OSX Server/OD

    Hi All,
    I'm pushing the envelope here a bit, but here's the situation:
    - Windows 2003 AD Servers
    - Windows 2003 Home Directory File Server
    - MacOS X 10.5.2 client (on an Intel iMac)
    Everything works fine (once you add the AD server's IP/domain name into /etc/hosts and remove the dashes from the name of the client you're trying to join anyway). I can login, logout, run all the Apps I need. Get fine throughput from the server.
    The problem comes when I try to turn on Portable Home Directories (Mobile Accounts) for users of the client. I believe the client is trying to use "Server Side File Tracking for Mobile Home Sync", and so is trying to SSH into the Windows machine. This, perhaps unsurprisingly, is not working.
    Is there any way to turn this off without using Open Directory (even there it seems to be part of Server Admin General Prefs and not Managed Preferences)?

    Portable Homes work just fine with non-Apple servers. It just that you will not get the performance improvements of 10.5 server's "Server Side File Tracking for Mobile Home Sync".
    If Portable Homes are not working for you file a bug with Apple.

  • Is there a file in which OSX stores the home directory path, where to find it and how to edit it in Windows 7?

    Hi everyone,
    I have a SSD with the System and Apps on it, and another HDD containing the home directory.
    I made the mistake to rename the Volume the home directory is on whilst being logged in, the system reacted accordingly and prompted some Password requests,
    and I then tried to choose the newly named Volume in the Advanced options dialogue in Users & Groups (example seen below).
    I tried to change the name back to what it was in the hope of it all being back to normal again, but instead it's completely messed up now and I cannot login anymore (prompt: "You are unable to log in to the user account "xxxx" at this time. Logging in to the account failed because an error occurred")
    All I can do now is boot my Windows 7 and try to fix this from there, I can read/write the OSX Volumes thanks to MacDrive.
    So now the big question is:
    IS THERE A FILE containing the path to the home directory (red arrow)?
    IF SO, WHERE can I find it?
    And is there a way to edit it in Windows?
    My guess is that if I rename the Volume, AND change this path to something identical again, it might solve the issue.
    Thanks!

    Download THIS
     Cheers, Tom

  • FI/CO - Reading from COSP to COEP but cannot get PO and Matnr

    Hi guys, first question on this forum so forgive me if i post incorrectly.
    I have created a report that reads budgeted,planned,commitment and actual values for CO/FI (PS).
    This reads from prps to cosp and onto coep where the latter i need to retrieve the purchase  order number, the materials and finally the profit segment number for where i select from ce40max_acct to determine product hierarchy etc.
    The problem i am having is that when reading coep from cosp (and using an outer join as not all planned etc records will have an actual record) i cannot distinguish between different  Purchase orders (where they have the same material,cost centre,controlling area). This is resulting in my figures getting messed up.
    Hope this is somewhat clear but i will attach the code that i am using so that someone here may see what i am doing wrong.
      SELECT BPOSID BPOST1 AKSTAR BPKOKR BPBUKR EPAOBJNR
             EEBELN EMATNR
             AOBJNR AVRGNG ATWAER AVERSN
             AWOG001 AWOG002 AWOG003 AWOG004
             AWOG005 AWOG006 AWOG007 AWOG008
             AWOG009 AWOG010 AWOG011 AWOG012
             APPENDING CORRESPONDING FIELDS OF TABLE GT_OUTPUT
             FROM COSP AS A LEFT OUTER JOIN COEP AS E
             ON EOBJNR = AOBJNR
             AND EKSTAR = AKSTAR
             AND EVRGNG = AVRGNG
             AND EGJAHR = AGJAHR
             AND EWRTTP = AWRTTP
             AND ELEDNR = ALEDNR
             AND EHRKFT = AHRKFT
             AND EBEKNZ = ABEKNZ
             AND ETWAER = ATWAER
             INNER JOIN PRPS AS B
             ON  AOBJNR = BOBJNR
             WHERE B~PSPNR IN S_PSPNR
             AND   B~PBUKR EQ P_BUKRS
             AND   B~PKOKR EQ P_PKOKR
             AND   A~GJAHR EQ P_GJAHR
             AND   A~KSTAR IN S_KSTAR.
    Thanks for any ideas
    I guess what i am asking is........from a record in COSP how can i find the correspoding unique record in COEP !
    Message was edited by:
            ED MORRISSEY

    Hi,
    I have already developed the report which gives the project / WBS data like:
    - Planned values
    - Budget
    - Commitments
    - Actaual cost ( billed / Unbilled )
    These are the table i get these info from.
    1. Planned values - COSP with OBJNR / VERSN / GJAHR and COSP-VRGNG = 'RKP1'
    2. Budget         -  BPEG with OBJNR = wbs obj no / WRTTP = '41' / VORGA = 'KBUD'
    3. Commitment     -  COOI with LEDNR = '00' and  OBJNR = wbs object no.
    4. Actual cost    - COVP ( this is join of COEP and COBK) with LEDNR = '00' and OBJNR = wbs object number
    Let me know if you need any information.
    Regards,
    RS

  • My document.numbers can not be opened how can i recover the version from yesterday i was not using time machine and it was not in icloud. is there an app i can buy that might help

    my document.numbers can not be opened how can i recover the version from yesterday? i was not using time machine and it was not in icloud. is there an app i can buy that might help

    Thanks Andy,
    I wish I could have told my sister about this as she could not open my homepage back before my new iWeb site. She now can open my site without the yet in case denial window does appear = I thank you.
    I think my iWeb site works as Noone has said otherwise from any platform etc...
    Alex L
    I do agree that should not have to be a consideration for any users so i agree that it would be great if Apple could allow simplicity to run seemlessly.
    I have had this problem since Homepage, and here is
    what has worked for me. I send out the link, and
    then for PC users I send the link with "<" after the address (without quotation
    marks. e.g., <http://site.com>).
    I also put a note that if that doesn't work, to just
    copy and paste the link into a browser. With that I
    have only had 1 person say they still can't open.
    Everyone else gets it to work.
    It's a lot to do and seems like a hassle, but you get
    used to it.
    Hope this helps!
    Andy Martini
    PS - APPLE! When are you going to fix this??! It
    seems like such a small thing yet you guys have been
    stumped for YEARS on this!

  • Reader X doesn't run fully, uses 25% CPU and hangs

    Whenever I click on a pdf, the Reader starts but it's running fully. It draws the toolbars but not the body. The background is still whatever app is behind it. CPU is about 25% and the Reader is not responding. It hangs. Another pdf reader from another vendor works fine. I installed the latest version.
    Using Windows 7 64 bit with SP1.

    I have had issues with Adobe Reader X hanging (not responding) due to a conflict between an antivirus program and the Adobe Reader X Protected Mode/Protected Viewer sandbox features.
    Adobe has a recent(2012-01-09)KB article http://kb2.adobe.com/cps/860/cpsid_86063.html entitled "Protected Mode troubleshooting". There is a similar article (2011-09-12) http://kb2.adobe.com/cps/901/cpsid_90161.html entitled Protected View troubleshooting.
    khwajakhurram replied to my query suggesting unchecking the default Adobe Reader X Preferences >3D & Multimedia> "Enable hardware rendering for legacy video cards" setting and this solves the issues!
    What is surprising is that Adobe Reader X's 3D & Multimedia settings report that the alternative preferred renderer modes are either software or DirectX9 .....on a Vista machine with DirectX11.
    The video card on this machine is definitely not legacy but a recent quality Nvidia produced card. That is also the case on the other machines with the issue I have reported.
    I went a step further and I have found that performance is vastly improved by changing from the default preferred renderer mode of DirectX9 to the alternative Software setting. 
    http://kb2.adobe.com/cps/860/cpsid_86063.html mentions that "certain configurations of anti-virus software that have not yet white-listed AcroRd32.exe" are "Unsupported configurations for Reader running in Protected Mode". Therefore I have also excluded AcroRd32.exe from virus scanning.
    I am now able to use both Adobe Reader X's Protected Mode and Advanced Security without issue and performance is vastly improved. I am certain that your issues will also be improved.

  • Move all data from one database to other using oracle expdp and impdp tool

    I need to move all of the data from one database to another. For that I am using oracle expdp and impdp tool.
    I have the full database export dump file. I moved that dump file to my other database.
    Now when I try to use impdp tools it gives lots of error regarding path mismatch,user not exists, role not exists.
    As my datafile path of source database does not match with the target database path , also the users are not there in target database. I dont want to create all the tablespaces that in my source database as there are 82 tablespaces.Is there any way by which I can move my all data without using remap option for tablespaces or users and grants.

    The FULL parameter indicates that a complete database export is required. The following is an example of the full database export and import syntax.
    The user must have the privielge of EXP_FULL_DATABASE
    expdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log
    impdp system/password@db10g full=Y directory=TEST_DIR dumpfile=DB10G.dmp logfile=impdpDB10G.logGO through below linkfor more details...
    http://www.oracle-base.com/articles/10g/OracleDataPump10g.php
    Regards
    Umi
    Edited by: Umi on Feb 4, 2011 2:27 AM

Maybe you are looking for