Reputation: 590
I've downloaded a new api for Java that accesses excel files, but am unsure on how to install it so that it can be imported for use in my program. Help is appreciated. Thanks
Upvotes: 3
Views: 193
Reputation: 1109292
To the point: just put it in the classpath.
A classpath is basically a collection of disk file system paths to a root folder where all classes are located like /path/to/package/root
and/or paths to the JAR file itself like /path/to/file.jar
. You can specify multiple paths in the classpath by a separator character. In Unix based systems like OS X the separator character is the colon :
(on Windows it's the semicolon ;
).
How and where to specify the classpath depends on how you're compiling and executing the program.
If you're using plain javac
to compile the program, then use the -cp
argument to specify the compile time classpath. Or if you're using an IDE, then add it to the project's Build Path (which covers both the compile time and runtime classpath).
If you're using java
to execute the program as a simple .class
file, then use the -cp
argument the same way. If you're using java -jar
(or doubleclicking the file in some platform specific UI explorer) to execute the program as an executabele .jar
file, then you need to specify it in Class-Path
entry of the JAR's MANIFEST.MF
file. This one can be relative to the JAR file's location.
Upvotes: 5
Reputation: 24272
That depends on the tools you are using for development. Basically it will have to be included on your classpath for your IDE project for development, and in your runtime classpath at deployment time.
How to accomplish this in development is specific to your project configuration, IDE and how you store dependent jar files in your development environment (i.e. shared lib directory, maven, project lib folder ...).
Upvotes: 1
Reputation: 45578
You don't really have to "install" it - you just have to put it inside the Classpath. For example, if you're using Eclipse, you can right-click on your project, select something like "build path"->"configure build path", then libraries.
Upvotes: 1