hello.java :
/*hello.java*/
import java.awt.Graphics;
public class hello extends java.applet.Applet
{
public void paint(Graphics g)
{
g.drawString("Hello from Java!", 60, 30);
}
}
you can download the hello.java and the compiled hello.jar files from my supporting site here.
The following is the step by step howto:
step 1: Get an online file storage to host your jar files. Google Site provides free site host, just register a free account at http://site.google.com/ .
step 2: Compile the java file hello.java to hello.jar file.If you don't have java compiler on your computer, use the online java compiler at http://compilr.com/ , registration is free and take 1 minute.
step 3: Upload the hello.jar file to a file server . For example, my hello.jar is uploaded to the free server at google, this is my directory -- http://sites.google.com/site/cyberjedizen/Home/blog-tricks-how-to-embed-applet-in-your-post-in-10-seconds/
step 4: Copy paste the following html code to your post's Html, the codebase="http://yoursite/yourdirectory/"
html code:
<applet codebase="http://sites.google.com/site/cyberjedizen/Home/blog-tricks-how-to-embed-applet-in-your-post-in-10-seconds/" height="100" archive="hello.jar" width="200" code="hello.class"><param name="_cx" value="2646"><param name="_cy" value="2646"></applet>
That's it, have fun with applet. If this don't work for your blog, leave your comment here, I will help you on it asap.
references:
hey mate,
ReplyDeletei am getting error only i followed the same steps which u followed..
my files are at
http://sites.google.com/site/sjavaloversite/home/applet
very useful,Thanks for sharing..
ReplyDeletehire dedicated developers