Results 1 to 14 of 14
Thread: Installing Java libraries
- 03-19-2010, 12:49 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 49
- Rep Power
- 0
Installing Java libraries
I'm writing a little application that will be required to read Excel spreadsheets, and so I've decided to use the JExcelAPI to accommodate that function.
When I compile and pack the application into an executable jar, will others be able to run it with only JVM installed on their computers? Or will they require JDK and/or JExcelAPI installed as well? The latter option would be pretty troublesome for the users, and I'd rather keep that as a last resort.
- 03-19-2010, 12:56 AM #2
the users would be able to work with a JVM runtime, not needing the JDK.
they will however also need the JExcelAPI jar file.
You can configure the manifest of your executable jar file to set the class path to include their jar file, this usually assumes the current working directory at the time the executable jar file is launched is that where the jar file is and the jexcel api is in the same or well known relative location relative to your executable jar file.
or create a batch file or shell script that would set up a command line or class path to include the required jar files and invoke the main() in your jar.
- 03-19-2010, 01:02 AM #3
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Your users will definitely need the jExcelApi JAR file(s). Is this an in-house project, or something you're selling, or developing on contract, or what? The reason I ask is because jExcelApi is GPL, and if licensing is a consideration you may prefer to use the Apache-licensed POI library.
-Gary-
- 03-19-2010, 08:08 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think Apache POI is much better, both in the performance/processing as well as with the licensing stuff for commercial aspect. Actually you can include those required additional libraries with the package. Then no nee to ask from user to download and do mess-up things. But you have to care of configuring those things properly, means that setup the classpath for all JARs.
- 03-19-2010, 11:29 AM #5
what's about to but additional jars in ..\lib\ext of java? shouldn't these jars be found by default?
- 03-19-2010, 12:42 PM #6
yes it is. i found an answer on my question here How Classes are Found
- 03-19-2010, 11:13 PM #7
Member
- Join Date
- Dec 2008
- Posts
- 49
- Rep Power
- 0
I've considered Apache POI as well, but I'd like to give JExcelAPI a try as it seems a tad bit simpler to use. Anyway, I've copied the package over to lib/ext/ and have also imported the package successfully with import jxl.*, but I'm unable to run any of the example code. The code Workbook workbook = Workbook.getWorkbook(new File("test.xls")) compiles fine, but generates the following runtime error.
Java Code:Exception in thread "main" java.lang.NoClassDefFoundError: jxl/Workbook at demo.main(demo.java:10) Caused by: java.lang.ClassNotFoundException: jxl.Workbook at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:264) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332) ... 1 more
Last edited by DC200; 03-20-2010 at 12:35 AM.
- 03-20-2010, 11:48 PM #8
Member
- Join Date
- Dec 2008
- Posts
- 49
- Rep Power
- 0
- 03-20-2010, 11:53 PM #9
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
You might consider re-posting in a different forum (maybe Other APIs?) under a different title. You might get a look from people who know the jExcelAPI library that way. Let them know that it's a cross-post from here, of course.
-Gary-
- 03-21-2010, 01:26 AM #10
Member
- Join Date
- Dec 2008
- Posts
- 49
- Rep Power
- 0
Posted new thread: http://www.java-forums.org/database/...tml#post110330
Found a temporary solution shortly afterwards. :)
- 03-21-2010, 01:39 AM #11
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
Are you using an IDE? I know some of the gurus here recommend plain text editors and manual compile tools while you're learning, and I understand their reasons, but you might want to check out Eclipse and the short tutorial here: Eclipse and Java for Total Beginners It's for an older version of Eclipse, but everything still applies with perhaps a few very minor changes. The reason I bring it up is because an IDE like Eclipse can dramatically simplify things like including external JARs.
-Gary-
- 03-21-2010, 05:04 AM #12
Member
- Join Date
- Dec 2008
- Posts
- 49
- Rep Power
- 0
No, I'm not using an IDE at the moment. Do they also simplify the creation of executable jar files with libraries automatically added to the manifest?
- 03-21-2010, 05:06 AM #13
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
- 03-21-2010, 05:58 AM #14
NetBeans can create a dist folder with a lib subfolder that holds all your linked jars, and a manifest file with all needed information. All you have to do is distribute the entire contents of the dist folder ... heck, the IDE even creates a README.txt that tells you so.
That said, it would be a good idea to go through the jar deployment tutorial so you understand the output of the IDE.
Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)
db
Similar Threads
-
Installing a new Java Package
By tyang in forum New To JavaReplies: 8Last Post: 02-24-2010, 05:22 PM -
Need Help installing java - can you help me?
By Menre in forum New To JavaReplies: 4Last Post: 02-22-2010, 12:33 PM -
Java Media Libraries
By SilentCodingOne in forum Advanced JavaReplies: 2Last Post: 07-04-2009, 05:21 AM -
Java 3D Scene Graph Libraries
By sweeyt in forum AWT / SwingReplies: 1Last Post: 04-10-2009, 08:26 AM -
Installing Java
By Adv3nt in forum New To JavaReplies: 3Last Post: 12-12-2007, 11:29 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks