This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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