001package edu.pdx.cs410J.security;
002
003import java.io.*;
004
005/**
006 * This program writes a file in the user's home directory.  It is
007 * used how we can grant code certain privileges based on when it came
008 * from. 
009 */
010public class WriteToHomeDir {
011
012  public static void main(String[] args) {
013    String homeDir = System.getProperty("user.home");
014    String fileName = "Hello";
015    File file = new File(homeDir, fileName);
016    try {
017      PrintWriter pw = new PrintWriter(new FileWriter(file), true);
018      pw.println("Hello There!");
019      pw.close();
020
021    } catch (IOException ex) {
022      ex.printStackTrace(System.err);
023      System.exit(1);
024    }
025  }
026}