public boolean compile(String sol) throws ServerException { try { createSrcFile(); File f = new File(workDir, srcFileName); FileWriter fw = new FileWriter(f); fw.write(sol); fw.close(); exec(compileCmd, "", 2, 2048); File ef = new File(workDir, executableName); return ef.exists(); } catch (Exception e) { throw UtilSrv.se("Can't compile.", e); } }
private void save(String data, File f) throws IOException { FileWriter fw = new FileWriter(f); fw.write(data); fw.close(); }