Java Reference
In-Depth Information
L ISTING 7.1 Continued
System.out.println(“from=”+inputFile+” to=”+outputFile);
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outputFile);
int c;
while ((c = in.read()) != -1)
out.write;
in.close();
out.close();
7
}
catch (Exception ex) {
System.out.println(“during file copy: “+ex);
}
}
/**
* installs the proper JRE depending the current OS
*/
private void installJre(){
System.out.println(“installJre()”+System.getProperty(“os.name”));
final String WIN_PATH = “jre\\win\\”;
if (System.getProperty(“os.name”).indexOf(“Win”)!=-1) {
File f = new File(currentDir + WIN_PATH);
String jres[] = f.list();
System.out.println(“Installing WIN JRE:” + jres[0]);
try {
Runtime.getRuntime().exec(currentDir + WIN_PATH + jres[0]);
} catch (Exception ex) {
System.out.println(“Installing JRE: “+ex);
}
alreadyInstalledFiles ++;
}
}
/**
* performs some special-purpose code
*/
private void installCustom(){
// add your code here, if needed
// ...
alreadyInstalledFiles ++;
}
Search WWH ::




Custom Search