Find the answer to your Linux question:
Results 1 to 4 of 4

Thread: Write to a file

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Write to a file

    I want to write a file in linux

    for windows I use
    FileWriter airFile = new FileWriter("c:\\Asthma_Data\\zip.xml");

    what path would I use for linux?
    should I start from root

    FileWriter airFile = new FileWriter("root\\Asthma_Data\\zip.xml");

  2. #2
    If your Asthma_Data folder is present inside opt then
    FileWriter airFile = new FileWriter("/opt/Asthma_Data/zip.xml");

  3. #3
    what about root????
    shouldnt it be
    FileWriter airFile = new FileWriter("/opt/Asthma_Data/zip.xml");

  4. $spacer_open
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    It is good practice to avoid using the root user, if possible.

    In general:
    If that Asthma_Data/zip.xml is your personal data, it belongs in your home directory.
    If data needs to be shared locally or remote, then I tend to create datadirectories like /data1, /data2, etc and bindmount directories in them to /data
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts