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

Author Topic: NetBeans + jSFML, linker error at first project  (Read 6717 times)

0 Members and 1 Guest are viewing this topic.

cx3

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
NetBeans + jSFML, linker error at first project
« on: January 19, 2014, 07:14:02 am »
Hello :) I am new here. From time to time i write a little app in C++ using SFML and this library is really great!

Because i started to learn Java recently, i decided that it would be great idea to create an applet which uses jSFML. I downloaded NetBeans, run it and configured as it is written in tutorial at https://github.com/pdinklag/JSFML/wiki .The first step, setup, brought me some troubles that i resolved with Google. I created a catalog "c:\java"  where i put all my projects in separated catalogs. With NetBeans i created new java project, and set up the classpath to jar file (c:\java\Game\lib\jsfml.jar). I tried all three enabled options with RadioButtons (relative path / copy libraries, absolute path), i found also various proposals of adding another params for "run" category - i've been trying to compile source code for about eight hours with one big fail :)

Windows XP, SP3

Game.java
package game;

import org.jsfml.graphics.RenderWindow;
import org.jsfml.graphics.*;
import org.jsfml.audio.Music;
import org.jsfml.window.VideoMode;
import org.jsfml.window.event.Event;

import java.io.IOException;
import java.nio.file.Paths;


public class Game {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) {
       
        RenderWindow window = new RenderWindow();
        window.create(new VideoMode(640, 480), "Hello JSFML!");

        //Limit the framerate
        window.setFramerateLimit(30);

        //Main loop
        while(window.isOpen()) {
            //Fill the window with red
            window.clear(Color.RED);

            //Display what was drawn (... the red color!)
            window.display();

            //Handle events
            for(Event event : window.pollEvents()) {
                if(event.type == Event.Type.CLOSED) {
                    //The user pressed the close button
                window.close();
                }
            }
        }  
    }
   
}

 

and linker errors:

run:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Documents and Settings\cx3\.jsfml\windows_x86\sfml-system-2.dll: Can't find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at org.jsfml.internal.SFMLNative.loadNativeLibraries(Unknown Source)
        at org.jsfml.internal.SFMLNativeObject.<init>(Unknown Source)
        at org.jsfml.window.Window.<init>(Unknown Source)
        at org.jsfml.graphics.RenderWindow.<init>(Unknown Source)
        at game.Game.main(Game.java:26)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
 

I saw several similar topis to mine, but none of them gave any explanation what is going wrong.
I am beginner in Java so i please for forbearance :)

Greetz

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Re: NetBeans + jSFML, linker error at first project
« Reply #1 on: January 24, 2014, 08:35:02 am »
Sorry for the late reply, I'm not really sure about what's wrong here.

Did you check the directory it's refering to? C:\Documents and Settings\cx3\.jsfml\windows_x86\ ?
It should contain 14 files, DLLs and MD5s.

If so, the message seems to suggest that there's actually something missing on your system. Do you have the Microsoft Visual C++ 2010 Redistributable Package installed? It is required, but I'd expect the message to be different.
JSFML - The Java binding to SFML.