• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Environment Variable!!

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

hth
maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
That feels good. Thanks. Here's a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic