Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Attempt running jsfml-test.jar, UnsatisfiedLinkError  (Read 3218 times)

0 Members and 1 Guest are viewing this topic.

chessguy

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Attempt running jsfml-test.jar, UnsatisfiedLinkError
« on: March 11, 2013, 01:42:41 am »
Greetings. Was going to try using JSFML... I ran the test, though, (jsfml-test.jar), and got an UnsatisfiedLinkError:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Kids\.jsfml\windows_x64\sfml-system-2.dll: Can't find dependent libraries
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
   at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
   at java.lang.Runtime.load0(Runtime.java:792)
   at java.lang.System.load(System.java:1059)
   at org.jsfml.internal.SFMLNative.loadNativeLibraries(Unknown Source)
   at org.jsfml.window.VideoMode.<clinit>(Unknown Source)
   at pong.Main.main(Main.java:11)

Note: this is the same error I get when I use jsfml.jar in a normal project in Netbeans, which is where the last live above comes from.

It cannot find the DLLS. At first, I couldn't either. I looked for the C++ DLLS, and tried putting them in the running directory, to no avail. On the wiki I found, it unpacks them to user/.jsfml. I found them there, tried copying them to the current directories, and again, to no avail.

It says it automatically unpacks them... but nothing is running, here. I feel like I am missing something obvious, though.

Any ideas?

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #1 on: March 11, 2013, 07:13:57 am »
Yes, JSFML unpacks the DLLs itself and putting them in the working directory will not help.
From your post I gather that they have actually been extracted to "C:\Users\Kids\.jsfml\windows_x64\" ? (7 dll files, accompanied by an MD5 file each)

The error message is "Can't find dependent libraries" - I have a feeling that you might have missed one requirement: on Windows, you do require the "Microsoft Visual C++ 2012 Redistributable Package". Since you seem to be running a 64-bit system, here's where you can grab that package:
http://www.microsoft.com/en-us/download/details.aspx?id=14632

I forgot to put this information into the readme, I will add it later today. Currently, it's "hidden" on the Github page.  :-[

I hope this resolves your problem.
JSFML - The Java binding to SFML.

chessguy

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #2 on: March 11, 2013, 04:58:20 pm »
Ah. That did the trick - neat demo, also. The drop from 60-63 to 55 only occurred at about 1000 entities.

Anyway, I had thought that most things branded within VisualC++ were Windows only. You say if you are on windows, though, which seems to imply it is not the case elsewhere. If I were to distribute this, what would I need to include with it?

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #3 on: March 12, 2013, 06:19:34 am »
Ah. That did the trick - neat demo, also. The drop from 60-63 to 55 only occurred at about 1000 entities.
I'm currently working on some major performance improvements, so that number might in fact be twice that soon. :)

Anyway, I had thought that most things branded within VisualC++ were Windows only. You say if you are on windows, though, which seems to imply it is not the case elsewhere. If I were to distribute this, what would I need to include with it?
For Windows, indeed, the Visual C++ redistributable is required. Many clients will already have it installed as many games ship with it. I will look into avoiding the dependency, but I have a feeling that it would increase the size of the DLLs a lot.

Linux users will require nothing but Java 7 - hopefully!
libjpeg and libGLEW are linked statically (= included in JSFML) because they have caused me quite a few headaches with certain distributions. The other dependencies (e.g. libpng, zlib, libgl) should be available on any common Linux client. On some distributions, it's not that easy to acquire Java 7 (by "easy" I mean a standard software update via the distribution's repository).

Linux, in general, is still a large question mark, mainly because there are so many distributions and I'm not the greatest of experts. On the "main" distributions out there, which I consider Ubuntu and Linux Mint, JSFML works out of the box.

Mac users should not require any additional packages either, however, I cannot test the Mac version myself. What I do know is that developers need to provide a starting script for Mac users, because on Macs, the JVM needs to be started with the "-XstartOnFirstThread" option. Apple is to blame here, there is nothing that I know that JSFML can do.
JSFML - The Java binding to SFML.

chessguy

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #4 on: March 12, 2013, 03:11:53 pm »
Double? That would be impressive.

I think I have seen people do that, come to think of it. Would you recommend following suit and including it in there somewhere? Also, what function does it serve in this case?

For Linux, would you recommend also including those other libraries? My main concern here is, I don't want there to be an error that cannot be fixed, say if the application cannot start, it cannot report an error, either, but they don't know why - OR, Linux users are used to it and just add it at download and/or in a readme.

Read about that, yes. Although... I had thought double clicking jars (on windows, not sure about mac), does not do it - opens it as text. Setting default program, perhaps. Anyway, is there any good cross platform way to detect the java installation ( jre) directory? I would go java -jar somejar.jar, but that only works with java on the path.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #5 on: March 13, 2013, 08:30:45 am »
I think I have seen people do that, come to think of it. Would you recommend following suit and including it in there somewhere? Also, what function does it serve in this case?
If you are actually shipping a game, you might as well include it in your release package.

What function it serves is not 100% clear to me, that's why I will look into avoiding the dependency. My best guess is that the dependency is caused by some Visual C++ default setting. Instead of statically linking certain functionality, it is linked dynamically. The result is a smaller dll file which, however, depends on those Visual C++ runtimes.

For Linux, would you recommend also including those other libraries? My main concern here is, I don't want there to be an error that cannot be fixed, say if the application cannot start, it cannot report an error, either, but they don't know why - OR, Linux users are used to it and just add it at download and/or in a readme.
"Those other libraries" are most likely already present on most (updated) Linux clients. I only encountered problems with libGLEW (of which there are many different versions around) and libjpeg (because distributions like Fedora only know libjpeg-turbo) (note that in the current test release, they are not included because of a little mistake I made).

In case the other dependencies are not available, users will have to download them. It's not possible for you to include them I fear, most distributions only allow proper installation of things via their package manager. Your best guess is to include a list of dependencies which users need to make sure they have. The next JSFML test release will include those dependencies in the readme file.

Users do still get an error message, though. It would look similar to yours, and that is reportable. Besides, errors can also be caught on a Java level. If you wish to do that, the first thing you should do before using any JSFML objects in your application is this:
try {
    SFMLNative.loadNativeLibraries();
} catch(JSFMLError err) {
    //report the error into a log file, display a message dialog, whatever
}
 

That method is automatically executed anytime a "native" object is created. If you do it manually, you have the ability to catch any errors that occur.

Read about that, yes. Although... I had thought double clicking jars (on windows, not sure about mac), does not do it - opens it as text. Setting default program, perhaps. Anyway, is there any good cross platform way to detect the java installation ( jre) directory? I would go java -jar somejar.jar, but that only works with java on the path.
Double-clicking on JARs is a windows feature IIRC. On Macs, I have no idea, but most Linux systems will detect the JAR file as a zip and open it with an archive editor by default.

From waht I know, wherever Java is installed, "java" is on the classpath, so doing "java -jar game.jar" should be safe anywhere.
JSFML - The Java binding to SFML.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4328
    • View Profile
    • Email
Re: Attempt running jsfml-test.jar, UnsatisfiedLinkError
« Reply #6 on: March 15, 2013, 10:40:17 am »
Quote
On Macs, I have no idea, but most Linux systems will detect the JAR file as a zip and open it with an archive editor by default.
On mac it will run the java app. However, with JSFML it won't work because we have to add -XstartOnFirstThread to the launch arguments..
SFML / OS X developer

 

anything