Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: pathSeparatorChar doesn't work

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default pathSeparatorChar doesn't work

    I am learning how to create directories in Java. My teacher told me to use pathSeparatorChar instead of "\" in order to have compatibility with linux.

    When I use File.pathSeparatorChar it is returning ";" instead of "\"

    For example System.out.println(File.pathSeparatorChar) returns ";"

    Some ideas?


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,235
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: pathSeparatorChar doesn't work

    Read the API for File...it distinctly explains what pathSeparatorChar will return. You don't define what you want to use this for...that being said there are other variables defined in the API that you might rather want to use for your purpose
    File (Java Platform SE 6)

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: pathSeparatorChar doesn't work

    Thank you, I was using pathSeparatorChar instead of separatorChar.

Similar Threads

  1. MergeSort won't work
    By joshft91 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 7th, 2011, 08:44 PM
  2. How do get and set methods work??
    By merdzins in forum Object Oriented Programming
    Replies: 2
    Last Post: December 25th, 2010, 02:17 AM
  3. please tell me why this code does not work
    By amr in forum Java Theory & Questions
    Replies: 9
    Last Post: December 6th, 2010, 05:46 PM
  4. My lines won't work!!!
    By The Mewzytion in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 2nd, 2010, 10:24 AM
  5. Why won't this while loop work?
    By trueblue in forum Loops & Control Statements
    Replies: 2
    Last Post: July 17th, 2009, 09:10 AM