Is it possible to insert a java applet in twine?

0 votes
asked Oct 11 by jrgilchrist (130 points)

Hello, I currently am trying to see if I can get a simple applet to work in twine. I have a java applet called Demo.class that draws some graphics on the screen. The applet's code is as follows:

import java.awt.*;

public class Demo extends java.applet.Applet
{
	public void init()
	{
		
	}
	
	public void paint(Graphics g)
	{
		g.drawOval(0, 0, 250, 100);
		g.setColor(Color.RED);
		g.drawString("First Applet", 10, 50);
	}
}

When I try to embed the applet into my twine, I get either nothing (when i try using the applet or object tag) or an error saying it may have been moved or deleted (when I use the embed tag). My html is as follows:

<h1>Applet Test</h1>

<embed src="Demo.class" width="300" height="300"/>

I have used Java before but am new to html. I am currently using the sugarcube format but have tried using others with no success.

1 Answer

+1 vote
answered Oct 11 by TheMadExile (20,310 points)
edited Oct 11 by TheMadExile

If you're confusing Java for JavaScript, then save for the unfortunate name similarity, due to idiotic marketing shenanigans, they are completely unrelated languages.  You cannot natively run Java code in browsers.

Elsewise, see the Stack Overflow question How to embed a Java applet in a web page? for more information (in addition to the hints given here, the first answer has links to tutorials at Oracle).

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...