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: How to convert local path drive to UNC path

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to convert local path drive to UNC path

    Hi
    Is there is any way to convert the local path to UNC path in java.

    For eg String s = F:\Test\Data\hello.xml

    Here "Data" folder is shared folder and my pc name is ram-pc. so i want to convert the above url as follows.

    \\ram-pc\Data\hello.xml


    is that possible in java. Can anybody tell me how to convert local path to UNC path in java.


    Thanks
    kris


  2. #2

    Default Re: How to convert local path drive to UNC path

    Basic String concatenation should do just fine.

    Change your \ to / and follow the UNC conventions.
    Kenneth Walter
    Software Developer
    http://kennywalter.com

  3. #3
    Member
    Join Date
    Nov 2011
    Posts
    37
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: How to convert local path drive to UNC path

    Hi,
    Instead of using \ or / you can use File.separatorChar

    Core java
    Last edited by mr.miku; January 11th, 2012 at 07:17 PM.

Similar Threads

  1. My path is changed...
    By Oryan Dallal in forum Member Introductions
    Replies: 1
    Last Post: July 24th, 2011, 07:16 AM
  2. Relative path issue with Context path struts
    By chinnu in forum Web Frameworks
    Replies: 1
    Last Post: March 31st, 2011, 10:17 AM
  3. Exception in jpcap path
    By vrp in forum Exceptions
    Replies: 0
    Last Post: February 10th, 2011, 12:04 AM
  4. Shared library path
    By sateesh.b in forum Java Native Interface
    Replies: 3
    Last Post: May 13th, 2010, 11:12 PM
  5. how to get full path name from realtive path
    By priyanka3006 in forum File I/O & Other I/O Streams
    Replies: 8
    Last Post: August 10th, 2009, 04:28 AM