Create File Path Java

Create File Path Java

Create file path is very important whenever you want to make it compatible and work on different operating systems. For example if you have written a batch job which creates file on network on different machine and those are Unix box and your development environment is window. If you use file separator like (“\”) to create file path which will work on window perfectly but won’t work on Unix environment because they use different file separator to separate the path as below:

Window: “\”
Unix: “/”

To make your file path compatible with different environment you could use below example to create file path:

Sample java class:

Output:

Create File Path Java

For more information about path please visit oracle site hereĀ 

Leave a Reply

Your email address will not be published. Required fields are marked *