User Comments for the tutorial:

Getting the Current Working Directory in Java



how about in linux?
It works fine on Windows systems, but how do you get the working directory in Linux? 

cdrom select at run time using java
dear sir how to select cdrom at program run time using java. 

Hai all, I was searching for the creation using java,these code are very much helpful,But my serching is not yet complted here.I have a problem:=i had to create an file in windows using java programm like d://salish//examples//sto 

Select case system operate
The method: System.getProperty("user.dir"); Just correctly work in Windows Systems, in Unix type system get the user folder, for example, no matter the ubication, always get: /home/<userFolder>. 

very cool tutor but in J2EE system return the directory of web Server (e.g. return Apache directory) how to get class in web application?  

It may not correctly work
In case the OS is unix then user.dir shall return the current user's path and the application's one. Hence better is to use: (new File(".")).getCanonicalPath()  

Related Tutorial and Articles