Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9664

Re: Finding classes used by Applet

Date 2011-11-06 15:16 -0500
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Finding classes used by Applet
References <Xns9F8AACF93F933jpnasty@94.75.214.39>
Message-ID <4eb6eb01$0$284$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 10/26/2011 4:55 PM, Novice wrote:
> Is there a simple and reliable technique for determining the classes needed
> for an applet jar?
>
> In other words, if I want to put Applet X in a jar, how do I determine all
> of the classes I'm using in the Applet  - directly or indirectly but
> excluding the Oracle Java classes - which I wrote.
>
> Currently, I'm doing it by inspection. I look at the imports in the applet,
> then look at the other classes referenced in the code which aren't in the
> import list and then see what they depend on. This is a slow and error-
> prone approach. I'll bet there is a simpler way to do it.
>
> I'm using Eclipse 3.7. Is there a built-in facility to do what I want in
> Eclipse? If so, what is it called and where do I find it? Or is there a
> plug-in that determines dependencies which I can add to Eclipse?

This is an unusual problem.

Usually you pack all class files from the project into a jar file
and distribute it with the same jar files used for build (and
often a few more jar files needed to run).

Stuff not needed should not be in the project.

But let us assume that you for whatever reason need to do it.

The java command has an option to display classes loaded, but
that may not work well for an applet, so you may need to write
a console app wrapper.

Alternatively you can cheat a bit and use the following:

ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.setOut(new PrintStream(baos));
ClassLoadingMXBean jmx = ManagementFactory.getClassLoadingMXBean();
jmx.setVerbose(true);
// do whatever
String s = baos.toString();

Arne

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Finding classes used by Applet Novice <novice@example..com> - 2011-10-26 20:55 +0000
  Re: Finding classes used by Applet Roedy Green <see_website@mindprod.com.invalid> - 2011-10-26 16:50 -0700
    Re: Finding classes used by Applet Novice <novice@example..com> - 2011-10-27 01:11 +0000
      Re: Finding classes used by Applet Jef <e70838@gmail.com> - 2011-10-27 04:30 -0700
        Re: Finding classes used by Applet David Lamb <dalamb@cs.queensu.ca> - 2011-10-27 09:23 -0400
        Re: Finding classes used by Applet Roedy Green <see_website@mindprod.com.invalid> - 2011-10-27 17:16 -0700
      Re: Finding classes used by Applet Roedy Green <see_website@mindprod.com.invalid> - 2011-10-27 07:17 -0700
        Re: Finding classes used by Applet Roedy Green <see_website@mindprod.com.invalid> - 2011-10-27 17:17 -0700
  Re: Finding classes used by Applet Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 15:16 -0500

csiph-web