Results 1 to 12 of 12
  1. #1
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default Project works in debugger, not after compiling

    Hi people,

    I'm working on a project that i got from the internet and which I need to modify to my needs.
    The project contains 2 jar files that need to be set in the libraries.
    The project works fine in the netbeans debugger, but when I compile it it returns the following error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: be.belgium.eid.eidlib
    JNI.new_BEID_ID_Data()J
    at be.belgium.eid.eidlibJNI.new_BEID_ID_Data(Native Method)
    at be.belgium.eid.BEID_ID_Data.(BEID_ID_Data.java:141 )
    at eid.Main.main(Main.java:20)
    The 2 jar files are copied into a lib subdirectory.

    Apparently something is wrong with the libraries, but I can't seem to figure out what. I found some dll's in the windows system32 directory that are likely to be used by the program. I copied them both to the jar file's folder and the lib subdirectory, but no luck there

    Googling thought me that i need to set the java_library_path but I'm not sure how to do this in netbeans.

    java -jar "eid.jar" -Djava.library.path="lib"
    did not help either

    Can anyone point me in the right direction?

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you tel me the exact folder structure of dist folder. If you are working on NetBeans there is a folder name dist inside the working folder.

  3. #3
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default

    hi,

    projectfolder
    \_build
    \_dist
    ---\_lib

    \_nbproject
    \_src
    \_test

    nothing else

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Ok, inside lib you should have all libraries refer in your project. And also main executable jar file should be inside the dist and outside of the lib. Is that right?

  5. #5
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default

    this seems to be the case, however, in the meantime i have found that the jar files in the lib use dll's that are in the windows system32 directory.
    I tried copying these files in the lib and in the dist folder.
    I tried loading them into the program by using in the source code the line:
    Java Code:
    System.loadLibrary("my.dll");
    Nothing works...

    Very strange since things just work inside netbeans...

  6. #6
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    7

    Default

    Probably you should specify a class path when you try to run?
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you find manifest file of your project. Check there from where those dll files are linked. Normally those details are included in manifest file.

  8. #8
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default

    still no luck with this

    manifest file:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 10.0-b19 (Sun Microsystems Inc.)
    Main-Class: eidlibtest.Eid
    Class-Path: lib/beidlib.jar lib/eidlib.jar
    X-COMMENT: Main-Class will be added automatically by build

    nothing there about the dll's

    System.getProperty returns the windows/system32 directory where the dll's are located.

    Actually this is in the code:

    Java Code:
      static
      {
        try
        {
            System.loadLibrary("beidlibjni");
        }
        catch (UnsatisfiedLinkError e)
        {
          System.err.println("Native code library eidlib failed to load.\n" + e);
          System.exit(1);
        }
      }
    I don't get the catch message (if I change the name of the dll that is to be loaded, I do), so I'm guessing this is not the problem.
    However, further on in the code when a function of the dll is actually called, I get the error
    man, this is bugging me!

  9. #9
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default

    okay, update: it just works on another PC!
    no idea why, anyone any thoughts?
    can't seem to find a difference in the system.getProperties();

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Ok, if on one system it's working, are you sure that on the previous system has that dll in correct place.

  11. #11
    Fleur is offline Member
    Join Date
    Apr 2008
    Posts
    19
    Rep Power
    0

    Default

    yes, I checked everything.
    In fact the dll's are copied when installing another application

    It is very strange: as I said: the loadlibrary does not generate an error
    I even tried to put in a not existing dll to see if it would go to the catch statement, and it does

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. Help with debugger!!
    By anatel24 in forum New To Java
    Replies: 1
    Last Post: 04-07-2008, 03:01 AM
  2. How DataSource Concept works in Spring Framework
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 04-01-2008, 10:40 AM
  3. How DataSource Concept works in Spring Framework
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-28-2007, 12:58 PM
  4. Error during compiling
    By boy22 in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 02:42 AM
  5. JSwat Java Debugger 4.2
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-19-2007, 08:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •