Run a .jar (swing) in a browser
Nb0218
-
ElementW Posted messages 5690 Status Contributor -
ElementW Posted messages 5690 Status Contributor -
Hello, I have a question that might seem quite basic to some, but any help would be welcome.
Actually, I've developed a Java Swing application, and I have the .jar file. What I want is to be able to run my program in a browser. Does anyone have an idea, or is it simply impossible? Thank you in advance for your help.
Actually, I've developed a Java Swing application, and I have the .jar file. What I want is to be able to run my program in a browser. Does anyone have an idea, or is it simply impossible? Thank you in advance for your help.
1 answer
Hello,
Java applets have been deprecated since Java 9 and browsers no longer support them.
https://www.computing.co.uk/?v3
--
Trust does not exclude control.
Java applets have been deprecated since Java 9 and browsers no longer support them.
https://www.computing.co.uk/?v3
--
Trust does not exclude control.
Because Java (aside from applets) is not designed to run in a browser, so finding an alternative solution will depend on what you really want to do... but it won't be with Swing.
The only solution left for you is to distribute a .jar, or have that .jar contained in an .exe produced by launch4j for Windows, in a .app produced by appbundler for Mac, or compressed with a / for Linux.
It is now possible to create an .exe directly with the JDK.
I should write a CCM tutorial when I get the chance.
It is primarily intended for JavaFX, but we can extend the functionality to most Java programs.
See: https://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm