aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes How to add a jar file in classpath? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to add a jar file in classpath?" Watch "How to add a jar file in classpath?" New topic
Author

How to add a jar file in classpath?

harish kshatrea
Greenhorn

Joined: Nov 20, 2009
Posts: 14
This might seem like a silly question, but I've been feeling annoyed at not knowing what to do. I have imported a Maven project into Netbeans, and just purchased a commercial library for use (Incors' Alloy). I need to import the alloy.jar into my classpath. I installed it using the mvn install, but in Netbeans, a few java files that import the Alloy class give me a compilation error. I used to import jars into the Netbeans environment by just right clicking on project properties - Library -> and so on. But in this Maven project, no such option seems available! ANy ideas?
Much appreciated, thank you very much.

Harish.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Actually it's quite easy to do it in NetBeans. I'm assuming that you use NetBeans 6.7.x that has good Maven support.

I hope you've already included the Incors' Alloy dependency in the pom.xml.

To install the JAR:
1. Right click on that Incors' Alloy JAR icon (the icon will look blurry, which means you don't have the JAR in your local repo) on the library section of your project. 2. Click Manually Install Artificat.
3. Select your JAR and provide all the information required.

Alternatively, you can do it from command line to install the JAR, e.g.


Hope it helps.

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
harish kshatrea
Greenhorn

Joined: Nov 20, 2009
Posts: 14
Just did that, and it works!
I guess I got to start paying more attention.
Thank you so much, Freddy!

Cheers,
Harish.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add a jar file in classpath?