db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: Derby : No suitable driver found for jdbc:derby:db;create=true
Date Tue, 30 Nov 2010 14:39:10 GMT
>   java -classpath :/home/user/app/lib/*:/home/user/app/shared/
>
> Do I have to change this? I thought I already set it up properly :\ as you
> can see in the classpath there's the path to derby (inside the lib folder),
> maybe the " * " part is wrong. You think i need to specify the complete path
> .../lib/derby.jar or using the "star" works?

Yes, sorry, I didn't pay close enough attention to that the first time.

I rather doubt that the asterisk is doing what you expect it to. What happens
when you try

    echo :/home/user/app/lib/*:/home/user/app/shared/

I suspect that your shell (which may be is doing the asterisk expansion) is
probably not finding any matches, and so it is probably not expanding the
asterisk in the manner you desire.

    echo /home/user/app/lib/*

probably works fine, of course, but that's not what the shell sees.

In JDK 1.6, Sun added some wildcard support to classpath variables, but I've
never got it to work because it's rather picky about the syntax. See:
http://download.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

In my projects, I always specify the full classpath explicitly, using full
absolute jar names, because that's what works for me. I often write small
scripts to do the setup and to manage switching from one configuration to another,
but when I run a Java program, it's with a complete classpath that is explicit
and that I fully understand. Not only does it make the behavior more reliable,
it seems less likely to be subject to security problems (loading classes from
places I didn't expect).

To make things simpler, Derby's JAR files are bound together internally, using
the Manifest mechanism, so if you simply specify the full classpath to derbyrun.jar,
then derbyrun.jar will internally reference all the other Derby JAR files from
the same directory, so that makes it easy to add a single JAR reference to your
classpath and get all the Derby jars loaded.

So I suggest changing your classpath argument to specify the full name of
derbyrun.jar in place of the asterisk, and see if that improves the behavior.

thanks,

bryan

Mime
View raw message