Home > Archive > Java Help > October 2004 > Adding Classpath on the fly?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Adding Classpath on the fly?
|
|
| R. Russell Kinter 2004-10-07, 4:00 am |
| Hi,
Let's say you have an application main class that loads
a text file that lists any number of different classes
you want to use at load time. But only one class can loaded
per session. So there would be a seperate text file for each class.
Each class resides in its own different jar.
Can a classpath be given in the text file with the class
so its jar can be pointed to?
So in essense a classpath is added on the fly,
instead of listing all the different but useless
(for that particular session) classpaths in
the .bat file.
Is this possible?
thanx
Russ Kinter
| |
| Andrew Thompson 2004-10-07, 4:00 am |
| On 6 Oct 2004 21:28:33 -0700, R. Russell Kinter wrote:
> So in essense a classpath is added on the fly,
> instead of listing all the different but useless
> (for that particular session) classpaths in
> the .bat file.
> Is this possible?
Ehhh? Why do you even have a 'classpath' in your
..bat file. Sun recommends you set the classpath
per application when you run it. Part of the reason
being to ensure you do not end up putting the entire
file system into the Java classpath.
--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
| |
| Tor Iver Wilhelmsen 2004-10-07, 4:00 am |
| Pyth7@comcast.net (R. Russell Kinter) writes:
> Is this possible?
Yes, write your own ClassLoader.
Of course, you could use a different mechanism that solves the ACTUAL
problem without resorting to that workaround, using e.g.
Class.forName().
| |
| Real Gagnon 2004-10-08, 3:57 am |
| Pyth7@comcast.net (R. Russell Kinter) wrote in
> So in essense a classpath is added on the fly,
> instead of listing all the different but useless
> (for that particular session) classpaths in
> the .bat file.
> Is this possible?
See http://www.rgagnon.com/javadetails/java-0409.html
Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB snippets ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
|
|
|
|
|