遇到的问题
使用过程中遇到一些错误,如运行时jvm 错误、打包错误、以及打包后运行错误,处理过程也比较艰辛,特此总结
解决办法
一、运行时候发生发生jvm 严重错误
可以换版本低一点的jdk8
链接:pan.baidu.com/s/1mFajNwuT… 提取码:s9l5
二、打包后执行 java -jar报错 java.io.FileNotFoundException 解决
1.pom.xml 引入本地依赖
<dependency>
<groupId>gnu.io</groupId>
<artifactId>RXTXcomm</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${env.JAVA_HOME}/jre/lib/ext/RXTXcomm.jar</systemPath>
</dependency>
2.pom.xml配置spring-boot-maven-plugin 支持,包括系统范围
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
二、打包后运行报错no rxtxSerial in java.library.path
1.打印java.library.path 后发现两台电脑,打印出的目录位置有点区别
log.info("jar 包获取到的library路径:"+System.getProperty("java.library.path"));