We call here jar stripper, lol. 
But this one we´ve made ourselves and it is very specific for our situation.
However, basically you have to add a premain to your app and through
instrumentation you get the loaded classes:

public static void premain(final String agentArguments, final
Instrumentation instrumentation) {
                Runtime.getRuntime().addShutdownHook(new Thread() {
                        @Override
                        public void run() {
                                Class<?>[] allLoadedClasses =
instrumentation.getAllLoadedClasses();
                          // here you can work with your array as you wish.
Getting names or whatever.
                        }
                });
        }


Att,
José Rodolfo Carrijo de Freitas
Analista de Sistemas
Softplan - Departamento de pesquisa e desenvolvimento
Sistema da Qualidade Certificado ISO 9001:2008
(48) 3027 8000 Ramal 8359
http://www.softplan.com.br


-----Mensagem original-----
De: José Rodolfo Carrijo de Freitas [mailto:[email protected]] 
Enviada em: sexta-feira, 3 de setembro de 2010 16:22
Para: [email protected]; [email protected]
Assunto: RES: Building a smaller distribution.

You might want to build your applet first.
Then, create (probably there is some on the internet) a little app to see
what classes the classloader used.
Build your jar based on this information.

Att,
José Rodolfo Carrijo de Freitas
Analista de Sistemas
Softplan - Departamento de pesquisa e desenvolvimento
Sistema da Qualidade Certificado ISO 9001:2008
(48) 3027 8000 Ramal 8359
http://www.softplan.com.br

-----Mensagem original-----
De: [email protected] [mailto:[email protected]] Em nome de
Grant Overby
Enviada em: sexta-feira, 3 de setembro de 2010 15:40
Para: [email protected]
Assunto: Building a smaller distribution.

We're looking to use PDFBox in an applet; however, its large size isn't
appealing. We don't need many of the features or languages, so we're
thinking of building it with only what we need.

Any pointers on what to remove?

--
Grant Overby
Senior Developer
FloorSoft, Inc.

Often people, especially computer engineers, focus on the machines. They
think, "By doing this, the machine will run faster. By doing this, the
machine will run more effectively. By doing this, the machine will something
something something." They are focusing on machines. But in fact we need to
focus on humans, on how humans care about doing programming or operating the
application of the machines. We are the masters. They are the slaves. --
Yukihiro Matsumoto

Reply via email to