forward slash vs backward slash

Hi ,

I have a hava class which runs fine on windows .It refers to file on windows as

SYSTEMVARIABLE\Y.TXT

this SYSTEMVARIABLE exist in windows and ulinux

so in windows i have somthing like

SYSTEMVARIABLE=c:\project

and

on linux

SYSTEMVARIABLE=\root\project

how do i make this class to run on both windows and unix

do i ahve to change \ to / and compile again

can a same class works on both os

[465 byte] By [Sulemana] at [2007-11-26 14:28:58]
# 1
File file = new File(directory, "y.txt");This constructor will provide the separator.
DrLaszloJamfa at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 2
> can a same class works on both osAs my instructor told me, one of the beauties of Java is that it's OS independent, since the compiling is linked to the JVM you're running..So the answer would be 'yes' to that..
Tribioa at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 3
Stop cross-posting http://forum.java.sun.com/thread.jspa?threadID=5122537 http://forum.java.sun.com/thread.jspa?threadID=5122536
aniseeda at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 4
i for one, think that the forward slash would total kick backward slash's *** in a fight.
mkoryaka at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 5

> i for one, think that the forward slash would total

> kick backward slash's *** in a fight.

Let's try shall we, since both are here already?

See them eye each other:

/\

Now they're testing their strength:

/ \

Oh, looks like an early end to that fight: Forward slash was actually a semi-colon in drag, causing backslash to faint:

; _

Mr_Evila at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 6
Good Day Friend!Please be serious friend!Dont make funny things in the forums
vasu_gba at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 7
Good day Friend!Both in windows and Linux platformwe have to use forward slashbecause backward slash is used for escape sequence like '\n','\u\with regardsvasu_gb@yahoo.co.in
vasu_gba at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 8
> Both in windows and Linux platform> we have to use forward slashNo, Windows does not recognize a forward slash in file paths. In Java, you can use forward slash even on Windows because the conversion to the actual path is a part of the internal implementation.
aniseeda at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 9
> Good Day Friend!> > Please be serious friend!> Dont make funny things in the forumsDon't write "Good Day Friend" at the beginning of each post. It's funny.
aniseeda at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...
# 10
Goddammit.It's unbelievably fucking annoying when you post the same question multiple times. You posted this one at least twice, maybe more: http://forum.java.sun.com/thread.jspa?threadID=5122537
jverda at 2007-7-8 2:23:10 > top of Java-index,Java Essentials,New To Java...