hi
first thank you for the insights. I did not realise that the wildcard
was expanded by the shell. I thought this was handled by java itself.

However in my instance the jvm is not being created by a shell but by
a JNI wrapper. Originally this JNI wrapper included myDir/lib/*.jar in
the classpath setting - this caused
org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance to attempt
to unzip a file of myDir/lib/*.jar - and caused a
FileNotFoundException.

in response to your update I changed the wrapper to navigate through
myDir and construct a classpath containing every jar (approx 100
files). This enabled the embedded Tomcat instance to resolve all
referenced classes

thanks again
Dave Breeze
Linkedin:https://uk.linkedin.com/in/dabreeze

On Fri, 7 Jun 2024 at 15:02, Chuck Caldarale <n82...@gmail.com> wrote:
>
>
> > On Jun 7, 2024, at 08:11, Christopher Schultz 
> > <ch...@christopherschultz.net> wrote:
> >
> > On 6/7/24 01:49, Mark Thomas wrote:
> >> On 06/06/2024 18:48, Dave Breeze wrote:
> >>> Thanks Mark
> >>> appreciate that the url was for 8.0
> >>>
> >>> With regards to classpath that was my first attempt - unfortunately it
> >>> would seem that Tomcat does not support wildcards in the classpath -
> >>> for example dirpath/lib/*.jar - at least in version 9.
> >> The requirements for setting the class path are set by the JVM, not by 
> >> Tomcat. If you want all the JARs in a directory to be included in the 
> >> class path then you should add dirpath/lib/* to the class path.
> >
> > I think you'd have to specifically mention every .jar file in that 
> > directory in the classpath, right? I've never known Java to bother 
> > resolving glob patterns on its own. This is usually the responsibility of 
> > the command shell.
>
>
> As Mark stated, you can use an asterisk appended to a directory path in the 
> CLASSPATH value to add all of the jars in that directory to the classpath. 
> (It’s been that way since Java 6.) This works even without shell expansion. 
> For example,
>
>     java -cp mylib/* ClassName
>
> does use shell expansion, but will fail if there is more than one file in 
> mylib, since the shell doesn’t generate path separators.
>
> These constructs:
>
>     java -cp .:mylib/* ClassName        [works in bash, zsh will complain]
>     java -cp ‘mylib/*’ ClassName
>
> do not use shell expansion, since a Linux/UNIX shell is put off by the colon 
> or apostrophes.
>
>   - Chuck
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to