Jump to content
  • Advertisement
Sign in to follow this  
World69star

[java] Applet Problem! Help!!

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HI everyone I am having a wierd problem with my pc and applets. Ok here is a sample small applet program:BigDebtApplet.java (//am using this small applet to save space on the post.) package Hour13 import java.awt.*; public class BigDebtApplet extends java.applet.Applet { int debt; public void init(){ debt=59000000; debt=debt/1440; } public void paint(Graphics screen){ screen.drawString("A minute's worth of debt is $" + debt, 5, 50); } } And here is a simple html code I am using: BigDebtApplet.html <applet code="BigDebtApplet.class" height=150 width=300> Now I take out the package declaration, save the code to jedit or notepad, in my jdk1.5_04\bin directory, compile manually with console/javac, run the html in either Firefox or IE with suns VM, it shows in the browser, but not using appletviewer it just gives my a blank space in the console like I was compiling the code. But if I use the code that any IDE creates(IDEAJ is my main program) it comes up java applet failed. Now if I copy that to the bin dir it fails as well. It runs fine using IntelliJ Idea 5.0's built in applet viewer. I have even tried to use DreamWeavermx 2004 for automatic code and path creation on my intellij created applets to make an html file and that fails as well. Is there a way I can run an applet that is not in the jdk\bin directory? And how can I run an applet created by my IDE? Also is the jdk appletviewer supposed to work like that? I thought I used it before and it worked fine, not anymore. Any help would be apprectiated I would like to be able to run my own applets off the harddrive with having to copy the code and manually compile in the jdk\bin directory. Sorry if any of this is confusing. You think my Jdk/jre is corrupted? or the appletveier?

Share this post


Link to post
Share on other sites
Advertisement
Here is a link to the Applet TAG

If you want to run the applet, and the code is in another place, use the codebase tag...
<applet codebase="bin" code="applet.class"></applet>

I have had trouble with some browsers by using the short form of the tag, such as <applet code="app.class"/>. I always put the ending tag.

NOTE: If you put the applet in a package, then you need the packagename with the class.
<applet code="mypackage.MyApplet.class"></applet>

If you want to run the applet, you can always put it in a jar file. Then you need the jar file with the index.html page. Then you need to add the archive tag to the applet tag.

<applet codebase="res/java" code="Hour13.BigDebtApplet.class"
archive="bigapp.jar"></applet>

The code could be in a jar file called bigapp, and located in the res/jara folder.

Hope that helps

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!