To compile the file, open your terminal and type
javac filename.java
To run the generated class file, use
java filename
But to do this you need to have the Java JDK installed in your computer. You can install it with the instructions in How do I install Java?.
Answer from Raja G on askubuntu.comWhy is Java considered more of a "first class citizen" in the Linux world compared to .NET/Mono?
Creating java apps for linux
Does Minecraft Java Edition run on Linux?
Java runs on linux, and minecraft java edition does as well.
You can also run bedrock on linux. Using this: https://github.com/ChristopherHX/mcpelauncher-manifest
I bought bedrock on my (android) phone and use that to run it on my PC.
More on reddit.comNeed a way to run Java applets on the current version of Firefox
Java's not really part of the web, and Java's plugin support has been deprecated and removed from both the browser's and Oracle's sides. (The plugin module NPAPI itself is on its way out of the browser, not just for Java)
If you really need to run a java applet, you should use the standalone Java Web Start, javapackager, or JavaFX/WebView tools, not an outdated version of a browser that happens to still support Java: https://www.infoq.com/news/2017/02/oracle-java-browser-applet/
More on reddit.comVideos
To compile the file, open your terminal and type
javac filename.java
To run the generated class file, use
java filename
But to do this you need to have the Java JDK installed in your computer. You can install it with the instructions in How do I install Java?.
OpenJDK works best for me. It's simple and I have never faced any problem with it. Just follow these simple steps:
From Terminal install open jdk
sudo apt-get install openjdk-7-jdkWrite a java program and save the file as filename.java
Now to compile use this command from the terminal
javac filename.javaIf everything works well then a new "filename.class" file should be created.
To run your program that you've just compiled type the command below in terminal:
java filename
NOTE
You can use any text editor (like gedit) ,
replace the filename with watever name you want
you need to be on same directory as the "present working directory" (got by running pwd) while running the command from terminal.