class.getPackage().getSpecificationVersion() gives me a NullPointer tinyb

Viewed 11

I'm trying to work with the Java bluetooth library tinyb and I have a spring boot project where I imported the tinyb library like that.

        <!-- https://mvnrepository.com/artifact/org.openhab.osgiify/intel-iot-devkit.tinyb -->
        <dependency>
            <groupId>org.openhab.osgiify</groupId>
            <artifactId>intel-iot-devkit.tinyb</artifactId>
            <version>0.5.1</version>
        </dependency>

Now when I want to use this example program I keep getting a Nullpointer in the BluetoothManager.class

The Problem is, that BluetoothManager.class.getPackage().getSpecificationVersion(); returns Null. This issue seems to have a similiar problem, though for me it happens when I run the program in Intellij via SSH on my raspberry pi

Would be grateful for any advise how to fix this :)

(this throws the Nullpointer for me at var1 = ...w)

    public static synchronized BluetoothManager getBluetoothManager() throws RuntimeException, BluetoothException {
        if (inst == null) {
            String var0 = getNativeAPIVersion();
            String var1 = BluetoothManager.class.getPackage().getSpecificationVersion();
            if (!var1.equals(var0)) {
                String[] var2 = var0.split("\\D");
0 Answers
Related