devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

Null pointer exception in load library of webrtc-java #38

Closed RaniRaven closed 2 years ago

RaniRaven commented 2 years ago

For some reason the code fails upon getting NullPointerException when trying to load the webrtc-java.dll from the jar. This is while calling the NativeClassLoader. By the looks ]of the code, it seems like this thoing made a lot of problems before, a I cannot understand the need for all the TempPath inside.

Did anyone else tackled with this issue ?

devopvoid commented 2 years ago

Since the native libraries are packaged into the jar-files, they need to be extracted to the filesystem. The target directory is the temp folder.

If you haven't, create a module-info.java within your project and import (requires webrtc.java;). This should work.

devopvoid commented 2 years ago

See this issue if you are using IDEA.

RaniRaven commented 2 years ago

I have solved this issue, it seems that in IdeaJ project one needs to add the native jar as module dependency before anything will work there. Thanx.

nanguantong commented 2 years ago

Hi, how to use the gradle jar on windows or linux without adding fmodule-info.java in IntelliJ IDEA,load error: tmp file: C:\Users\ADMINI~1\AppData\Local\Temp\webrtc-java2765647831398423105.dll

Caused by: java.lang.RuntimeException: Load library 'webrtc-java' failed

nanguantong commented 2 years ago

Hi, how to use the gradle jar on windows or linux without adding fmodule-info.java in IntelliJ IDEA,load error: tmp file: C:\Users\ADMINI~1\AppData\Local\Temp\webrtc-java2765647831398423105.dll

Caused by: java.lang.RuntimeException: Load library 'webrtc-java' failed

gradle import : implementation group: 'dev.onvoid.webrtc', name: 'webrtc-java', version: '0.3.0'

image

then lack the webrtc-java-0.3.0-windows-x86_64.jar compared with maven.

image

see https://github.com/devopvoid/webrtc-java/issues/23

nanguantong commented 2 years ago

And then when use maven project, it's ok to run this jar, but error happened while running List<AudioDevice> captureDevices = MediaDevices.getAudioCaptureDevices(); java.lang.Error: MMF: Create device enumerator failed CoInitialize has not been called.`

nanguantong commented 2 years ago

Hi, how to use the gradle jar on windows or linux without adding fmodule-info.java in IntelliJ IDEA,load error: tmp file: C:\Users\ADMINI~1\AppData\Local\Temp\webrtc-java2765647831398423105.dll

Caused by: java.lang.RuntimeException: Load library 'webrtc-java' failed

See https://github.com/devopvoid/webrtc-java/issues/23