hi folks, i found this about System Properties and Environment Variable. System properites is a feature that replaces the concept of
environment variables which is platform-specific
. could you please explain me why environment is a platform specific? thanks.
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi sathi here r things which will be platform (that is OS) specific, 1. file path separator - '\' on windows - '/' on unix based system - ':' on Mac OS 2. PATH separator - ';' on windows (see ur autoexec.bat if to see how u specify multiple values for a variable). e.g. SET CLASSPATH=c:\java\lib\tools.jar;c:\java\lib\dt.jar - ':' on unix based systems e.g. CLASSPATH=/usr/java/lib/tools.jar:/usr/java/lib/dt.jar - i am not sure about Mac OS...u can always google.. 3. line separator - \r\n on windows - \n on unix - i'm not sure about Mac OS
okay.. i forgot to mention how System Properties replaces these environment specific values.. 1. file path separator System.getProperty("file.separator") 2. PATH separator System.getProperty("path.separator"); 3. new line character System.getProperty("line.separator"); write the following code and run on different OS to see the results, class testSP { public static void main(String[] s) { System.out.println(System.getProperty("file.separator")); System.out.println(System.getProperty("path.separator")); System.out.println(System.getProperty("line.separator").length()); } } regards maulin
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.