Java Applet Problems

  • 1
  • Question
  • Updated 10 years ago
  • Answered
I've figured that I have to have my class files in the File Manager and reference them using:

For some reason the word "code" keeps disappearing.

When I try to view my applet after I put that in the HTML widget, it says there is an error of some sort. Then I change the word code to codebase and I get the orange Java loading screen. After all this my applet won't load and I have searched for days everywhere I could find tutorials. I don't know what is wrong. Any suggestions to fix my problem?
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
  • confused.

Posted 10 years ago

  • 1
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hello Adam,
Can you tell us more about what you are trying to accomplish and what you have currently implemented on your site. Are you able to paste the code in here that you have so we can take a look.

Are you trying to implement something like this: How to use applets.

Emmy
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
I'm trying to get the java applet to display on the screen. I have put all the necessary class files in the file manager. I know for sure I'm supposed to reference them using the word "resources/" then my class file. I've tested to make sure I'm referencing properly to the file by referencing to a flash video I have in the file manager. It displayed without a problem on the first try. I'm trying to use exactly what you linked to. I've put all the tags, width and height, and references in there correctly but for some reason it won't display. There was already a topic here that said to use exactly what is on the site you've shown me. I've tried exactly that and it didn't work. I don't know what is wrong.
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hello Adam,
Were you looking at this thread: How to add java applet?

Ok, so it displayed properly on the first try, did you change anything? I know that sounds elementary on my part, but I am just trying to get handle on why it is not displaying for you and why it worked once and not again.

Emmy
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
Yes that was the thread I looked at.

The thing that displayed the first time was a .swf Flash video. This was completely different from the java applet. I was just testing something else to see if I was doing everything properly. I keep getting an error no matter what I try. I keep using the following:



I'm told that is all that I need and to have the class file in the file manager. It just doesn't seem to want to work properly at all.
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Ok, looking up at your first post, you said that the word code keeps disappearing, do you mean it keeps disappearing from your tag as it should look something like this when you put it into the html widget:

Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
Yes that is exactly what I mean.
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Ok, thanks for providing that information, I will see what I can find out and will get back with you.

Emmy
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
Hi Adam. Do you have a url with your code on that we can have a look at? That would help a lot with debugging.

Thanks
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
The java applet I want to use is Rolling Cubes.

There isn't an embed code from the website itself. It was open source though, so I figured I would go embed the applet myself. I keep getting the error ClassNotFoundException. I was able to test this on a different computer to see if it would happen there too and got the same thing.
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
Hi Adam - we're not ignoring you! Christo's not online at the moment and we'll ask him to come back to you when he is. Being the weekend, it may be a little longer than usual.
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
Hi Adam ... sorry about the delayed reply ...

I am also, struggling a little to get that applet working. However, as a quick fix, try this to embed the same thing (from this page: http://lightforce.freestuff.gr/cubes.php)


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="181" height="191" id="cube" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="http://lightforce.freestuff.gr/www/cube.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="bgcolor" value="#F5F5F5" />
<embed src="http://lightforce.freestuff.gr/www/cube.swf" menu="false" quality="high" bgcolor="#F5F5F5" width="181" height="191" name="cube" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>


You can see it on a SynthaSite here:
http://tipsandtricks.synthasite.com/r...

Does this resolve your problem, or would you like me to try get the applet version working?
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
I would like to use applets because I'm going to be writing some more in the future to add to my site. I looked at your tipsandtricks site and it doesn't want to load for me.
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
Hi Adam - the site loads for me, can you try again? Alternatively, can you try restarting your browser or using a different browser to access the site? If it still won't load, could you let us know if you see an error message on the page?
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
I forgot to add that you can access the site's home page on this link: http://tipsandtricks.synthasite.com/, Christo's given a link to the specific page above.
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
Hi Adam

Sorry took a while to get back to you.

I have got the applet to work. What I didnt realise is that the source code that was provided actually had two class files, so we needed to create a jar archive.

You can see it working here:
http://tipsandtricks.synthasite.com/

There are two options for you to displat this applet.

1 (easiest) - just serve it off my site.
* just paste this code into an html widget:


<applet code="RollingCubes.class" width=181 height=191>
<param name="archive" value="http://tipsandtricks.synthasite.com/resources/RollingCubes.jar" />
</applet>


2.) (better) use a jar:
*You can download the jar that I created from here:
http://tipsandtricks.synthasite.com/r...

* upload this to your resource manager

* use the following applet embed code on your site:

<applet code="RollingCubes.class" width=181 height=191>
<param name="archive" value="resources/RollingCubes.jar" />
</applet>


That should do the trick
Photo of Adam

Adam

  • 23 Posts
  • 0 Reply Likes
I did some experimenting with both ways of embedding the applet. The one from tipsandtricks.synthasite.com works just fine. I tested the other one and kept getting that same error. Then I thought that the reason I was getting the error was because my site isn't published yet. I'm sure that is the reason for the error.

Thank you Christo! I can't believe it was something as simple as that. All of you have been a great help!