I am writing a program and it requires me to place a file on the desktop. I know in cmd prompt you can use %USERPROFILE% to do it.

Is there java equivalent?

Thanks PO

System.getProperty("user.home") will give you the users home directory.

Awesome thanks,

also would you be able to tell me how to determine what operating system they are using?

Thanks PO

Take a look at the list of properties that are always available through System.getProperties(). OS is one of them.

You can also dump a list of all of them to sysout easily with the following code