I was asked to make a Java Applet in class, but NetBeans is recommended. I didn't like an IDE that I wasn't used to. So I wanted to make Java Applet with VS Code, so I will summarize the knowledge at that time I don't know about Linux because it is written on the premise of Windows.
~~ Or rather Java Applet is no longer recommended, right? ?? ?? ?? ~~
--Import what you need
import java.applet.Applet;
import java.awt.*;
――Various things
public class CLASS_NAME extends Applet {
public CLASS_NAME() {
}
public void paint(Graphics g) {
//Make various
}
}
** (This is not the main subject) **
Launch command line
The location of the java file for the cd source
javac source.java
<html>
<head><title>Applet Test</title></head>
<body>
<applet code="CLASS_NAME.class" width="150" height="150">
</applet>
</body>
</html>
It seems that this file name does not matter (I am troublesome, so I use applet.html by changing only the class name)
folder --- Applet.html
|
-- Classes(folder) --- CLASS_NAME.class
2018/11/30 Correction: When codebase
is specified in the above html, it seems to be useless unless it is in that folder, but if you remove codebase, it will be the working folder as it is It looks like you can hit it </ font>
On the command line
appletviewer Applet.html
If there is no error with this, it succeeds If you get an error, check the folder location, class name, and cd location.
Thank you for your hard work.
~~ It's the second time, but Java Applet isn't stupid now ????? ~~
Recommended Posts