Question: The Raspberry Pi 3 includes BLE support. I confirmed it works by 

sudo hcitool lescan

which returned the MAC and BLE 'complete local name' for neighboring advertisers.

How does one access this programmatically, in Java?

Answer: 
I don't think there is a clear or easy answer available at this time. Bluetooth integration requires native components that are not part of a standard JDK.

The most common library used for using Bluetooth with Java on Linux is [BlueCove](http://bluecove.org/). BlueCove provides extra native libraries for working with Bluetooth on linux: [BlueCove-GPL](http://bluecove.org/bluecove-gpl/) or [BlueCove-bluez](http://bluecove.org/bluecove-bluez/)(experimental). However, you will likely need to compile one of these yourself for use on your RPi. Methods for doing do will be dependent on your distribution and will require some significant knowledge of linux, compiling native code, etc. A quick google search shows some working examples of this for previous RPi versions. It's unclear if it will work with the BLE on RPi 3 though.

Another might be to try using "[Camel Bluetooth Component](http://ajurasz.github.io/2015-11-16-bluetooth-scanner-on-raspberry-pi/)", which is wrapper over Bluecove and expects libbluetooth-dev and blueman to be installed. But again, not clear if it will work with RPi 3.

If unable to get a true integration working, another option might be to simply make external [Process](https://docs.oracle.com/javase/8/docs/api/java/lang/ProcessBuilder.html) calls out from Java to the command line Bluetooth utilities that you know already work. It depends on your use-case if this an option, but I suspect could be sufficient for many BLE specific use cases.
You can make this very simple by simply executing a command through Runtime and reading the output with a BufferedReader.

Executing the command:

```
Process p;
p = Runtime.getRuntime().exec(command);
p.waitFor();

```

Full code:

```
 package your.package.rpicommand;

 import java.io.BufferedReader;
 import java.io.InputStreamReader;

 public class ExecuteShellCommand {

public static void main(String[] args) {

    ExecuteShellCommand obj = new ExecuteShellCommand();

    String domainName = "google.com";

    //in mac oxs
    String command = "ping -c 3 " + domainName;

    //in windows
    //String command = "ping -n 3 " + domainName;

    String output = obj.executeCommand(command);

    System.out.println(output);

}

private String executeCommand(String command) {

    StringBuffer output = new StringBuffer();

    Process p;
    try {
        p = Runtime.getRuntime().exec(command);
        p.waitFor();
        BufferedReader reader =
                        new BufferedReader(new InputStreamReader(p.getInputStream()));

                    String line = "";
        while ((line = reader.readLine())!= null) {
            output.append(line + "\n");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }

    return output.toString();

}

}

```

I wish I could of coded this for you but there is already plenty of example on the internet about this.

Although this is one way of doing this, you *should* use BlueCove or some library to scan through the Bluetooth devices.

Source: <https://www.mkyong.com/java/how-to-execute-shell-command-from-java/>