Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to add a jar file in classpath?

 
harish kshatrea
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
harish kshatrea
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just did that, and it works!
I guess I got to start paying more attention.
Thank you so much, Freddy!

Cheers,
Harish.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic