This program is to get the server details using System.getProperty() , and then make a folder in Linux OS. I am making a folder inside the /tmp folder.
public class ReadWriteFile {
public static void main(String[] args) throws IOException {
String osName = System.getProperty("os.name");
Map sysP = System.getProperties();
String tm = System.getProperty("java.io. tmpdir");
File file = new File(tm+"/abc");
File ff= new File(file+"/abdc.txt");
if(osName.startsWith("Linux")) {
System.out.println("Linux sysy");
}
if(!file.exists()){
file.mkdirs();
}else{
ff.createNewFile();
}
System.out.println(osName+" "+file.getPath());
System.out.println(tm);
System.out.println(sysP);
}