|
Hi Jon, Short of writing your own class loader, there is no way to have all jars in a directory searched via a simple directory entry in the classpath. As David mentions, you have to explicitly list jars on the classpath for the standard case. An alternative is to use the extension mechanism. You can just dump the jars in the ext directory. One issue is that IBM ( and lately Sun ) also use this directory. Also, depending on what you use, there may be issues with new JDK releases. You can use the system property "java.ext.dirs" to denote your own extension directory. The issue here is that the value *replaces* the standard java.ext.dirs, so if you just use your own, classes in the standard one will not be found. Therefore, you would always want to concatenate the standard ext dirs along with your own. Also, you can effectively only set java.ext.dirs with an arg to the java command; setting the property inside an application doesn't work to change the VM's notion of the ext dirs. Personally, I'd like to see a property like "user.ext.dirs" or allow java.ext.dirs to be changed ( and noticed by the VM ) internally in an app with a replace or add option. For V5R3 ( we have JDK 1.3 and 1.4 installed ), the java.ext.dirs property returns: /QIBM/ProdData/OS400/Java400/jdk/lib/ext: /QIBM/UserData/Java400/ext: /QIBM/ProdData/Java400/jdk14/lib/ext: There is also an /QIBM/ProdData/OS400/Java400/ext: directory, but since it is not part of the java.ext.dirs property I don't know if it is used or not. Notice this structure is different from the Sun standard, which is jre/lib/ext. HTH or at least clarifies things. Joe Sam Joe Sam Shirah - http://www.conceptgo.com conceptGO - Consulting/Development/Outsourcing Java Filter Forum: http://www.ibm.com/developerworks/java/ Just the JDBC FAQs: http://www.jguru.com/faq/JDBC Going International? http://www.jguru.com/faq/I18N Que Java400? http://www.jguru.com/faq/Java400 ----- Original Message ----- From: "David Gibbs" <david@xxxxxxxxxxxx> To: "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> Sent: Tuesday, March 08, 2005 10:22 PM Subject: Re: CLASSPATH > Jon Paris wrote: > > Can someone point me to the docs that define what can be specified in the > > CLASSPATH. I know I can specify multiple jar files by separating entries by > > a colon. But how do I set it up so that (for example) all jars in a > > specified directory will be searched. I can't find this info in the IBM > > docs. > > I don't think there's a way to specify that the classpath will consist > of all files in a specific directory. > > I've always had to write a script that cycles through all the candidate > files and adds them, one by one, to the classpath. > > david > --
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.