aspose file tools*
The moose likes Struts and the fly likes java program for linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "java program for linux" Watch "java program for linux" New topic
Author

java program for linux

Joseph Bashir
Ranch Hand

Joined: Jun 16, 2004
Posts: 41
Can someone please tell me how to write a file's path for linux in java. We write for windows as

File file = new File("D:\\testdir\\testfile.txt");

How can we write this path if we are on linux.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In UNIX there is no drive letter as there is in DOS. There is only "root", which is the lowest level of the file structure. Also, in UNIX, the path separator is a forward slash instead of a backslash. Your path, then, would look like this:

/testdir/testfile.txt


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java program for linux