src/main/java/de/vandermeer/execs/Gen_ExecJarScripts.java
public boolean writeFile(File file, List<String> lines){
		if(file.exists()){
			file.delete();
		}
		try {
			FileWriter out = new FileWriter(file);
			for(String s : lines){
				out.write(s);
				out.write(System.getProperty("line.separator"));
			}
			out.close();
			file.setExecutable(true);
		}
		catch (IOException ex) {
			System.err.println(this.getAppName() + ": IO exception while writing to file - " + file + " with message: " + ex.getMessage());
			return false;
		} 
		return true;
	}
public boolean writeFile(File file, List<String> lines){
		if(file.exists()){
			file.delete();
		}
		try {
			FileWriter out = new FileWriter(file);
			for(String s : lines){
				out.write(s);
				out.write(System.getProperty("line.separator"));
			}
			out.close();
			file.setExecutable(true);
		}
		catch (IOException ex) {
			System.err.println(this.getAppName() + ": IO exception while writing to file - " + file + " with message: " + ex.getMessage());
			return false;
		} 
		return true;
	}
public boolean writeFile ( File file , List < String > lines ) { if ( file . exists ( ) ) { file . delete ( ) ; } try { FileWriter out = new FileWriter ( file ) ; for ( String s : lines ) { out . write ( s ) ; out . write ( System . getProperty ( "line.separator" ) ) ; } out . close ( ) ; file . setExecutable ( true ) ; } catch ( IOException ex ) { System . err . println ( this . getAppName ( ) + ": IO exception while writing to file - " + file + " with message: " + ex . getMessage ( ) ) ; return false ; } return true ; }
Writes the given lines to the given file, if possible.
@param file file to write to
@param lines lines to write to the file
@return true if lines where written to the file, false otherwise with errors printed
Writes the given lines to the given file if possible .