I'm trying to use a JNA library in my project.
My situation is as follows:
I have an applet that shows camera input.
If I run the Applet using the command run as applet I get the correct result:
an applet that shows the camera input
If I remove jna.jar from the build path it gives me error as expected.
If I rename the directory of the native plugins it gives me error as expected.
If I try to run the whole application I get the error:
GStreamer-WARNING **: Failed to load plugin C:/Users/aaa/Desktop/bbb/ccc/video/library/\windows64\plugins\libgstwavparse.dll on 30+ dlls
The path C:/Users/aaa/Desktop/bbb/ccc/video/library/\windows64\plugins\ is the one that if renamed makes the applet crash (so the correct one) and jna.jar and the library that used by JNA are imported in each project involved: the root project from which the application is started and the view project that instantiates the camera showing applet.
As previously suggested, I have tried
System.setProperty("jna.library.path","C:/Users/aaa/Desktop/bbb/ccc/video/library/windows64/plugins/" );
etc... in all possible forms to reference the correct directory but to no avail.
The library is a 3rd party library and actually should work.
The problems may be in my total lack of knowledge of JNA and/or Gstreamer or even of some basics at this point.
Is there any workaround? Why do the applet and application that instantiates the applet work differently when referencing DLLs... or Gstreamer DLLs... or the Processing 2.2.1 included Gstreamer DLLs?
Ok i managed to make it work this way: if i write a main directly in the View project and add the applet to a panel it now works... so that solves some issues(the applet was in a panel even before anyways)... the same exact dummy main gives the warning as before if run under root project alas: failed to load plugin:"correct path"
As said before i have a root project and a view project(N Vproject to be frank) the video lib is included in the VProject and the dlls are under is project resources. Is it possible that running the app from the main project something (like different system variables) end up causing problems?
Just not knowing the issue i precedently added and removed(and combinations) all that could be added in relation to jna platform and to tha jna-using-video lib to both projects.
i really do care about uncoupling in this case because im sort of writing a framework and this is a major limitation. Any insight?
Related
Trying to open .JAR file on macOS Ventura intel base laptop running java 8 351. GUI game was built using IntelliJ, Java jdk 19 and JavaFX 19. Getting a console error message with no console appearing. GUI game works perfectly inside IntelliJ, included right libraries and module paths. When building artifacts "exporting jar executable" I get prompted with this error message whenever I'm trying to open it.Error Message
Solutions tried to find where the problem is with no avail
I tried creating simple javafx program and building artifacts.
Built project with different java jdks.
Built project with visual studio code and eclipse.
Went through the same steps on a older macOS
I'm suspecting its a java jre error, any tips on how to fix this problem?
You Should Make FXML files in one package and go to project structure -> Modules -> sources. Then select your package of fxml files and mark it as resource.
Pic Of Example Mark Module As Resource
Then Re Arrange getClass().getResourse("") code lines using under scenario
Pic Of Example Direction to resources
The "./" Directly direct into resources.
Jar files cannot read fxml files until you make them as resources
I try to use Scuba project.I downloaded source with SVN checkout and imported it into Eclipse .Also i imported scuba_smartcards project. Everything is perfect but i have one problem.When i try to run scuba project like java application,have this error message:
Selection does not contains main type
I don't know is a correct to run this source like java application or not.By the way i created my own java class and i want to use scuba's source in main method
Ho i can solve my problem?
thanks everyone
P.s i also found source in github
https://github.com/credentials/scuba
I'm using scuba_sc_j2se
SCUBA is a framework, basically it is a library with active components. Libraries are not standalone applications so they will not contain a main method of their own. You cannot just run it, you need to write or copy an application that uses the framework through the API presented by SCUBA.
One of these applications is the jMRTD application from which SCUBA originated.
I'm trying to follow the guide to export my project as a Java applet.
My project, as seen in Eclipse, has three directories:
Game
Game-Android
Game-Desktop
They were created using the UI Setup tool. The guide at http://www.thesecretpie.com/2011/05/being-like-minecraft-or-how-to-run-your.html is confusing and I don't understand these points:
Next step: add a new file called HelloWorldApplet.java (in the same
directory as other source files).
"The same directory as other source files". Well, I have three directories and they all have a source folder. In which of these three am I supposed to put this file? I tried placing it in Game, but Eclipse is unable to resolve com.badlogic.gdx.backends.lwjgl.LwjglApplet. If I put it in Game-Desktop it seems to be OK, but I'm not sure.
Create a directory called applet in your project dir.
Again, in which of my three directories?
Just export the whole project as jar in Eclipse
I can export a JAR for Game, Game-Android, or Game-Desktop. Which of these?
Related:
I happen to be using the JRuby JAR in my game to run some ruby scripting logic. Do I have to do something specific about it?
That blog is little old. For example, the JOGL backend is gone from recent version of Libgdx (so you don't need to worry about switching to the LWJGL backend). Also, the current LWJGL bundled into Libgdx is 2.9.0 (hopefully that doesn't change too much, though).
I believe the instructions are effectively packing up the "desktop" build of your app into an Applet (as the desktop is the only build that use the LWJGL backend), so assume Game-Desktop is the "same directory" that its talking about.
Thus, you should export the .JAR from your Desktop project.
On a related note, there is another way to run your game on the web, using the GWT backend. Check out the Setup & Running page (where its called "HTML5"). There are a bunch of caveats on using the GWT backend (not all Libgdx APIs work over there). (Hmm... I doubt this will work with the JRuby JAR, so probably not worth spending too much time on that.)
I tried following various tutorials for getting a JavaFX hello world app running in a browser. I can't believe it's that hard, so I'm looking for any insight into what I may have done wrong. Some things I've tried and resolved (to rule out the obvious):
Had to download 32-bit JRE for the browsers and ensure they were using that
Thus using the latest JRE (7u21); running on Win 7 64-bit
Checked Windows Control Panel -> Programs -> Java to verify the JRE being used
Signed the JAR file
Tried running from local file, found that drive letters weren't recognized, so moved to running via Tomcat 6
Tried various changes to the codebase and url hrefs, but I believe those are correct.
Tried in both IE 10 and Chrome
What I ended up with was that loading the .html (which references the jnlp using the JavaFX default javascript) would spin for a while then fail. If I try to load the .jnlp file directly, I get an exception:
ClassNotFoundException: javafx.application.Application
I verified that the jfxrt.jar is in the lib folder of the JRE that the browser is using.
Any insight/suggestions as to what I may be missing at this point? Seems like it must be something obvious/basic at this point, but I'm not seeing it. Thanks.
Just to follow-up, I went ahead and used javafxpackager. That produced a web page that would load the JavaFX application in Chrome. However, it still doesn't work in IE. I'm going to write that off as an IE but since it works in Chrome. What I did learn by looking at the results, though, is there are several things javafxpackager does, and the results of that are not exactly what's described in most of the manual tutorials/examples. Minor differences, but apparently they matter.
It sounds as you don't have the JavaFX starter classes in your JAR (usually done by the Ant script) and don't have the correct JavaFX Manifest entries.
It should not be needed to add the jfxrt.jar as a resource to your JNLP file and you shouldn't have to sign it.
Please show your Manifest file.
The Manifest file should contain at least the following JavaFX entries:
JavaFX-Version: 2.2
JavaFX-Application-Class: yourPackage.YourApplication
Main-Class: com/javafx/main/Main
The JAR should contain the classes of the com.javafx.main package provided by the ant-javafx.jar (see /resources/classes in that Jar). The ant-javafx.jar is provided by the JDK.
I was able to mostly resolve my problem. I'm using Eclipse, not NetBeans, so doing a lot manually. The basic problem was that I had to include the jfxrt.jar as a resource in the jnlp file (and that jar also had to be signed).
My app now runs if I access the jnlp directly, though it still doesn't work via html page. I'll post an update if/when I figure that part out.
I am having trouble packaging an application with both Swing and JavaFX components into a JAR file. Running it from Eclipse is fine. But when executing the Jar, errors occur: The main method is run, which calls the constructor of my app. The constructor calls a initAndShowGUI() method, which tries to create a JFXPanel for later addition to a JFrame, but fails with following error message: Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\User\bin\glass.dll. This library seems to be needed by JavaFX but is somehow not loaded. "Pure" JavaFX apps (without Swing) call something like a "preinitialitation" method for JFX that loads all the needed libs, I think (I'm not completely sure). Also, I've found information on how to deploy Java Web Start apps or applets (http://docs.oracle.com/javafx/2/deployment/deploy_swing_apps.htm), but nothing on "standard" JARs.
Has anybody done this before? I've been looking for a solution a lot but have not been able to find one. Help is highly appreciated!
Likely your issue is packaging related.
How did you package the app?
For example:
Did you use e(fx)clipse?
Did you use the the javafx ant tasks?
Did you use the javafxpackager?
I know (at least) the last two will work to build a Swing application with JavaFX components into an executable jar.
The SwingInterop sample includes an ant script for packaging the sample into an executable jar. The sample is downloadable from the javafx download site.
I highly recommend reviewing Why should I use the JavaFX ant tasks for packaging my Swing application? which post also includes the source for the SwingInterop sample build file.