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 5 of 5

Thread: By using java how to listout sharing files in LAN...?

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

    Post By using java how to listout sharing files in LAN...?

    I want to know the sharing files when systems are connected in LAN......


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: By using java how to listout sharing files in LAN...?

    Hello ram07,

    Welcome to the Java Programming Forums.

    Can you please give us some more information regarding this?
    Are you looking to create a server/client so you can exchange the files?

    If the machines are on a LAN then you can transfer files direct.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: By using java how to listout sharing files in LAN...?

    Actually I want to find the sharing files in LAN by using java program. Not for transfer the data.. please help How to find the sharing files in LAN by using java program..

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: By using java how to listout sharing files in LAN...?

    I'm not too sure how you would go about doing this but you could try something like:

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
     
    public class LANshares {
     
    	/**
    	 * JavaProgrammingForums.com
    	 */
    	public static void main(String[] args) {
     
    		try {
    	        String line = null;
    	        String[] commands = new String[] { "cmd", "/C", "net share" };
    	        Process child = Runtime.getRuntime().exec(commands);
    	        InputStream ins = child.getInputStream();
    	        BufferedReader buffReader = new BufferedReader(new InputStreamReader(ins));
    	        while (!(line = buffReader.readLine()).trim().equals(
    	                "The command completed successfully.")) {
    	            System.out.println(line);
    	             }
    	    } catch (Exception exp) {
    	    	System.out.println("Ouch - " + exp);
    	    }
    	}
    }

    NET SHARE command
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

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

    Default Re: By using java how to listout sharing files in LAN...?

    javaPF actually it display with in the system sharing files only. But I want Remote system sharing folders.. please give me reply friends....


    Actually I wrote one program it displayed Remote system shared files in the shared folder. But I want to diaplay the that shared folder name. please give me reply friends...
    Last edited by ram07; March 26th, 2011 at 10:22 PM.

Similar Threads

  1. Sharing my ByteStream, feel free to improve!
    By Verficon in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: March 7th, 2011, 09:44 AM
  2. HTK files from Java problem.
    By ivanloes in forum Java Theory & Questions
    Replies: 0
    Last Post: December 17th, 2010, 05:49 PM
  3. got all .java files ready. how to make them into jar?
    By sibbe in forum Java Theory & Questions
    Replies: 22
    Last Post: December 6th, 2010, 06:09 PM
  4. Calling exe files from Java
    By linuxrockers in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 26th, 2010, 04:20 AM
  5. Need help compiling java class files
    By peahead in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 11th, 2010, 08:04 AM