applet wont run in browser

  • Thread starter James David Miller
  • Start date
J

James David Miller

I have an applet that I have written which works just fine in the
appletviewer but when I try to run it in a brower, the status bar just
says "loading applet" forever.

I have narrowed my html down to the following:
<HTML>
<HEAD>
<TITLE>Edit Applet</TITLE>
</HEAD>
<BODY>

<APPLET CODE="EditApplet.class" ARCHIVE="editapplet.jar"
NAME="Edit" WIDTH="560" HEIGHT="400">
<PARAM NAME="name" VALUE="Edit">
<PARAM NAME="DOC" VALUE="">
<PARAM NAME="SERVEURL" VALUE="">
<PARAM NAME="IMAGEDIR" VALUE="image">
</APPLET>

</BODY>
</HTML>

As of now there is no package statements in any of my files. I put the
jar file in the same dir as the html file.
If it isn't there it says that it can't load.

Is there a log somewhere that is generated while running / attempting to
run in a browser so that I can see what is causing it to hang.
Can someone see off hand what I have done wrong.
I am kind of new to the java applet thing.

jdm
 
A

Andrew Thompson

1. Please do not post in HTML format, check your
mail reader (outlook I guess) settings for posting to
newsgroups.
"James David Miller" (e-mail address removed)
wrote in message I have an applet that I have written which works
just fine in the appletviewer but when I try to run
it in a brower, the status bar just says "loading applet" forever.

There are a few hurdles to overcome before an
applet will work, the first is the browser..

What browser / version and OS (e.g. IE6 on XP)
are you using?
 
A

Ajit

add the CODEBASE attribute to the applet tag. ( path where u have
placed your applet )
ie. <applet codebase="http://www.xyz.com/" height="10" width="10"
code="abc.class" archive="abc.jar"></applet>
 
J

James David Miller

Andrew said:
1. Please do not post in HTML format, check your
mail reader (outlook I guess) settings for posting to
newsgroups.




There are a few hurdles to overcome before an
applet will work, the first is the browser..

What browser / version and OS (e.g. IE6 on XP)
are you using?

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/
Didn't think about html in message, won't do that again.

I forgot to mention. All the demo applets that come with the JDK work.
I am running RedHat 9 with Mozilla 1.4.1. and yes I have the plugin
correctly setup. Other websites that use Applets requiring 1.3 or
better seem to work fine.
 
J

James David Miller

Ajit said:
add the CODEBASE attribute to the applet tag. ( path where u have
placed your applet )
ie. <applet codebase="http://www.xyz.com/" height="10" width="10"
code="abc.class" archive="abc.jar"></applet>
I tried that. If it is pointing to the wrong place the status at the
bottom indicates that the loading failed. If the statement isn't there
or if it points to the correct place the status indicates loading but it
never indicates that it completed loading.
 
A

Andrew Thompson

James David Miller said:
....
I forgot to mention. All the demo applets that come with the JDK work.
I am running RedHat 9 with Mozilla 1.4.1. and yes I have the plugin
correctly setup. Other websites that use Applets requiring 1.3 or
better seem to work fine.

Seems like it might be a 'codebase' problem, do you
have the web page and applet in the same directory?

Could you post the <applet> tag you are using?
Or better still, the complete html, if it's short..

[ I take it you have not put it on the web yet,
an URL is often easier when dealing with applets ]
 
J

James David Miller

Andrew said:
Andrew Thompson wrote:

...


I forgot to mention. All the demo applets that come with the JDK work.
I am running RedHat 9 with Mozilla 1.4.1. and yes I have the plugin
correctly setup. Other websites that use Applets requiring 1.3 or
better seem to work fine.

Seems like it might be a 'codebase' problem, do you
have the web page and applet in the same directory?

Could you post the <applet> tag you are using?
Or better still, the complete html, if it's short..

[ I take it you have not put it on the web yet,
an URL is often easier when dealing with applets ]

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/
The original message contained the complete html and someone said not to
post things in html.

Yes the jar file is in the same directory as the html.
If codebase is there and is equel to "." then I have the same problem.
The browser status indicates that it is loading the applet and the
status never changes. If I have a codebase value that points somewhere
elese then the browser status indicates applet loading failed.
 
J

James David Miller

James said:
I have an applet that I have written which works just fine in the
appletviewer but when I try to run it in a brower, the status bar just
says "loading applet" forever.


As of now there is no package statements in any of my files. I put
the jar file in the same dir as the html file.
If it isn't there it says that it can't load.

Is there a log somewhere that is generated while running / attempting
to run in a browser so that I can see what is causing it to hang.
Can someone see off hand what I have done wrong.
I am kind of new to the java applet thing.

jdm
What I do to test.
I run a RedHat 9 box with Apache running.
I first run the applet with appletviewer in the build directory without
a archive statement in the html.
Then I build the jar and place the archive in the html and run again
from the build directory.
Then I copy the jar to a directory that Apache sees and run the
appletviewer by giving a url.
This all works.
Then I point the browser to the same url. This doesn't work.
Then I point the browser to the html file in the build directory. This
doesn't work.

If I build one of the demos that came with the JDk.
All the above works.
 
A

Andrew Thompson

James David Miller said:
I tried that. If it is pointing to the wrong place the status at the
bottom indicates that the loading failed. If the statement isn't there
or if it points to the correct place the status indicates loading but it
never indicates that it completed loading.

You asked in your original post if there was a
'log' of errors or Applets. Generally you can get
a 'java console' or similar from your browser,
but I would not know how to find it in.. what was it?
Linux / Mozilla.. wait, if it's the same on Linux as
Windows.. Alt|t|w|j

You stated you tried a codebase, but it was not
mentioned in the <applet> example you provided..
I will just check that you 'cut and paste' that code?
[ NEVER 'type in' bits of code from Java source or
web pages, supply the original code. ]

Where is your URL?
 
J

James David Miller

James said:
I have an applet that I have written which works just fine in the
appletviewer but when I try to run it in a brower, the status bar just
says "loading applet" forever.

As of now there is no package statements in any of my files. I put
the jar file in the same dir as the html file.
If it isn't there it says that it can't load.

Is there a log somewhere that is generated while running / attempting
to run in a browser so that I can see what is causing it to hang.
Can someone see off hand what I have done wrong.
I am kind of new to the java applet thing.

jdm
Sorry guys.
I don't know if I was just too tired last night or what. I scrapped the
html and retyped it this morning and it all seems to work fine. I don't
see what I did differently. You guys gave me some insight that I didn't
have before though.

jdm
 
A

Andrew Thompson

James David Miller said:
The original message contained the complete html and someone said not to
post things in html.

Well.. to clarify, I have asked you to do two
separate things with html. The first was to
not _post_ to usenet groups in html _format_.
[ thank you for correcting that ].

That is quite different to the html of the web
page that calls the applet. It was _that_ html
that I wanted you to post 'exactly as is'
(ie your Applet web page)

I asked you to post your exact 'applet html'
because Ajit suggested you try codebase,
you responded you had, but your original
post contradicts that, it had no codebase
in it.

So the question is, are you changing this
minute by minute, just trying things at random?
That would make it very hard to help.

Did you retype the html out of your page
and forget to include the 'codebase' tag?
How are we supposed to know?

And now that I have already hassled you..
a) about posting in html format
b) not providing the 'cut and paste' html
...I will ask another thing.

Please trim any unnecessary quotes out of
your replies. Include only the parts you are
replying to, as posts get very long very quickly.
 

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

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top