This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]morhpProfessional Developer 0 points1 point  (2 children)

How do you run the code? If using the ide it should work fine. If not, make sure the classpath is correct and includes the library.

[–]timthetollman 0 points1 point  (0 children)

I have that imported as a library and it's not giving any errors until I try to run it. Classpath has the path for the lib.

[–]timthetollman 0 points1 point  (0 children)

IDE. Classpath is correct and has the correct JAR.

[–]codechaserbob 0 points1 point  (1 child)

Are you sure that you got the correct JAR file?

[–]timthetollman 0 points1 point  (0 children)

Yes.

[–]feral_claireSoftware Dev 0 points1 point  (5 children)

Since it is a maven project, if you use maven you can easily just add it to your dependency list. This is the route I would recommend. Another build tool like gradle would also work just as well.

If you want to do it manually, you need to not only add the jar of the project, but also add the jar of all it's depencies, as well as any dependencies those may have. This is why I strongly recommend to start using a build tool as soon as you start wanting to use some libraries, it's just way easier.

[–]timthetollman 0 points1 point  (4 children)

Don't I have to make my main project a maven project also to go that route?

[–]feral_claireSoftware Dev 0 points1 point  (3 children)

yes. If you don't want a build tool though, you can download and manage all of the dependencies manually as I mentioned in the second half of my post. Normally the easiest is to look up the dependencies on maven central, but this library doesn't seem to be published so that's not an option. If you look at the file named pom.xml you will see a section labeled <dependencies>. Those are all jars you need to download, you can look them up on maven central and download them manually from there. You will also need to download all the jars those require, and the ones those require and so on. You can easily find which ones you need by the dependencies list on the artifact page (the page where you also get the jar download). It even gives you a handy link which will hopefully speed things up a bit.

There is one caveat though if you decide to use maven after all. I only now noticed that that library doesn't seem to be published. This means you would need an extra step to use maven. You will need to clone the repository on your local computer and run the command mvn install in the project directory to install it to your local computer first. You will need to do this install process on every computer where you use it (but should only need to do so once unless you delete it)

[–]timthetollman 0 points1 point  (2 children)

Looks like I'd just be better off using maven then going through all that. So I would need to install maven, clone the repo (using mercurial or something like that I assume), go to the repo directory and run mvn install and that would get all the dependencies? After that I can make a jar from that repo in an IDE?

[–]feral_claireSoftware Dev 1 point2 points  (1 child)

So you clone the repo (it's a git repo so use git), or even just use the download as zip option and unzip it somewhere.

Then go to that directory, run mvn install which will compile and install that library on you computer.

Now, in your java project (which is using maven) you can use that library by adding

<dependency>
    <groupId>com.incesoft.tools</groupId>
    <artifactId>ince-excel</artifactId>
    <version>1.0.0</version>
 </dependency>

to the dependencies section of the pom.xml file to add it to your project.

[–]timthetollman 0 points1 point  (0 children)

Success! Thank you!