Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #29486
| From | Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: dealing with ClassLoaders... |
| Date | 2014-08-01 14:22 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnltn8l2.fp3.avl@login.logic.tuwien.ac.at> (permalink) |
| References | <slrnltl6t2.fp3.avl@login.logic.tuwien.ac.at> <lre9rv$mnu$1@dont-email.me> |
Martin Gregorie <martin@address-in-sig.invalid> wrote:
> On Thu, 31 Jul 2014 19:40:18 +0000, Andreas Leitgeb wrote:
>> All the classes of my app are principially loadable by the system's
>> default ClassLoader (i.e. they are in the java.class.path). Some Main
>> class (mypackage.Main) of my app will even be loaded, and this class
>> will then create a new Thread with a custom ClassLoader that is supposed
>> to load all the other used classes of my app's packages (while still
>> delegating loading of newly used system classes to its parent).
> This sounds similar to something I've done a couple of times now when I
> wanted to put a number of related but separate programs and their
> supporting classes into a jar file and then, at runtime, select the one
> to be run via the command line.
> The manifest Main-Class names single, top level launcher class. This is
> passed the name of the program to be run plus any options and arguments
> it needs via the argv[] array. The launcher class then does the following
> to launch the program:
[ snip ]
> public class MAClassLoader extends ClassLoader
> {
[ no snip ]
> }
> I hope this is useful info.
Yes, it was indeed useful information for me.
I hadn't realized, that ClassLoader already has all
the stuff in it. I feared the boring stuff (such
as obtaining byte[] out of jar-files) would be in
internal non-public classes.
I'll likely still override some of its methods, first, to make
sure that all other than my classes are still delegated to the
parent classloader, and second, to eventually cache the byte[]
definition of some of my classes that I need separately loaded,
but that will likely be used in many tasks at once.
In addition, I'll also pick the low hanging fruit among my
classes and un-static'ify or at least ThreadLocal'ize them so
I can have as many classes as possible loaded centrally.
Thanks a lot for your answer!
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-07-31 19:40 +0000
Re: dealing with ClassLoaders... Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-31 20:44 +0000
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-01 14:22 +0000
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-01 21:10 +0000
Re: dealing with ClassLoaders... Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-01 17:32 -0400
Re: dealing with ClassLoaders... Joerg Meier <joergmmeier@arcor.de> - 2014-08-02 01:21 +0200
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-02 00:00 +0000
Re: dealing with ClassLoaders... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-01 21:45 +0000
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-01 23:14 +0000
Re: dealing with ClassLoaders... Martin Gregorie <martin@address-in-sig.invalid> - 2014-08-02 00:35 +0000
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-05 15:38 +0000
Re: dealing with ClassLoaders... Silvio <silvio@internet.com> - 2014-08-01 13:31 +0200
Re: dealing with ClassLoaders... Silvio <silvio@internet.com> - 2014-08-01 13:37 +0200
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-01 16:06 +0000
Re: dealing with ClassLoaders... "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-08-01 13:19 +0100
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-01 15:51 +0000
Re: dealing with ClassLoaders... Josip Almasi <joe@vrspace.org> - 2014-08-01 15:55 +0200
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-04 15:12 +0000
Re: dealing with ClassLoaders... Mike Amling <mamling@chaff.us> - 2014-08-04 19:53 -0500
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-05 15:16 +0000
Re: dealing with ClassLoaders... Josip Almasi <joe@vrspace.org> - 2014-08-08 11:53 +0200
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-08 18:46 +0000
Re: dealing with ClassLoaders... Josip Almasi <joe@vrspace.org> - 2014-08-10 13:22 +0200
Re: dealing with ClassLoaders... Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-08-12 17:16 +0000
csiph-web