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

Discussion in 'Java' started by Mark_Galeck, Oct 26, 2008.

  1. Mark_Galeck

    Mark_Galeck Guest

    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
     
    Mark_Galeck, Oct 26, 2008
    #1
    1. Advertising

  2. 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
     
    Knute Johnson, Oct 26, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krista
    Replies:
    3
    Views:
    2,321
    Andrew Thompson
    Sep 15, 2004
  2. Oodini
    Replies:
    1
    Views:
    1,778
    Keith Thompson
    Sep 27, 2005
  3. wallge
    Replies:
    7
    Views:
    525
  4. Replies:
    1
    Views:
    504
    Sion Arrowsmith
    Jul 10, 2008
  5. Mark_Galeck
    Replies:
    1
    Views:
    299
    Roedy Green
    Oct 27, 2008
Loading...

Share This Page