// shall I write some keywords here to boost search engine ranking?

Tuesday, March 13, 2007

Cross Platform File Path in Java

Recently come across some a Java program that have problem to work on Linux due the the program used "\" for directory.



It remind me of a dirty trick I used last time. Just used "/" in the code, it will work in both Windows and Linux.



Java as a cross platform language, already provide simple way to solve this with a static variable File.seperator . A much better alternative to my dirty trick.



1 comment:

surface said...

I personally prefer "dirty" way, the correct way ( preferred way ) is too much longer.