10

I have a java SE project or you can say applet, but i want to run this applet in web browser how is it possible?

I need to copy jar file something like this i came to know but what is the possible solution?

5
  • Tomcat doesn't run applets, it runs servlets. And a browser can't run servlets (but it can run applets). What do you actually have?
    – Wyzard
    Mar 29, 2012 at 7:57
  • @Wyzard how can i run a applet in browser? if applet will run in browser then how it will run?does not it require a server like tomcat to run?
    – saroj
    Mar 29, 2012 at 8:00
  • An applet is typically downloaded from a server — though you can open one from a file on your own hard drive — but the server doesn't run the applet, it just reads a file and sends all the bytes to the browser. I'm guessing that you want Tomcat to serve a static file which happens to be an applet jar, but you confuse the issue if you say it's "running in Tomcat".
    – Wyzard
    Mar 29, 2012 at 8:04
  • yes you are saying exactly what i want i am removing that line "running in Tomcat", Please tell me how can i run this applet in web browser?
    – saroj
    Mar 29, 2012 at 8:06

2 Answers 2

12

This tutorial pretty much covers everything from writing your applet to embedding it on your web page. If you already have your applet done, as it seems, scroll down to "Invoking an applet". Here's the code from the tutorial for a quick solution:

<html>
<title>The Hello, World Applet</title>
<hr>
<applet code="HelloWorldApplet.class" width="320" height="120">
If your browser was Java-enabled, a "Hello, World"
message would appear here.
</applet>
<hr>
</html>
2
  • ya it helped me but how can i embed that html file into that HelloWorldApplet.class? should i place in src?
    – saroj
    Mar 29, 2012 at 9:26
  • @saroj, you will may found the answer to your question here: stackoverflow.com/questions/4253786/…. HTH
    – FloFu
    Feb 7, 2014 at 17:39
4

Most modern browsers no longer support Java.

In September 2015, Google decided to remove the support for Java in their Chrome web browser. The Java plugin is based on an old API called Netscape Plugin API that has always had security issues. Google felt that it was time for them to let go of this old technology and make the Web move on to newer and safer technologies like HTML5. When you visit a website or web service that is using Java, you now see a message that says: "The Chrome browser does not support NPAPI plug-ins and therefore will not run all Java content. Switch to a different browser (Internet Explorer or Safari on Mac) to run the Java plug-in."

The Java plug-in for web browsers relies on the cross platform plugin architecture NPAPI, which has been supported by all major web browsers for over a decade. Google's Chrome version 45 (released in September 2015) dropped support for NPAPI, impacting plugins for Silverlight, Java, Facebook Video and other similar NPAPI based plugins. Java applications are now offered though web browsers as either a web start application (which do not interact with the browser once they are launched) or as a Java applet (which might interact with the browser). This change does not affect Web Start applications, it only impacts applets.

If you have problems accessing Java applications using Chrome, Oracle recommends using Internet Explorer or Safari instead.

Developers and System administrators looking for alternative ways to support users of Chrome should see this blog regarding Launching Web Start applications.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.