Sun Server and applets

E

emwalter

Hello. I have the sun java system application server running on my
machine. I am trying to reference a applet .class file which I have in
the war file, as you know it gets added under /WEB-INF/classes, just
like a servlet, since it is a class file. However, I can not seem to
figure out what path to put in my html code to get to the applet class
file. With servlets I just add the servlet as a web component and then
go under the aliases tag in the deployment tool, set what I want for
path and then use that in my code. However, I don't see a similar
thing for applets. I have to believe there is a way to do this easily.

Thanks so very much for your time. This is driving me crazy.
 
W

Wendy S

Hello. I have the sun java system application server running on my
machine. I am trying to reference a applet .class file which I have in
the war file, as you know it gets added under /WEB-INF/classes, just
like a servlet, since it is a class file.

No, it doesn't. A servlet gets executed on the server, while an applet
needs to be downloaded by a client and executed on the client's machine.
Since nothing under WEB-INF is visible to client browsers, you can't put
applet code there.

Put it somewhere under the webapp's main directory, similar to placing an
HTML file or an image you wanted a client browser to load.
 
E

emwalter

Wendy,

That is exactly what I want to do but, I can not seem to figure out how
to do that. Do you know where I should put it or how to tell where the
Sun Web Server is looking for it?
 
W

Wendy S

That is exactly what I want to do but, I can not seem to figure out how
to do that. Do you know where I should put it or how to tell where the
Sun Web Server is looking for it?

Anywhere other than WEB-INF. (Well, not META-INF either, I suppose.)

The Sun Web Server will look for it wherever the client browser asks for it.
That's controlled by something in the web page that you write. Is it an
<applet> tag? Something like that. Post what you have for that part, and
we'll go from there.

Back to your original message:
With servlets I just add the servlet as a web component and then
go under the aliases tag in the deployment tool, set what I want for
path and then use that in my code. However, I don't see a similar
thing for applets

There is nothing similar for applets because applets do not run on the
server side. Your web server doesn't need to know anything about them.
Think of them like an image file-- the client browser requests a page, and
as it renders
the HTML it will request any images it comes across, and also request any
applet files that are referred to in the HTML.
 
E

emwalter

The only reason I mentioned the WEB-INF directory is because when using
the deploytool, since it is a class file it puts it there. It does not
give me an option about that. I have tried putting it someplace else
and adding that path to the classpath in the admin console and same
thing. Basically I have no idea where it is looking for it or how to
change it. I thought it would look in the classpath that is set on the
server, but I guess not
 
E

emwalter

I have wrote many applet and html in the past. I am familar with all
of that syntax but, when I have something like:

<applet code="colorbook.class" width=550 height=400>

it can not find it, just like if you were to give the wrong path for a
picture. It does not know where to find it. I tried adding to the
classpath but, to no avail. I just don't know where it is looking for
the colorbook.class file on the server.
 
W

Wendy S

The only reason I mentioned the WEB-INF directory is because when using
the deploytool, since it is a class file it puts it there. It does not
give me an option about that. I have tried putting it someplace else
and adding that path to the classpath in the admin console and same
thing. Basically I have no idea where it is looking for it or how to
change it. I thought it would look in the classpath that is set on the
server, but I guess not

Is there a support group specifically for this Sun Web Server? (Never heard
of it...) You might have more luck there. Somehow you have to convince it
to put your Applet classes somewhere a client browser can see them.

Okay... found it:
http://www.sun.com/software/products/web_srvr/home_web_srvr.xml

Here (I think) is the support forum:
http://swforum.sun.com/jive/forum.jspa?forumID=16
 
W

Wendy S

I have wrote many applet and html in the past. I am familar with all
of that syntax but, when I have something like:

<applet code="colorbook.class" width=550 height=400>

it can not find it, just like if you were to give the wrong path for a
picture. It does not know where to find it. I tried adding to the
classpath but, to no avail. I just don't know where it is looking for
the colorbook.class file on the server.

It's a relative path, so the browser will request the colorbook.class file
from the same path as the current page. What URL is in the browser's
address window? That's where the browser thinks the page came from, it
doesn't know about any forwarding that may have happened on the server side.

Put the colorbook.class file in that directory. (Java class names usually
start with an uppercase letter. Make sure that's not the problem.)
 
E

emwalter

Wendy,

Thank you so much for finding that. I just read a little bit on that
group and it sounds like others have encountered similar issues.
Thanks for your time!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top