I built this project: https://github.com/Charles92011/WebRTCJavaTest
Using the WebRTC library for java from: https://github.com/devopvoid/webrtc-java
When I execute the project in eclipse, it runs fine and I can make connections.
But when I export it as an executable jar file it runs, but as soon as I attempt a connection I get the exception:
java.lang.NoClassDefFoundError: Could not initialize class dev.onvoid.webrtc.PeerConnectionFactory
I'm running on windows 10, the windows native library is being imported into my jar file
Any suggestions?
I'm building it using the Export Jar file feature in Eclipse, and having it package all required libraries into the jar file. Here is the script it creates:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project WebRTCJavaTest">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<!--define folder properties-->
<property name="dir.buildfile" value="."/>
<property name="dir.workspace" value="C:/Users/Charles Johnson/Documents/Workspaces/HelloWorld"/>
<property name="dir.jarfile" value="${dir.buildfile}"/>
<target name="create_run_jar">
<jar destfile="${dir.jarfile}/javartc1.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="main.Main"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="C:/Users/Charles Johnson/Documents/GitLab/WebRTCJavaTest/target/classes"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-server/1.17/tyrus-server-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-client/1.17/tyrus-client-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-core/1.17/tyrus-core-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-spi/1.17/tyrus-spi-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.2/jakarta.xml.bind-api-2.3.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-container-grizzly-client/1.17/tyrus-container-grizzly-client-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/tyrus/tyrus-container-grizzly-server/1.17/tyrus-container-grizzly-server-1.17.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/grizzly/grizzly-framework/2.3.22/grizzly-framework-2.3.22.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/grizzly/grizzly-http-server/2.3.22/grizzly-http-server-2.3.22.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/org/glassfish/grizzly/grizzly-http/2.3.22/grizzly-http-2.3.22.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/dev/onvoid/webrtc/webrtc-java/0.3.0/webrtc-java-0.3.0.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/dev/onvoid/webrtc/webrtc-java/0.3.0/webrtc-java-0.3.0-windows-x86_64.jar"/>
<zipfileset excludes="META-INF/*.SF" src="C:/Users/Charles Johnson/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar"/>
</jar>
</target>
</project>
CodePudding user response:
It took me 3 minutes to get your project running after cloning your repository. An MCVE is always helpful.