public scoregraph() { initComponents(); System.out.println("OS:" + System.getProperty("os.name")); data.startUp(); } public class data extends scoregraph { static String mainPath = ""; static String path = ""; static String[] prop = new String[2]; static void startUp() { data objData = new data(); objData.loadMainPatch(); objData.loadProp(); objData.loadPatch(); } void loadMainPatch() { switch (System.getProperty("os.name")) { case "Windows 7": mainPath = "C:\\Users\\" + System.getProperty("user.name") + "\\AppData\\Roaming\\.ScoreGraph\\"; break; case "Linux": mainPath = "/home/" + System.getProperty("user.name") + "/.ScoreGraph/"; break; } System.out.println("mainPatch: " + mainPath); } void loadProp() { try { BufferedReader propBuffer = new BufferedReader(new FileReader(mainPath + "properties.txt")); for (int i = 0; i < prop.length; i++) { prop[i] = propBuffer.readLine(); } System.out.println("Properties: Properies loaded"); } catch (Exception e) { createProp(); } } void createProp() { try { BufferedReader tPropBuffer = new BufferedReader(new FileReader(getClass().getResource("/Templates/propertiesTemp.txt").getPath())); System.out.println(getClass().getResource("/Templates/propertiesTemp.txt").getPath()); for (int i = 0; i < prop.length; i++) { prop[i] = tPropBuffer.readLine(); } PrintWriter pWriter = new PrintWriter(new FileWriter(mainPath + "properties.txt")); for (int i = 0; i < prop.length; i++) { pWriter.println(prop[i]); } pWriter.flush(); System.out.println("Properties: Properties created"); } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(null, "Failed to load and create Properties!\nConsult the Devoloper! ", "Properties", JOptionPane.CANCEL_OPTION); System.exit(0); } } void loadPatch() { } }