overexchange
overexchange

Reputation: 1

How to launch an applet using chrome?

Here is the URL:

http://www.javaworld.com/article/2076625/core-java/designing-object-initialization.html

that does not launch below element on my browser:

<applet code="TrafficLightApplet.class" codebase="http://www.javaworld.com/javaworld/jw-03-1998/techniques" height="225" width="350" title="undefined">You need a Java-enabled browser to see this applet. <figure><img src="http://images.techhive.com/images/idge/imported/article/jvw/1998/03/trafficlight-100158135-orig.gif"></figure> State-transition diagram for a traffic light</applet>

I am using chrome version 43.0.2357.124

Please help me!!!

Upvotes: 1

Views: 7841

Answers (2)

Anubhav Gupta
Anubhav Gupta

Reputation: 114

Applets are deprecated but you can still run them on google chrome follow these steps:

  • Compile your java code.

    javac Hello.java

  • Create a .html file with following code:

<html> <p> This runs applet </p> <applet code="Hello.class" height=200 width=320> </applet> </html>

  • Add live server extension in VSCODE

https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

  • Add CherpJ extension in google chrome

https://chrome.google.com/webstore/detail/cheerpj-applet-runner/bbmolahhldcbngedljfadjlognfaaein?hl=en

  • Press CTRL+SHIFT+P in vscode and enter live server and enable it.
  • Go to http://127.0.0.1:5500/applet.html in chrome.
  • Click on 'Run applets' in CherpJ extension and you're done.

Upvotes: 2

SubOptimal
SubOptimal

Reputation: 22973

From the Java FAQ section.

Google announced in September 2013 plans to remove NPAPI support from Chrome by "the end of 2014", thus effectively dropping support for Silverlight, Java, Facebook Video and other similar NPAPI based plugins. Recently, Google has revised their plans and now state that they plan to completely remove NPAPI by late 2015.

As of April 2015, starting with Chrome Version 42, Google has added an additional step to configuring NPAPI based plugins like Java to run.

See the section Enabling NPAPI in Chrome Version 42 and later.

If it is still not working, check if the Java plugin is installed in Chrome. Type in the address bar: chrome://plugins/.

If the Java plugin is not listed there checkout this Stackoveflow thread How to configure Chrome's Java plugin so it uses an existing JDK in the machine.

Upvotes: 2

Related Questions