March 22, 2016

How to get the list of users in network using java

How to get the list of computer users in the network

//List of users in the network


public class NetworkUsers
static String all;
     public static void main(String[] args)
         {try {
        // Execute command
        Process child = Runtime.getRuntime().exec("net view");
        // Get the input stream and read from it
        InputStream in = child.getInputStream();
        int c;
        while ((c = != -1)
        char e=(char)c;
        } catch (IOException e) { }     }

private static void process(char c) {
// TODO Auto-generated method stub
   //all  =String.valueOf(c) +all;
  // System.out.println(all);


Program explanation

Inputstream implies that the program is getting input as a stream of bytes

Similar posts

How to get system details through a bat file

Facebook comments