Noob Java Libraries Reference Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Noob Java Libraries Reference Question

Reg65
Hello,

I've been using Netbeans with PHP for a very long time but I have a need to venture into Java, mainly because I have a need to use Drools.

I've downloaded Drools in two ways, one was their final distribution called "Drools Distribution 6.5.0" in the 1st image, the other was the source code in git called "Drools Multiproject" in the 1st image. This git version compiled successfully (with git set to version 6.5.0 release, not HEAD and some system changes like installing a newer version of Maven).

My project will be called DiycsServer which is empty at this time except for the main file that NB creates for you when setting up a new Java project.

Once I added the libraries from "Drools Distribution 6.5.0" (2nd image shows how that looks) to my DiycsServer I expected to be able to see the classes when I did an
Code:
import org.

 but there is no "drools" on the drop down as I expected. The options I get are
Code:
classpath, ietf, jcp, omg, w3c & xml

 which I'm guessing are just Java/netbeans basic defaults.

Could someone please tell me how do I get the Drools class paths
Code:
org.drools.

 to show up in code so NB knows them in my new project?

I know this is almost certainly a complete novice question and any help is greatly appreciated.

Thanks,
Reg




Attachments:
http://forums.netbeans.org//files/added_libraries_197.png
http://forums.netbeans.org//files/projects_295.png

Reply | Threaded
Open this post in threaded view
|

Noob Java Libraries Reference Question

tkellerer
You only added the sources, you need to add the binaries.

Essentially all jar files under drools-distribution-6.5.0/binaries

You can attach the source jars to those jar so that you can navigate into the sources.

If you will use that in multiple projects, it's better to create a global library for drools. using "Tools -> Libraries", create a new library and add all the jars from the drools "binaries" directory to that library.

Then in your project add the Library not each jar file individually.




Attachments:
http://forums.netbeans.org//files/global_library_539.png
http://forums.netbeans.org//files/sources_370.png
http://forums.netbeans.org//files/libraries_200.png

Reply | Threaded
Open this post in threaded view
|

Noob Java Libraries Reference Question

Reg65
In reply to this post by Reg65
Thanks for this, a lot. It worked but I have a couple of questions left...

Can some discretion be used in adding these libraries or should be just add them all? For example, all the "maven-*.jar" files, I'm not sure what value there would be in adding these - they are just project management files I as far as I understand, not really code to reference and run.

All the "drools-*.jar" should probably be added and the rest I am not sure.

Also, when I first added the Drools, instead of picking each individual jar file I just added the binary folder. This didn't work as there were still no hints when typing "import org." Why is that? It just seems to me that adding the folder would be a shortcut way of adding all the .jar files in the folder but obviously there is a difference.




Reply | Threaded
Open this post in threaded view
|

Noob Java Libraries Reference Question

tkellerer
In reply to this post by Reg65

Reg65 wrote:
> Can some discretion be used in adding these libraries or should be just add them all?
You need them all if I'm not mistaken.


> Why is that? It just seems to me that adding the folder would be a shortcut way of adding all the .jar files in the folder but obviously there is a difference.
This is unfortunately not possible in NetBeans (and is - I think - a result on how the classpath in Java works).