The Artima Developer Community
Sponsored Link

Java Buzz Forum
Using System properties

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ben Hosking

Posts: 208
Nickname: hoskinator
Registered: Apr, 2006

Ben Hosking is Java Developer with about 5 years experience and interest in OO
Using System properties Posted: Feb 14, 2007 2:32 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Ben Hosking.
Original Post: Using System properties
Feed Title: A Funny Java Flavoured Look at the World
Feed URL: http://jroller.com/hoskinator/feed/entries/rss
Feed Description: The blog looks at using Java and programming in general as it pops up in life as a Java programmer. It will have links to interesting Java articles and resources. It will also have a lot of SCJP Java 1.5 information and links as I am currently studying
Latest Java Buzz Posts
Latest Java Buzz Posts by Ben Hosking
Latest Posts From A Funny Java Flavoured Look at the World

Advertisement

using system properties





I was doing some coding that was creating files and changing directories inside a file. I did the work initially on a windows machine, tested on a windows machine and I don't think there was any talk of a Linux machine. So of course onto the Linux machine we go, my code popped up the white flag and promptly fell flat on its backside.


I had of course heard about the nastiness of backward and forward slashes and have been drawn into the Linux world recently but thanks to the beauty of Java and it's platform independency. I recently read somewhere (and blogged about it) that Java isn't platform independent it is a platform, which I suppose is a fair point but to which doesn't really seem to be a bad thing to me (apart from a touch of bloatyness). Anyway back to the subject.


http://scv.bu.edu/Doc/Java/tutorial/java/system/properties.html

There are a number of useful values in the System object and probably the most popular is the System.out.println that a lot people use for debugging their code.

Another useful item is the

"file.separator"

this will return the file separator used, so in my code I used this instead of using a backslash or forward slash, I used the

System.getProperty("file.separator")

this will return the different file separator used for the different operating systems. I'm sure a lot of people already know about the system properties but this was just one way I found to solve problems I had when saving and reading files on different operating system.


Tired of your job? Need to hire developers? Visit DZone Jobs: great people, great opportunities.

Read: Using System properties

Topic: Book Review: Head First Object-Oriented Analysis and Design Previous Topic   Next Topic Topic: Quest fro a WIPI 2.0.2 SDK

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use