0

So end goal here is to put a snake game in a java applet on my website. However, I cannot get a simple applet that only prints text to work on my website. Here is my HTML code:

<!DOCTYPE HTML>
<html lang="en">

<head>
<meta charset="utf-8">
<title>EpsilonOmegaStudios</title>
</head>

<body bgcolor =red>
<center><h1>Coming Soon...</h1>
<p>
<center><img src="EpsilonOmegaLogo.jpg" alt="EpsilonOmegaLogo"ALIGN=center height=300 width=300 />
</p>
<p>
<applet code="TestApplet.class" width ="400" height ="400">
            Game Not Found!
</applet>
</p>
</body>
</html>

And my java code:

import java.awt.Graphics;
import javax.swing.JApplet;


public class TestApplet extends JApplet {

    public void paint(Graphics g){
        super.paint(g);
        g.drawString("Wow this actually worked", 25, 25);
    }
}

I was using java 1.7 when I wrote it originally and just updated my eclipse because I thought that might have been the problem, now I just have a line going through my JApplets. The index file is in a folder with the image described in the HTML and the TestApplet.class file(which I got from saving my TestApplet.java as a .class file in Eclipse). Maybe I'm going about putting java code on my website in the wrong way but I'm thoroughly confused as to why the simple applet won't show up at all on my website. Secondly, the snake game I want to put on is made up of multiple .java classes and I'm not exactly sure how to makes sure all of those are accessible from my HTML from my current understanding i'd take all the .class files from all of the .java classes and do something like this:

<applet code="SnakeGame.class, Snake.class,Point.class,Token.class" width ="400" height ="400">
            Game Not Found!
</applet>

Thank you for the help I really appreciate it!

  • 1
    What browser are you using? Many don't support applets anymore and almost all require tricks to make them work if they do support them. – DCTID Nov 22 '19 at 16:05
  • Oh really? I'm using chrome. Is there something else I can do to put my java program on my website? – user860825 Nov 22 '19 at 16:44
  • 1
    Not really Java applets are no longer supported and there is no replacement or conversion path. Here are some ideas https://stackoverflow.com/questions/20394451/which-option-is-suitable-to-replace-java-applet. – DCTID Nov 22 '19 at 16:52

0 Answers0