New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Can't load JAWT" on Oracle Java 7 for OS X #205
Comments
|
See #131, at least the later comments, and in particular: Your last point is the most pertinent and I do not know of any solution. |
|
By the way, you can trigger the "bug" simply by invoking Native.getComponentId(canvas)... no vlcj code is neeed at all to trigger it. |
Not possible unfortunately. The only reason I am looking at VLCJ is because I am migrating away from the deprecated QuickTime for Java bindings that no longer work on Java 7. I want to use an API that has some degree of future-proofing.
To your knowledge has a bug been filed on Oracle? It seems that not having an API to access native NSViews would preclude any third party visual components from interfacing with AWT / Swing / JavaFX. I would think that would be considered a serious issue by Oracle. |
|
So here's the timeline of events I've been able to reconstruct, after a great deal of reading:
Also of interest:
Based on this statement I'm guessing you're not planning on employing extraordinary efforts to fix this issue on OS X in advance of Oracle providing an API to make a fix reasonable. And it doesn't look like Oracle is interested in making a fix, given their lack of updates to the related workitem. Therefore VLCJ will not support the latest versions of OS X & Java for the foreseeable future unless someone else steps up to make a fix. And I'm not willing to be that guy since it will (probably) be faster to rewrite my Java application to use a different rendering mechanism (such as HTML). Depending on your GitHub Issue workflow you could leave this Issue open (as a known issue). Or otherwise migrate this known issue to somewhere in your documentation. |
I can not imagine what any such "extraordinary efforts" might be. Please elaborate if you think it's possible, I doubt it. With vlcj, you can always fall back to the direct rendering approach. Not ideal, but it works. In any event it's seemingly Hobson's choice. |
I was thinking along the lines of forcefully pulling out the NSView or CALayer out of Oracle's AWT implementation through private API. This maintains the VLCJ ability to compose with AWT and Swing views. Naturally this approach is very brittle. The other option I see is rewriting VLCJ to use a different rendering platform than AWT or Swing that provides better access to the native NSView & CALayer objects. SWT looks promising, as the native integration documentation looks quite approachable. But changing the rendering platform completely breaks backwards compatibility with existing clients of VLCJ and thus is a nonstarter. |
|
The essential point I think is this: libvlc (not vlcj), when embedding, requires a native heavyweight window handle to render video. vlcj does not render the video, vlc renders it, so suggesting that vlcj be rewritten to use a different rendering platform does not make sense to me. If you can't provide a heavyweight window handle, then you are left with using vlcj with direct rendering or finding some other solution. Anything else is outside the scope of this project. |
|
Maybe this relates somehow, I don't know: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7181710 Might be worth testing jdk7u40 when it is released, at time of writing it's early access downloadable from here: |
|
Well that's definitely a step in the right direction. If the header file to be restored is as described in the bug then Oracle has silently implemented the API that provides the native CALayer behind an AWT view. From your description of VLC's API, we'd need to actually get an NSView to pass to VLC. There's a reasonable chance that VLC's API could be extended take a CALayer as an alternative to an NSView, since both provide a native drawing surface. I might be willing to take on that API extension if that's all that would be needed from VLC's side. |
|
Might be worth testing the developer preview of JDK8 that was very recently published: |
|
JDK7u40 is now released, this supposedly includes the fix mentioned in an earlier comment. http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Might be worth a try. |
|
I have same problem, using JDK7u40. |
|
Thanks for testing that. Unfortunately this means it will likely never work. At least not without some major native code for Mac. That's outside the scope of this project. |
|
An update that it does not work with
|
|
I don't think this will ever work on OSX again. The change in philosophy for AWT on OSX was made intentionally. |
|
Maybe these reports relate, still no sign of any fix as far as I can tell: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7154778 |
|
Interesting approach using Wine here: https://www.youtube.com/watch?v=sGkHINJvhTw It was posted April 1st, but I think it's real... ;-) |
|
There's still no satisfactory answer for this. I note that SWT has apparently been made to work: This bug relates https://bugs.eclipse.org/bugs/show_bug.cgi?id=374199 This seems to hinge around CViewEmbeddedFrame, but after some investigations and testing I can't quite understand if it will be useful for this issue in vlcj or not. If the SWT_AWT bridge still works on JDK 1.7 and 1.8, then in theory vlcj in SWT is an option (albeit far from ideal) for for OSX. |
|
See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=418245. No answers. |
|
Also http://mail.openjdk.java.net/pipermail/awt-dev/2013-December/006711.html. What I find hilariously depressing about this is that according to that mailing list thread the justification for this is "because applets" and "because web browsers". Who really cares about the sub-standard Java applets experience nowadays when HTML5 is so superior, especially with applets as a significant attack vector. |
|
I don't know if this will help, but there is a new "caopengllayer" video output in VLC 2.2.0 that also allows to set a video surface with libvlc_media_player_set_nsobject. I can't investigate this further until VLC 2.2.0 final is released. |
|
In my testing, I can't do anything with the caopengllayer video output from Java. It is still totally unknown what should be used for the nsobject parameter value. This is effectively a dead end, and native rendering on OSX after Java 6 looks pretty much a bust unless someone else posts some useful information. |
|
In the impossible quest to find a solution to this, another tidbit... From https://groups.google.com/a/teamdev.com/forum/#!topic/jxbrowser-forum/CgGX76sHfCA: |
|
Right now I think that SWT is the only way to get this working on OSX on any JDK after 1.6. SWT and Swing can co-exist, so using SWT for video and Swing for everything else (if that's what is wanted) is probably the best that can be done here. I think that approach would be better in terms of performance than using a direct media player. |
|
Example showing how to embed vlcj inside SWT that is itself embedded inside a Swing applicaiton at https://github.com/caprica/vlcj-swt-swing |
|
Example showing how to embed vlcj inside SWT, not using Swing, at https://github.com/caprica/vlcj-swt-demo |
|
FYI: I'm trying to make my VLCJ-based RTSP streamer work cross-platform on Windows, Mac and Linux. Windows is working fine, but I'm running into this same issue. However, when I try to use the SWT Composite solution, the new swt.jar I can download from the website (v 4.7.1a) has hidden the "embeddedHandle" property of the Composite object. I am trying with v 4.5.2, as you've included in your pom.xml maven build file, but it seems to have the same issue... Not sure if I want to modify the Composite.java source code to gain access... |
|
Ultimately, a native window handle is needed by LibVLC - if the toolkit you use does not provide an official/public API to get that handle, you must resort to workarounds. The least bad workaround is to use reflection to e.g. make a private native window handle class field public instead, and extract that value. If that's not possible, then... good luck. This particular issue is very difficult to do anything about. |
|
found this code to get the Composite handle. it work with JDK8 with this |
|
Any idea if this works on later JDKs, i.e. 9, 10, 11? Having said that, if it does indeed work on at least JDK 8, it will be definitely be worth putting that code into vlcj itself. |
|
my current setting. 10.13.6, Eclipse Neon, JDK8. didn't try 9, 10 or 11..... |
|
Oh, I just realised this was in relation to SWT. Damn. I was hoping it was finally a solution for using Canvas on OSX but it's clearly not. |
|
hahaha well, rather than VLCJ totally dead in OS X. that what happen when i tried to run it in OS X....now because of SWT, VLCJ back to business |
|
Linking this purely for reference, as it seems somewhat related and interesting: |
Environment: vlcj 2.4.1, Oracle Java 7, OS X 10.7, vlc 2.0.0
Summary: DefaultMediaPlayer.playMedia() throws a
java.lang.UnsatisfiedLinkError: Can't load JAWTexception when using Oracle Java 7 on OS X. Apple Java 6 works.Repro Steps:
javac Tutorial2B.javajava Tutorial2B TestVideo.m4vExpected Results:
A window appears and the specified video plays inside of it.
Actual Results:
A black window appears. The following stack trace is printed:
Notes: This exact same code works correctly when run on Apple Java 6. Therefore Oracle broke something during their port. I have run all tests on fresh installs of OS X 10.7 so there isn't anything else in my environment that would be causing conflicts.
The text was updated successfully, but these errors were encountered: