Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsServing a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/640251/#msg_640251
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?]]>Nick Violi2010-11-19T18:30:12-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/640290/#msg_640290
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?]]>Larry Isaacs2010-11-20T01:24:53-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/773582/#msg_773582
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
]]>Ed Thompson2012-01-02T02:52:18-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/773777/#msg_773777
> 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]]>Larry Isaacs2012-01-02T14:02:40-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/773872/#msg_773872
ThompsonFamily
src
Applets
---calcLoan
------CalcLoan.java
JRE System Library
Apache Tomcat 7.90
build
ThompsonFamily
---build
Webcontent
---everal files
Please let me know any other info I can give you to assist. Thanks much for replying!!!
Ed
]]>Ed Thompson2012-01-02T19:16:52-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/773903/#msg_773903
> The Applets folder is not in the src folder
>
> ThompsonFamily
> src
> Applets
> ---calcLoan
> ------CalcLoan.java
> JRE System Library
> Apache Tomcat 7.90
> build
> ThompsonFamily
> ---build
> Webcontent
> ---everal files
>
> Please let me know any other info I can give you to assist. Thanks much
> for replying!!!
>
> Ed
>
>
>
If you go to the Source tab on the Java Build Path page of the
ThompsonFamily project properties, do you see "Applets" or
"Applets/calcLoan" listed as a source folder?
Cheers,
Larry]]>Larry Isaacs2012-01-02T21:11:23-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/773929/#msg_773929
ThompsonFamily/Applets
ThompsonFamily/src]]>Ed Thompson2012-01-02T22:35:55-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/774015/#msg_774015
Thanks again
Ed]]>Ed Thompson2012-01-03T05:01:33-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/774019/#msg_774019
Thanks,
Ed]]>Ed Thompson2012-01-03T05:12:28-00:00Re: Serving a web page with embedded applet
https://www.eclipse.org/forums/index.php/mv/msg/200580/774245/#msg_774245
> I see two source folders.
> ThompsonFamily/Applets
> ThompsonFamily/src
In the Source tab, enable the "Allow output folders for source folders"
option. Then expand "ThompsonFamily/Applets" and select the "Output
folder" item and click "Edit...". In the dialog that appears, select
"Specific output folder..." and provide an output folder other than
"build/classes", perhaps "build/Applets". This gives you a project
folder where the applet class will be compiled that can be used as a
content folder (like "WebContent").
On the Deployment Assembly page you should remove any mapping with
"/Applets" as the source. Then you should add a mapping for the output
folder for "Applets" (e.g. "/build/Applets") to "/" (I believe the
<applet> tag will default to looking for classes from the root of the
webapp). This will put the applet class in the correct location in your
webapp and not treat it like servlet classes which go under
"WEB-INF/classes".
As you noted in your later e-mail, since "Applets" is your Java source
folder, the fully qualified applet class is "calcLoan.CalcLoan". Your
<applet> tag will have to account for the "calcLoan" package for it to
work. It's been a long time since I messed with applets so I'll let you
work out any additional details with the <applet> tag.