|
Re: Serving a web page with embedded applet [message #640290 is a reply to message #640251] |
Sat, 20 November 2010 01:24 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
WTP assumes that all classes you build in your Dynamic Web Project are
destined to reside in WEB-INF/classes, which is by design inaccessible
to browsers. To add applets to your project you will need to first open
the project's Properties dialog and on the Java Build Path Source tab,
add a new source folder specifically for applet classes. You then need
to enable "Allow output folders for source folders" and assign this
applet source folder its own output folder. Switch to the Deployment
Assembly properties page, applying the changes to the build path when
prompted. Select the item that has a Deploy Path of "WEB-INF/classes"
and references your applet source folder, then click Remove. Next click
Add, select "Folder Mapping", and click Next. In the Add Folder dialog,
pick the *output* folder for the applet source folder and click Finish.
Verify that the Deploy Path for this output folder is "/", and click
OK to exit the Properties dialog. Now, whatever you build in your
applet source folder will go into the "content" portion of your Web
application where it belongs, and not into WEB-INF/classes.
Cheers,
Larry
On 11/19/2010 1:30 PM, nvioli2@gmail.com wrote:
> Hello,
> I'm trying to create a web project that serves a web page with an
> embedded applet using WTP / Tomcat 6.
>
> If I compile the applet manually and build the project manually in
> Tomcat it works fine, so I know there's no problem with the code or my
> server setup.
>
> I think the problem might be something with the way Eclipse builds
> projects, like how to refer to the location of the applet from the
> WebContent folder.
>
> I tried:
> *referring to "../build/classes/MyApplet.class" from index.html in the
> WebContent folder
> *manually moving the class files from build/classes to WebContent
> *setting WebContent as the output folder
>
> In all cases the applet simply does not show up. In Firefox I get a gray
> rectangle and the message "Start: Applet not initialized". In Chrome and
> Eclipse's built-in browser I just get blank space.
>
> Can anyone give me a push in the right direction? Am I missing some
> configuration to give the server access to the applet? Am I not on the
> right track at all?
|
|
|
Re: Serving a web page with embedded applet [message #773582 is a reply to message #640251] |
Mon, 02 January 2012 02:52 |
Ed Thompson Messages: 5 Registered: December 2011 |
Junior Member |
|
|
Larry,
I've been working on a similar problem for a few days now and was hoping you could help me out. I'm new to all of this, but this seems to be the problem that has insisted on perpetually kicking my but. I am using Tomcat 7.0.
Project name: ThompsonFamily (I am just using a family website as place to practice some of the things I've learned)
Applet name: CalcLoan
Browser: Google Chrome
I have a dynamic web project that has an applet. I believe that I have it set up as you directed (but the "Allow output folders for source folders" box does not stay checked). My output folder is the default, and within the workspace/build/classes/CalcLoan directory are two files: CalLoan$1.class, and CalcLoan.class. After exporting a WAR file, these are also shown in the directory WEB-INF/classes/calcLoan.
In the Tomcat webapps/ThompsonFamily directory, I now have a CalcLoan folder (after following your previous post), which contains a CalcLoan.java file.
My call for the applet is: <applet code="CalcLoan.class" width="320" height="200"></applet>
The error I'm receiving is kinda long, but boils down to "class not found."
I've tried copying the CalcLoan$1.class and CalcLoan.class files into the new CalcLoan folder just to see if I could get this to work, but that didn't help at all.
Any suggestion you may have would be highly appreciated (aside from giving up).
Thanks,
Ed
[Updated on: Mon, 02 January 2012 03:00] Report message to a moderator
|
|
|
Re: Serving a web page with embedded applet [message #773777 is a reply to message #773582] |
Mon, 02 January 2012 14:02 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
On 1/1/2012 9:52 PM, Ed Thompson wrote:
> Nick,
>
> I've been working on a similar problem for a few days now and was hoping
> you could help me out. I'm new to all of this, but this seems to be the
> problem that has insisted on perpetually kicking my but. I am using
> Tomcat 7.0.
>
> Project name: ThompsonFamily (I am just using a family website as place
> to practice some of the things I've learned)
>
> Applet name: CalcLoan
>
> Browser: Google Chrome
>
> I have a dynamic web project that has an applet. I believe that I have
> it set up as you directed (but the "Allow output folders for source
> folders" box does not stay checked). My output folder is the default,
> and within the workspace/build/classes/CalcLoan directory are two files:
> CalLoan$1.class, and CalcLoan.class. After exporting a WAR file, these
> are also shown in the directory WEB-INF/classes/calcLoan.
>
> In the Tomcat webapps/ThompsonFamily directory, I now have a CalcLoan
> folder (after following your previous post), which contains a
> CalcLoan.java file.
>
> My call for the applet is: <applet code="CalcLoan.class" width="320"
> height="200"></applet>
>
> The error I'm receiving is kinda long, but boils down to "class not found."
>
> I've tried copying the CalcLoan$1.class and CalcLoan.class files into
> the new CalcLoan folder just to see if I could get this to work, but
> that didn't help at all.
>
> Any suggestion you may have would be highly appreciated (aside from
> giving up).
>
> Thanks,
>
> Golfnut
>
Where is the "CalcLoan" folder in your project?
Note: It should not be under the "src" folder (i.e. "src/CalcLoan") as
it needs to be a separate Java source folder.
Cheers,
Larry
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05446 seconds