Java arrived in the 1990s, when a refrigerator controller, a feature phone, and a bank server had wildly different memory and CPU budgets. Shipping the full library to every device would have been wasteful, so Java was divided into editions that each fit a device class. The JVM underneath stays the same in all of them, which is what makes the "write once, run anywhere" promise real. The difference between editions is the bundled libraries, not the language itself.
// Java Editions Explained: SE, EE, ME, and FX in one view
public class JavaEditionsDemo {
// 1) Java SE - the foundation you run yourself with main()
public static void seCore() {
java.util.List<String> modules = java.util.List.of("java.lang", "java.util", "java.io");
System.out.println("Java SE core modules : " + modules);
System.out.println("Running on JVM : " + System.getProperty("java.vm.name") + " " + System.getProperty("java.version"));
} // 2) Java EE / Jakarta EE - started by a container, not by main()
// Declared as plain text here so the file compiles without Jakarta dependencies.
static String eeEndpoint(String path) {
return "@Path(\"" + path + "\")";
// handled by Jakarta REST in a container
} // 3) Java ME - a MIDlet lifecycle, no main() on real devices
// 4) JavaFX - extends Application and calls launch()
public static void main(String[] args) {
seCore();
System.out.println("Jakarta EE endpoint : " + eeEndpoint("/customers"));
System.out.println("Java ME device profile: CLDC + MIDP");
System.out.println("JavaFX entry point : Application.launch(args)");
}
}/*
Run output:
Java SE core modules : [java.lang, java.util, java.io]
Running on JVM : OpenJDK 64-Bit Server VM 21.0.2
Jakarta EE endpoint : @Path("/customers")
Java ME device profile: CLDC + MIDP
JavaFX entry point : Application.launch(args)
*/// --- JavaFX companion class (run it separately) ---
/*
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class WelcomeApp extends Application {
@Override
public void start(Stage stage) {
Label title = new Label("Welcome to JavaFX!");
Button clickMe = new Button("Click me");
clickMe.setOnAction(e -> title.setText("Button clicked!"));
VBox layout = new VBox(10);
layout.getChildren().addAll(title, clickMe);
stage.setTitle("JavaFX Demo");
stage.setScene(new Scene(layout, 300, 200));
stage.show();
}
public static void main(String[] args) {
launch(args); // JavaFX uses its own launcher, not plain main()
}
}
*/