views:

279

answers:

2

I'm trying to use the JNotify library along with netbeans, however I don't know the proper way to configure it. Everything I try, the lines involving jnotify (eg. import net.contentobjects.jnotify.*) are underlined in red. Google seems to show nothing helpful regarding netbeans with jnotify, although I assume it's something simple like adding it to the classpath. I've tried adding the .jar as a library for compile & for run, no go.

The line i've been provided for running my app from the jnotify page:

-cp jnotify.jar -Djava.library.path=.

should I be using this as my compiling options or VM run options or both? seeing as I don't want to have to distribute my app with a .dll or .so file or the jnotify .jar.

Everyone on this site recommends using such and such a library, but they don't realize how hard they can be to set up (jnotify,boost,curl), and most who recommend them have probably never even used them themselves.

A: 

There definately is something wrong with your classpath. While the above is exactly how you set the classpath when running a Java program, its different for a NetBeans project.

Follow these articles on how to add extenal jars to a NetBeans project.

n002213f
+1  A: 

You're right, you have to add every library you use in your programs, into the projects classpath:

  1. Click on the project node in your 'Projects' window. It should by default have a node called 'Libraries'.
  2. Right click this node and select 'Add JAR/Folder'
  3. Locate the JNotify.jar on the file dialog and press 'Open'.
  4. Refresh your project, or just give netbeans some time to rescan the classpath, and you should be good to go.
Steen