File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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.

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:


Consultant, Sima Solutions
I agree. Here's the link:
subject: java program for linux
It's not a secret anymore!