java cek sistem operasi

File jar akan dijalankan pada sistem operasi window$ dan linux, tentunya akan mempunyai perbedaan dalam hal sistem path


q> LA to code

package com.saifiahmada.mysqllog;


/** @author Saifi Ahmada Sep 24, 2014 10:20:54 AM **/

public class MysqlLog {

private static String OS = System.getProperty("").toLowerCase();

public static void main (String [] args) {

String folderName = null;

if (OS.indexOf("win") >= 0) {
folderName = "D:\\MYSQL_LOG\\";
} else {
folderName = "/home/saifi/Program/MYSQL_LOG/";

File folder = new File(folderName);

File [] files = folder.listFiles();

for (File file : files) {
System.out.println("Nama File : " + file.getName());



q> Sourcecod in capturing



Published by


Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s