• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Conversion of App to Applet

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Been struggling with this for a few days and have some general questions for any applet guru's out there

I can compile the applet fine, but it seems to complain if the application is in any sort of package.

Do applets have to be in the default package? The application I'm trying to move over is in your typical com.bus.dir.etc package, but it gives me the class not found error unless I remove the package.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applets can be in any package, just like an application. Of course, the applet tag in the HTML page needs to reflect that package by giving the fully qualified classname in the "code" attribute.
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ah, that would make sense....

another question, in general class files are put under web-inf/classes/etc

but applet can't be placed under the web-inf directory. In general, is it bad programming to have 2 classes directory in a single web application?

I could just get ant to copy the applet files into a separate directory I suppose, but is this common practice?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should keep the two codebases apart, as they have nothing to do with each other.

As to the applet classes being part of a web app, well, only in the sense that they are static content that is being served by that web app, like images or HTML pages. There really is no connection to the dynamic content represented by servlets or JSPs.
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still can't seem to find the class file even with the full qualified name to it.

I have a directory jars/ that contains my applet.jar file

In the applet.jar file, i have a directory structure as such:

com/buz/foo/poo/myapp.class

and in my html,

<applet code="com.buz.foo.poo.myapp.class" codebase=jars/ archive="applet.jar" width=320 height=300>
<PARAM NAME=id VALUE="411">
</applet>


can you see any reason why the applet would not be able to find myapp.class?
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oddly enough, I have 3 jar files that I'm attaching to my applet, 2 of them work fine and are denoted by

basic: Loading http://localhost:8080/jars/blah.jar from cache
basic: No certificate info, this is unsigned JAR file.

which is fine, but for the jar that i'm trying to use as my applet, it is download by:

basic: Downloading http://localhost:8080/jars/player.jar to cache
basic: encoding = null for http://localhost:8080/jars/player.jar

is there any reason why the encoding would be null for this? Any ideas would be appreciated.
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thought I would just state that the problem was found in my ant build scripts.

It was for some reason creating duplicate class files for all my classes. Which is weird since compiling created no duplicate class files, it was only when the Jar was created through the ant script.

Removing all duplicates allowed the applet to be loaded correctly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic