Embed Youtube Video in Java Swing - java

I have following problem:
I try to embed a YT video in my Java Swing. Therefore I installed DJProject from this website https://sourceforge.net/projects/djproject/?source=typ_redirect
I added following external JAR's:
sw-4.3-win32-x86.jar
DJNativeSwing.jar
DJNativeSwing-SWT.jar
But I get this exception message:
NativeSwing[1]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
NativeSwing[1]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[1]: at java.lang.Class.forName0(Native Method)
NativeSwing[1]: at java.lang.Class.forName(Unknown Source)
NativeSwing[1]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1273)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1461)
NativeSwing[1]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:224)
NativeSwing[2]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
NativeSwing[2]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[2]: at java.lang.Class.forName0(Native Method)
NativeSwing[2]: at java.lang.Class.forName(Unknown Source)
NativeSwing[2]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1273)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1461)
NativeSwing[2]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:224)
NativeSwing[3]: Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
NativeSwing[3]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
NativeSwing[3]: at java.lang.Class.forName0(Native Method)
NativeSwing[3]: at java.lang.Class.forName(Unknown Source)
NativeSwing[3]: at org.eclipse.swt.graphics.Device.<clinit>(Unknown Source)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1273)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1461)
NativeSwing[3]: at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:224)
Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Connection reset
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:67)
at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.initialize(MessagingInterface.java:57)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:32)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface$SwingOutProcessSocketsMessagingInterface.<init>(OutProcessSocketsMessagingInterface.java:162)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.createOutProcessMessagingInterface(SWTNativeInterface.java:1072)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.createOutProcessCommunicationChannel(SWTNativeInterface.java:811)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.open_(SWTNativeInterface.java:342)
at chrriis.dj.nativeswing.swtimpl.NativeInterface.open(NativeInterface.java:100)
at tatil.main.main(main.java:16)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.openChannel(OutProcessSocketsMessagingInterface.java:65)
... 8 more
How can I solve this problem?

As clearly shown in exception message
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load
32-bit SWT libraries on 64-bit JVM
Install 32 Bit JDK as 32-bit SWT libraries cannot run with 64 bit run-time.
Download x84 from the following link, Remove existing java installation and install the one downloaded.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Or check this
SWT on Windows 64-bit

Related

Missing mandatory jurisdiction policy files: unlimited

Something to do with eclipse as I can run the code successfully in cmd.
I am using standard oracle Java version 15 and eclipse version 2020-12(4.18.0) on windows 10
HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();
At the line above I am getting error as pasted below.
Please note: System.out.println(System.getProperty("java.security.properties")); gives null
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/javax.crypto.Cipher.getInstance(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.isTransformationAvailable(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.(Unknown Source)
at java.base/sun.security.ssl.SSLCipher.(Unknown Source)
at java.base/sun.security.ssl.CipherSuite.(Unknown Source)
at java.base/sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuites(Unknown Source)
at java.base/sun.security.ssl.SSLContextImpl$AbstractTLSContext.(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at java.base/java.security.Provider$Service.getImplClass(Unknown Source)
at java.base/java.security.Provider$Service.newInstance(Unknown Source)
at java.base/sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.base/sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.base/javax.net.ssl.SSLContext.getInstance(Unknown Source)
at java.base/javax.net.ssl.SSLContext.getDefault(Unknown Source)
at java.base/javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source)
at java.base/javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(Unknown Source)
at java.base/javax.net.ssl.HttpsURLConnection.(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.(Unknown Source)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Unknown Source)
at java.base/java.net.URL.openConnection(Unknown Source)
at hackerearthpractice/hackerearthpractice.GoalGetter.main(GoalGetter.java:16)
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at java.base/javax.crypto.JceSecurity.(Unknown Source)
... 23 more
Caused by: java.lang.SecurityException: Missing mandatory jurisdiction policy files: unlimited
at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(Unknown Source)
at java.base/javax.crypto.JceSecurity$1.run(Unknown Source)
at java.base/javax.crypto.JceSecurity$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
... 24 more
It was using this weird runtime in eclipse, I changed it to the one I have installed and then it worked.

Unidentidied Errors in mobaxterm

I try to compile my code on Mobaxterm and am getting all these strange errors. Any idea what I'm doing wrong?
Exception in thread "main" java.lang.UnsatisfiedLinkError:
/usr/java/jre1.8.0_151/lib/i386/libawt_xawt.so: libXext.so.6: cannot open
shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)//
at java.lang.System.loadLibrary(Unknown Source)
at java.awt.Toolkit$3.run(Unknown Source)
at java.awt.Toolkit$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Unknown Source)
at java.awt.Toolkit.<clinit>(Unknown Source)
at java.awt.Component.<clinit>(Unknown Source)
at biuoop.GUI.<init>(GUI.java:36) //this is a library
at AbstractArtDrawing.DrawRandomLines(AbstractArtDrawing.java:37)
at AbstractArtDrawing.main(AbstractArtDrawing.java:15)
make: *** [run2] Error 1
If anyone has any idea what's going wrong, i'd really appreciate it.
According to this error message you need to install libXext for i386 (the processor architecture)
libXext is a package for X11 window system
you can check the below links for installation instructions:
ubuntu
Can't find/install libXtst.so.6?
centos
CentOS: error: libXext.so.6: cannot open shared object file: No such file or directory
:)

