Export Java applet to .jar

My problem:

When I tried to export my applet, I could not find the "main class". When I double click on the exported jar file, nothing appears, but when I compile my code, it works great!

The code here import java.applet.*; import java.net.*; import javax.swing.*; import javax.swing.border.Border; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.net.URL; public class Jap_Learn extends JApplet { AudioClip SOUND; AudioClip SOUND1; public void init() { Dimension Screensize = Toolkit.getDefaultToolkit().getScreenSize(); JFrame fr = new MainFrame(); String Serial; Serial = JOptionPane.showInputDialog("Set serial of The prOduct"); int ISerial; ISerial = Integer.parseInt(Serial); if(ISerial == 47) {fr.show(); SOUND = getAudioClip(getCodeBase(),"Music.wav"); SOUND.play();} else { SOUND1 = getAudioClip(getCodeBase(),"TestSnd.wav"); SOUND1.play(); JOptionPane.showMessageDialog(null, "wrOng serial !"); } } 
+2
source share
1 answer

A jar file and an applet are two different things. You should consider reading some basics. An applet is launched from a web page and does not have a main method. It has its own method loop. You cannot start it by double-clicking the jar file, but you must name it from the web page.

Think about it:

+1
source

Source: https://habr.com/ru/post/950615/


All Articles