Run a .jar (swing) in a browser

Nb0218 -  
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.

1 answer

KX Posted messages 19031 Status Moderator 3 020
 
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.
0
Nb0218
 
Ok, regarding the applets, what solution do you propose?
0
KX Posted messages 19031 Status Moderator 3 020 > Nb0218
 
Could you elaborate on your need?
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.
0
Nb0218
 
I want to make my application accessible to a network from a server.
0
ElementW Posted messages 5690 Status Contributor 1 293 > Nb0218
 
I would have told you to look into Java Web Start/JNLP, except that they have also been obsolete since Java 9.
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
.sh
/
.desktop
for Linux.
0
KX Posted messages 19031 Status Moderator 3 020 > ElementW Posted messages 5690 Status Contributor
 
"an .exe produced by launch4j for Windows"
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
0