How to resolve dll UnsatisfiedLinkError when using JNA 4.2.0 with Java 6 on Windows 7.1?

I'm using version 4.2.0 of the JNA libraries from here: https://github.com/java-native-access/jna.
My application works absolutely fine on Java 7 & 8 32-bit on a 64-bit Windows 7.1 machine.
When I try to load it using Java 6 32-bit, I get this error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\user\AppData\Local\Temp\jna-205523658\jna1343790277438028829.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:851)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:826)
at com.sun.jna.Native.<clinit>(Native.java:140)
at com.sun.jna.Pointer.<clinit>(Pointer.java:41)
at com.sun.jna.platform.win32.WinReg$HKEY.<init>(WinReg.java:32)
at com.sun.jna.platform.win32.WinReg.<clinit>(WinReg.java:61)
Is this an incompatibility issue between 32-bit Java 6 on a 64-bit OS? Is there anything I can do about it?
My problem is that I need to deploy my app to a wide user base all with different permutations of Java 32-bit on different Windows operating systems.

javaw.exe process hangs on applet start

Periodically we have this problem that prevents an applet to go running, the process javaw.exe seems locked, killing them several times unlock the applet. In the trace file I find this (we have jdk 1.6_35, the applet is used by a j2ee web application):
**server running at port: 50091
basic: unique id: JavaControlPanel
basic: server port at: 49187
basic: getSingleInstanceFilename: C:\Users\amoriconi\AppData\LocalLow\Sun\Java\Deployment\tmp\si\JavaControlPanel-x86_49187
basic: file should be removed: C:\Users\amoriconi\AppData\LocalLow\Sun\Java\Deployment\tmp\si\JavaControlPanel-x86_50091
basic: waiting connection
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.security.jca.ProviderConfig$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source)
at sun.security.jca.ProviderConfig.getProvider(Unknown Source)
at sun.security.jca.ProviderList.getProvider(Unknown Source)
at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source)
at sun.security.jca.ProviderList$ServiceList.access$200(Unknown Source)
at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.SecureRandom.getInstance(Unknown Source)
at java.security.SecureRandom.getDefaultPRNG(Unknown Source)
at java.security.SecureRandom.<init>(Unknown Source)
at com.sun.deploy.services.WPlatformService.getSecureRandom(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.getSecureRandom(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.access$100(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer.createSingleInstanceFile(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl$SingleInstanceServer.<init>(Unknown Source)
at com.sun.deploy.si.SingleInstanceImpl.addSingleInstanceListener(Unknown Source)
at com.sun.deploy.panel.ControlPanel.<init>(Unknown Source)
at com.sun.deploy.panel.ControlPanel.main(Unknown Source)
Caused by: java.lang.RuntimeException: java.security.NoSuchAlgorithmException: class configured for SecureRandom(provider: SUN)cannot be found.
at java.security.SecureRandom.getDefaultPRNG(Unknown Source)
at java.security.SecureRandom.<init>(Unknown Source)
at com.sun.crypto.provider.SunJCE.<clinit>(DashoA13*..)
... 28 more
Caused by: java.security.NoSuchAlgorithmException: class configured for SecureRandom(provider: SUN)cannot be found.
at java.security.Provider$Service.getImplClass(Unknown Source)
at java.security.Provider$Service.newInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at sun.security.jca.GetInstance.getInstance(Unknown Source)
at java.security.SecureRandom.getInstance(Unknown Source)
... 31 more
Caused by: java.lang.ClassNotFoundException: com/sun/deploy/security/WSecureRandom
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
... 36 more**
For some reason this problem is originated from an hidden update of java, installing jdk 7u45 and then removing solve for some time the problem.....
I'm going crazy....
This is happening because there are more security checks that have been imposed on applets in the new release of the JRE (7u45-b18).
http://www.oracle.com/technetwork/java/javase/7u45-relnotes-2016950.html#newft
Its good to be on old JRE or implement security related changes.

Applet throwing exception when running it through web browser

I have written an applet program. It has some references to classes from java tools.jar in it (eg:- import com.sun.jdi.connect.IllegalConnectorArgumentsException)
When I run this applet through appletviewer utility it works fine. But when I embed this applet in HTML file and try to run it through web browser, I am getting exception about some classes not found at runtime:-
Java Plug-in 1.6.0_18
Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Pras
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jdi.connect.IllegalConnectorArgumentsException
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Caused by: java.io.FileNotFoundException: C:\pal\WTP_Workspace\JavaSocketBridge\bin\com\sun\jdi\connect\IllegalConnectorArgumentsException.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 17 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sun/jdi/connect/IllegalConnectorArgumentsException
However the IllegalConnectorArgumentsException class is part of java runtime located inside tools.jar.
How I can get run it inside browser as well?
many thanks in advance.
Regards,
Pras
You are running your applet from the JRE. The class IllegalConnectorArgumentsException can only be access from the JDK since it's related to debugging.
Refer to this question.

Categories

Resources