Find the answer to your Linux question:
Results 1 to 4 of 4
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 e.g ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2011
    Posts
    19

    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
    e.g

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

  2. #2
    Just Joined!
    Join Date
    Jun 2011
    Posts
    5
    If your Asthma_Data folder is present inside opt then
    FileWriter airFile = new FileWriter("/opt/Asthma_Data/zip.xml");

  3. #3
    Just Joined!
    Join Date
    Jun 2011
    Posts
    19
    what about root????
    shouldnt it be
    FileWriter airFile = new FileWriter("/opt/Asthma_Data/zip.xml");

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,345
    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
  •