Take the 2-minute tour ×

I put together a program that uses JACOB to access iTunes ... It works fine in Eclipse but when I export it and run it in the command prompt I get an unsatisfied link error telling me that jacob-1.17-M2-x86.dll is not in my java.library.path.

Ive tried putting it in system32, setting the native library location to its directory...ive tried using the system.setproperties trick...and i couldnt figure out how to use java -d properly

What else can I do? ive been searching the web trying to get this compatible for over 4 hours and nothing seems to work.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I found an amazing post by a sun programmer that fixed my problem!

public static void addDir(String s) throws IOException {
    try {
        // This enables the java.library.path to be modified at runtime
        // From a Sun engineer at http://forums.sun.com/thread.jspa?threadID=707176
        Field field = ClassLoader.class.getDeclaredField("usr_paths");
            if (s.equals(paths[i])) {
        tmp[paths.length] = s;
    } catch (IllegalAccessException e) {
    } catch (NoSuchFieldException e) {

Then I added before my use of the JACOB methods

addDir("C:" + File.separator + "java" + File.separator + "jre7" + File.separator + "lib")

Worked like a charm.

share|improve this answer
add comment

Your Answer


