tags:

views:

83

answers:

2

I have a Java project I'm working on, and wish to include a directory full of classes. These are the "JEdit Syntax" classes, and come within two packages:

org.syntax.jedit
org.syntax.jedit.tokenmarker

However, everywhere I look it tells me to "import the entire jar file". My problem is that there is no jar file, just a directory with a subdirectory, both filled with *.java files, each containing a class.

In Netbeans 6.5 I added a library by "Jar/Folder", and both appear in my new library I created, but when I go to import the two packages listed above, I get the error that "org.syntax.jedit does not exist (cannot find symbol)".

Can anyone show me what I'm doing wrong?

Thanks a ton.

+3  A: 

It sounds like you have tried to add the two packages to your classpath seperately - and at the wrong level. If you are pointing at a folder, you have to point to the "root" folder of the package hierarchy - ie in this case the folder which is the parent of "org" Then from there it will look down the package/folder hierarchy org/syntax/jedit to find your classes.

So if your files are in the directory "c:\mylib\src\main\java\org\syntax\jedit" then you need to point the compiler folder at "c:\mylib\src\main\java". That should then find all the classes.

evnafets
A: 

I agree with evnafets, you probably added the org directories, but you should have added the directory that contains them. You can also build a jar out of those directories easily if there is an ant file (build.xml).

Vasil