java wav 转 mp3 需要用到第三方 jar 包 jave-1.0.2.jar
maven 添加引用不行,需要直接导入
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave --> <dependency> <groupId>it.sauronsoftware</groupId> <artifactId>jave</artifactId> <version>1.0.2</version> </dependency>
直接将java包放到 resource 下,
<dependency> <groupId>com.convert</groupId> <artifactId>java-1.0.2</artifactId> <version>${sauronsoftware.version}</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/resources/extlib/jave-1.0.2.jar</systemPath> </dependency>
intellij 运行没问题。打包发布后,不能运行,报 NoClassDefFoundError
java.lang.NoClassDefFoundError: it/sauronsoftware/jave/EncoderException
at java.lang.Class.getDeclaredConstructors0(Native Method)
解决方案:将jar 包安装到 maven下,注意 jave-1.0.2.jar 不是 java-1.0.2.jar 名字启得牛
$ mvn install:install-file -Dfile=d:Javajave-1.0.2.jar -DgroupId=it.sauronsoftware -DartifactId=jave -Dversion=1.0.2 -Dpackaging=jar
<dependency> <groupId>it.sauronsoftware</groupId> <artifactId>jave</artifactId> <version>1.0.2</version> </dependency>
再次 java -jar xxx 启动成功