2

I have made and compiled a Java applet and run it using java appletviewer. It is running fine as expected. But I am not able to run it usingany web browser like chrome or internet explorer even after enabling java. I have viewed lots of pages and forums with people facing the same problem with no use. My html code is:

`<html>
<head>
<title> Calculator </title>
<!--<meta name="discription" content="MultiPurpose Calculator">
<meta name="keywords" content="standard calculator;scientific calculator;loan calculator;calculator;applet">-->
</head>
<Applet code="cal3.class" width=500 height=600>
</Applet>
</html>`

cal3 is the name of the compiled java class. Thank you in advance!!

6
  • I think that you must install a plugin on your browser. Commented Sep 30, 2017 at 18:39
  • It's getting harder and harder to run Java applets on browsers. You will probably need to seek out detailed instructions for each specific browser. My recollection is that applet support is still completely broken on recent Chrome versions. Commented Sep 30, 2017 at 20:22
  • 1) See Java Plugin support deprecated and Moving to a Plugin-Free Web. 2) Why code an applet? If it is due to the teacher specifying it, please refer them to Why CS teachers should stop teaching Java applets. Commented Oct 2, 2017 at 1:20
  • Thank you everyone for your help. This was irritating me for days. Commented Oct 2, 2017 at 19:04
  • So can we consider that java as applet language is of no use in todays day considering its main usage was on the webpages for adding some funky looking application @AndrewThompson Commented Oct 2, 2017 at 19:09

2 Answers 2

1

tl;dr

Wrap your Java applet in a JNLP file to be served as a Java Web Start app.

Oracle no longer supports Java Applet technology

Oracle officially deprecated the Applet API in JEP 289 for Java 9. The appletviewer tool is also deprecated. These are not marked for deletion in the next version after Java 9, but may go away in later versions.

Browsers no longer support Java Applet

Embedding Java Applets within web browsers has proven to be an insoluble security problem. The industry has given up on trying to make this work. Ditto for Flash and Silverlight.

Google Chrome browser no longer supports the NPAPI plugin architecture, and therefore no longer supports Java Applet technology.

Microsoft Edge web browser does not support plugins such as that needed for Java Applet.

Mozilla Firefox browser dropped support for the NPAPI plugin architecture, and therefore Java Applet, in version 52 and later. See this Question on SuperUser.StackExchange.com. For older versions, Mozilla gives instructions on how to disable Java Applet.

Apple has been taking steps to phase out Java Applet support for years. This includes giving directions to disable the necessary plugin, as well as defaulting to disabling, and later omitting, the necessary plugin. Now Safari 11 has no direct support, though you might get it to work by mimicking a Microsoft Internet Explorer browser as described here.

And speaking of Microsoft Internet Explorer browsers, you might be able to get Java Applet to work. Try these instructions. I do not recommend doing so.

Java Web Start

I do not recommend using Java Applets.

Instead, learn about Java Web Start technology. You get the convenience of obtaining and launching Java apps via the web browser, but the actual app runs as a separate local app on the user’s machine rather than inside the browser.

For security, they run by default in the same kind of limited “sandbox” as Java Applets. This sandbox restricts access to the various features of the host OS and hardware. You can take measures to relax the security restrictions, as appropriate to the needs of your app.

Wrap your applet

You can even wrap an existing Java Applet in a jar file with a JNLP file to deploy as a Java Web Start app.

Oracle and the Java community continue to actively support and advance Java Web Start, including an update to the JNLP spec in 2017-09.

Sign up to request clarification or add additional context in comments.

Comments

0

Your code is okay the problem is on he browser. Most browsers now days are ending support for java. Browsers don't allow and don't support java code to run, like running applets on the browser. The good old days of java code on browser has come to an end. Newer version and updates of HTML are killing java same they did with flashplayer. Maybe Internet Explorer might be a good option in this case.

1 Comment

Nope. IE is one of the first browsers that i have tried!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.