Full width home advertisement

Travel the world

Climb the mountains

Post Page Advertisement [Top]

I have a problem my app with separator of Linux(/) and Windows(\), so I'm need known where OS is it executed, to do it I'm use Java System Properties (System.getProperty("os.name")) and below is that example way it working.
Source Code:
/*  * To change this license header, choose License Headers in Project Properties.  * To change this template file, choose Tools | Templates  * and open the template in the editor.  */ package zexample; /**  *  * @author bnson  */ public class Java_System_Properties {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         System.out.print("This java application is executed at: ");         System.out.println(System.getProperty("os.name"));     }   }
Output:
run: This java application is executed at: Linux BUILD SUCCESSFUL (total time: 2 seconds)

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib