Finding SSID of a wireless network with Java

java wifi scanner
java wifi api
java networkinterface
android wifi

We're doing a project coded in Java (compiled for JRE 1.6) and need some help with a little but apparently complicated feature: We want to do a certain action when a specific wireless network is connected e.g. when the connected SSID=="myNetworkAtHome" or similar.

After looking through this site, google and the Java documentation we have come a little closer. After looking at the code here:

It seems we were getting close but it hits a deadend, all the interfaces seems to be connected to "net0" through "net13" (on my laptop that is.) And we're unable to get the SSID out of any interface at all. I do realise the code in the example is only giving the interface names and not connected networks, but it doesn't seem to offer a way of fetching the connected network information.

Any help on this would be extremely helpfull!

You can't access this low-level details of the network in Java. You can get some details of the network interface with the NetworkInterface class but if you see at the provided methods, no one is related to Wifi networks nor any way to get the SSID is provided. As pointed below, you should use some native functionality through calling a native library with JNI or by calling a OS tool with Runtime.

Java is not designed to do that kind of things, is hard to implement in a platform-independent way and any hardware-level detail can not be managed in Java by principle.

Same applies to other networks like 3G, GPRS... the application should not be aware of the connection type nor its details. Java can only manage things at the Transport (TCP) level, not the network (IP) not Link (3G, Wifi, Ethernet...), so you can only manage sockets.

šŸ„„ Finding SSID Wireless Network with Java, You cannot access this low-level network data in Java. You can get some information about the network interface with the NetworkInterface class, but if you seeĀ  This cannot be done using pure Java. The Java API can take you as low as the NetworkInterface level in the networking stack, but not lower. When connected to a WiFi network, all SSID, handshaking and security stuff is done in lower levels than that - namely, your platform-dependent driver.

 ArrayList<String>ssids=new ArrayList<String>();
    ArrayList<String>signals=new ArrayList<String>();
    ProcessBuilder builder = new ProcessBuilder(
            "cmd.exe", "/c", "netsh wlan show all");
    Process p = builder.start();
    BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while (!=-1) {
        line = r.readLine();
        if (line.contains("SSID")||line.contains("Signal")){





    for (int i=0;i<ssids.size();i++)
        System.out.println("SSID name == "+ssids.get(i)+"   and its signal == "+signals.get(i)  );

How to find a list of wireless networks (SSID's) in Java , GetAvailableNetworkList( 0 ); foreach ( Wlan.WlanAvailableNetwork network in networks ) { Console.WriteLine( "Found network with SSID {0}. Find a list of wireless networks (SSID's) in Java, C#, and/or C . Code example extracted from Stack Overflow:

You'll have to resort to a JNI solution. There's something available at, but that only works for Windows systems. Or you could do it the ugly way and use Runtime.getRuntime().exec(...) and use the command line tools available for your OS (*nix = iwconfig) and resort to parsing.

NetworkInterface (Java(TM) ME Generic Connection Framework , Connect to a WiFi SSID using a named NetworkInterface: String interfaceNameā€‹) throws IOException { // Create or find the desired AccessPoint for the SSIDĀ  Step 1, Click . Doing this will open a window with wireless networks around you. You may first have to click ^ to view the Wi-Fi icon. If you see an "x" next to the Wi-Fi icon, click it, then click Wi-Fi Off to turn Wi-Fi back on.Step 2, Find your current network's name. The network you're connected to will appear at the top of the pop-up window. You'll see "Connected" beneath its name.Step 3, Review the other available network SSIDs. You'll see a list of network names in the pop-up window java code examples, WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null && !TextUtils.isEmpty(connectionInfo.getSSID())) { ssidĀ  What is an SSID and why is it important how it is set up? This is a simple guide to choosing the best SSID for your network. What is an SSID? SSID is short for Service Set Identifier. All wireless networks have an SSID, in everyday speech often known only as network names or Wi-Fi names.

Accessing Wi-Fi network interface details from Java using netsh , We're doing a project coded in Java (compiled for JRE 1.6) and need some help with a little but apparently complicated feature: We want to doĀ  Then the results will be shown in a sortable table in the program displaying information such as SSID, channel, security, RSSI, MAC Address, maximum rate, vendor and network type. The hidden wireless network is shown in the first line with an empty SSID but the rest of the information about the network is displayed. inSSIDer works on Windows XP

Service Set Identifier (SSID) in Computer Network, I am developing a Java program on Windows. I want to access Wi-Fi interface details such as SSID, IP, subnet, enabled or not, connected or notĀ  From the left menu, under Basic, click Wireless. Under Setup, click Wireless Settings. Results: Network Name (SSID) is in the Name (SSID) field. Passwords are located in the following fields. For WEP encryption, your current wireless password is located in the Key 1 field.

  • Well that sucks... But thanks for the answer, might as well stop searcdhing for direct java implementationens then, thanks again.
  • @David So Java is not designed to be able to write a full OS unless through JNI ?
  • Java is not able to "write" an OS as is an interpreted language requiring a Virtual Machine running on top of some kind of OS. If you ask about accessing all OS resources, Java is not designed to such kind of things, as one of its goals is to be portable across OS and no direct access to HW. If you want some low-level features like working at Wifi 802.X level, use JNI or choose another language like C/C++. Other main interpreted languages such as .Net platform could not also access Wifi-specific details natively as is a no-sense.
  • @DavidOlivánUbieto For the sake of correctness, actually there were a couple of OS's written (primarily) in Java. Can Java be used to develop an OS?
  • Yes! Don't want to start a flame o troll war!
  • Mhmmm the point of doing it in Java was to have a way to be crossplatform. But is there no way of utilizing the package?
  • *nix != iwconfig. Linux = iwconfig. OS X = /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport. *BSD = ifconfig. And cross-platform would require different implementations of the Java classes on different platforms.