Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to make an applet load user-defined packages??

Reply
Thread Tools

how to make an applet load user-defined packages??

 
 
Mark_Galeck
Guest
Posts: n/a
 
      10-26-2008
Hello, I can compile an applet that uses packages I define, but it
will not run, because, it does not want to access the class files in
the packages directories (only its own). I can run and load
everything if I put all the code in one directory and don't use
packages. I can use applications with my own packages in their own
directories. But I can't use applets with my own packages. The
applet ignores CLASSPATH so that does not work.

There must be a way to run applets composed of multiple packages.
How?

Mark
 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      10-26-2008
Mark_Galeck wrote:
> Hello, I can compile an applet that uses packages I define, but it
> will not run, because, it does not want to access the class files in
> the packages directories (only its own). I can run and load
> everything if I put all the code in one directory and don't use
> packages. I can use applications with my own packages in their own
> directories. But I can't use applets with my own packages. The
> applet ignores CLASSPATH so that does not work.
>
> There must be a way to run applets composed of multiple packages.
> How?
>
> Mark


Your class files must be in a directory with the same name as the
package. When you create the .jar files, the individual files must be
in the same directories in the .jar file as well. Whenever you refer to
your classes you must refer to them by their full names (eg.
com.Marksfiles.applet.MyApplet).

You problem is most likely related to directories or .jar not being
correct. I use a standard directory structure for all my Java programs,
it looks like com.knutejohnson.packagename.ClassName. When I compile my
programs, I start the compile from above the com directory. This way
the compiler can see all of my classes no matter what package they are
in. The jar program is run from there for the same reasons. All this
makes it really simple to get all the package name/directories to be in
the right place.

In your case you might just be able to get it to run by being in the
directory above your package root directory.

--

Knute Johnson
email s/nospam/knute2008/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to make an applet load user-defined package? Mark_Galeck Java 1 10-27-2008 02:19 PM
Java applet failed when I try to load the avi file in my java applet Krista Java 3 09-15-2004 02:53 AM
Re: play wave files using java.applet.Applet webster Java 0 07-20-2003 01:51 PM
applet vs. canvas in applet Rob Love Java 1 07-07-2003 10:07 PM



Advertisments