[4804] in java-interest

home help back first fref pref prev next nref lref last post

Must applets and associated classes stick together?

daemon@ATHENA.MIT.EDU (John D. Kane)
Mon Jan 15 18:35:50 1996

From: "John D. Kane" <john@insightnews.com>
To: "' java@java.sun.com'" <java@java.sun.com>,
        "Arthur.Vanhoff" <Arthur.Vanhoff@Eng.Sun.COM>,
        "'java-interest@java.sun.com'" <java-interest@java.sun.com>,
        "'jug@solect.com'" <jug@solect.com>
Date: Mon, 15 Jan 96 17:06:00 PST


When I compile my applets, I can import my own classes from other 
subdirectories as long is my CLASSPATH is set correctly. But my applets will 
not run from a client machine because my imported classes are not found at 
runtime.

Must these custom classes that I import be in the same directory as, or a 
subdirectory of my applet?

If so, then what about class reusability? Must I copy a custom class to 
every subdirectory where an applet uses it? This would certainly make things 
tough when making changes to a class because I'd have to make sure I 
re-copied the changed class to all other subdirectories which need it. The 
original Java classes are certainly reusable. All I ask is to be able to do 
the same thing with my classes.

Let me ask this ... What have you done with custom classes? For example, if 
you were to do what I'm doing -- subclassing the Canvas class, to create a 
TextBoard class which displays scrollable text, then where would you place 
this TextBoard class so that it could be re-used by any applets that wanted 
to instantiate it? I don't mean where to place it for compilation purposes, 
but where to place it so that it can be used at runtime when someone across 
the internet connects to your server and runs the main applet.

Maybe even as a better question, I should ask how? -- how do I make the 
applets find my custom classes at runtime? (I thought the CLASSPATH 
environment variable was supposed to take care of this too, but obviously it 
doesn't) I really don't want to make identical copies of a class for 
different applets because this would defeat class reusability.

I've asked this question before. What I received was a response saying I 
should use the codebase tag to try and take care of this problem. I haven't 
been able to do that since my applet and imported classes are in separate 
subdirectories. Now I'm looking for a straight answer, no guessing, no 
beating around the bush ... Must my custom classes reside in the same 
directory as the applet which calls them at runtime?

John
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post