This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java program for linux

 
Joseph Bashir
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic