Re: help with properties class
- From: "Andrew Thompson" <andrewthommo@xxxxxxxxx>
- Date: 28 Feb 2007 01:15:50 -0800
On Feb 28, 8:01 pm, "Andrew Thompson" <andrewtho...@xxxxxxxxx> wrote:
On Feb 28, 6:17 pm, divyatiwari...@xxxxxxxxx wrote:...
...p.setProperties("path,C:\Program Files\Java\jdk1.6.0\bin");
Note that when it comes to paths, using
hard coded file separator characters
(the '\') causes cross-platform problems.
A better way to express that might be..
<sscce>
import java.io.File;
class JavaHome {
public static void main(String[] args) {
String sJavaHome = System.getProperty("java.home");
File fJavaHome = new File(sJavaHome);
// use the x-plat way to get a file separator.
File fJavaBin = new File( fJavaHome, "bin" );
// the 'toString()' is not strictly needed
System.out.println( fJavaBin.toString() +
" \texists: " + fJavaBin.exists() );
}
}
</sscce>
HTH
Andrew T.
.
- Follow-Ups:
- Re: help with properties class
- From: divyatiwari123
- Re: help with properties class
- References:
- help with properties class
- From: divyatiwari123
- Re: help with properties class
- From: Andrew Thompson
- help with properties class
- Prev by Date: Re: help with properties class
- Next by Date: unstable jasperExcption with custom taglibs?
- Previous by thread: Re: help with properties class
- Next by thread: Re: help with properties class
- Index(es):