Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:27:53+00:00 2026-06-15T18:27:53+00:00

i see this question has been posted many times but it has been solved

  • 0

i see this question has been posted many times but it has been solved with adding
-Djava.library.path="./path" to the VM runtime options.

I have to build an app in JAVA which uses the JNotify classes.

this is the sample code:

package test;

import net.contentobjects.jnotify.JNotify;
import net.contentobjects.jnotify.JNotifyListener;

/**
 *
 * @author 
 */
public class Test {

    public void jnotifydemo() throws Exception {
    // path to watch
    String path = System.getProperty("user.home");

    // watch mask, specify events you care about,
    // or JNotify.FILE_ANY for all events.
    int mask = JNotify.FILE_CREATED
        | JNotify.FILE_DELETED
        | JNotify.FILE_MODIFIED
        | JNotify.FILE_RENAMED;

    // watch subtree?
    boolean watchSubtree = true;

    // add actual watch
    int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());

    // sleep a little, the application will exit if you
    // don't (watching is asynchronous), depending on your
    // application, this may not be required
    Thread.sleep(1000000);

    // to remove watch the watch
    boolean res = JNotify.removeWatch(watchID);
    if (!res) {
        // invalid watch ID specified.
    }
    }

    class Listener implements JNotifyListener {

    public void fileRenamed(int wd, String rootPath, String oldName,
        String newName) {
        print("renamed " + rootPath + " : " + oldName + " -> " + newName);
    }

    public void fileModified(int wd, String rootPath, String name) {
        print("modified " + rootPath + " : " + name);
    }

    public void fileDeleted(int wd, String rootPath, String name) {
        print("deleted " + rootPath + " : " + name);
    }

    public void fileCreated(int wd, String rootPath, String name) {
        print("created " + rootPath + " : " + name);
    }

    void print(String msg) {
        System.err.println(msg);
    }
    }

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

    public static void main(String[] args) throws Exception {
    System.out.println("Hello World");
    new Test().jnotifydemo();
    }
}

When i run this i get:

Error loading library, java.library.path=C:\Program Files\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;(continues)
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnotify in java.library.path

I have setup a Netbeans project and added the JAR file to the project so that the JAR is correctly in the lib/ folder of my project and everything is set in NETBEANS.

This correctly works if is setup the -Djava.library.path="./path" argument of the java VM, but if i imported my lib in NETBEANS that should be included in the path automatically.

I am doing something wrong or it is necessary to put every .jar in the classpath system variable? I would like to release this app so it can run on other systems that does not have JNotify in their libs.

Thanks

I am using Netbeans 7.2 on Win 7 32Bit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:27:55+00:00Added an answer on June 15, 2026 at 6:27 pm

    You are messing java jar files as library which has to be added only in netbeans classpath:

    Simply in NetBeans on project properties click and adjust Library having your JAR file.

    Project Properties

    For the native libraries (so,dll,…) you need to have set: -Djava.library.path. As you did in your question.

    So you have 2 steps:
    1. from http://sourceforge.net/projects/jnotify/files/jnotify/jnotify-0.94/jnotify-lib-0.94.zip/download add jnotify-0.94.jar to your libraries as in picture above (this will update your classpath automatically)
    2. jnotify.dll, or jnotify_64bit.dll for 64-bit windows place is some directory and ad this to your -Djava.library.path – add this to VM option of the projects property

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can see this question has been asked many times before, but I just
This question has been asked many times before, but they all seem to relate
I know this question has been asked many times, but I have not been
This question has been asked few times here and there, but you see all
I know this question has been asked many times before, but I haven't found
I see that this question has been asked before but the context around the
I've noticed that this question has been asked several times but none of the
This question has been asked tons of times, however I don't see any answer
I realise this question has been asked 100 times, but i've looked through the
I see this question has been asked before, but I still trying to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.