java.lang.UnsatisfiedLinkError:java.library.path中没有jSerialComm

问题描述 投票:0回答:1

If I checked this, my program (simple java coding) gives this exception but else it is running and displaying desired output

详情 要与设备通信,我必须使用串行端口通过通讯与其建立连接。我之前使用过 RxTx 库,但它有 bug,所以我改用 JSerialComm。 我按照网站上的说明进行操作并根据其安装应用程序。 我的程序正在运行,但下面有一个异常,现在正在干扰我想要的输出。

“java.lang.UnsatisfiedLinkError:java.library.path中没有jSerialComm:C:\ Program Files \ Eclipse Adoptium \ jdk-21.0.1.12-hotspot in; C:\ WINDOWS \ Sun \ Java in; C: \WINDOWS\system32;C:\WINDOWS;C:\Program Files\WindowsApps\Microsoft.PowerShell_7.4.0.0_x64__8wekyb3d8bbwe;C:\Program Files\Eclipse Adoptium\jdk-21.0.1.12-hotspot in;C:\Program Files \Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Eclipse Adoptium\jdk-17.0.8.101-hotspot in;C:\ WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell 1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Maven pache-maven-3.9 .5 in;C:\Users\Toobaa.khan\AppData\Local\Microsoft\WindowsApps;;C:\Users\Toobaa.khan\AppData\Local\Programs\Microsoft VS Code in;."

图书馆使用 jSerialComm-2.10.4.jar

我尝试将.jar文件粘贴到这两个路径中 1- C:\Program Files\Eclipse Adoptium\jdk-21.0.1.12-hotspot 中; 2- C:\Users\Toobaa.khan\AppData\Local\Microsoft\WindowsApps;;C:\Users\Toobaa.khan\AppData\Local\Programs\Microsoft VS Code in;

还是同样的错误

Also this is what I am getting when running my JavaFx APplication project that contains the same Jserial.jar file

附加信息 平台:Visual Studio Code。

pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>app.creatingpdfs</groupId>
    <artifactId>projectcreatepdfs</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>13</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>13</version>
        </dependency>
        <dependency>
            <groupId>com.fazecast</groupId>
            <artifactId>jSerialComm</artifactId>
            <version>[2.10.3,2.10.4]</version>
        </dependency>
        <dependency>
            <groupId>com.aspose.pdf</groupId>
            <artifactId>aspose-pdf</artifactId>
            <version>23.1</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>1.8</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.6</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running -->
                        <!-- Usage: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>app.creatingpdfs.App</mainClass>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
java serial-port unsatisfiedlinkerror
1个回答
0
投票

尝试用以下内容替换插件配置:

        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>0.0.6</version>
            <executions>
                <execution>
                    <!-- Default configuration for running -->
                    <!-- Usage: mvn clean javafx:run -->
                    <id>default-cli</id>
                    <configuration>
                        <mainClass>app.creatingpdfs.App</mainClass>
                    </configuration>
                    <options>
                        <option>-Djava.library.path=C:\Users\Toobaa.khan</option>
                        <option>-DjSerialComm.library.path=C:\Users\Toobaa.khan</option>
                    </options>
                </execution>
            </executions>
        </plugin>

显然正确的 dll 必须位于所示的路径中

© www.soinside.com 2019 - 2024. All rights reserved.