4 ms·
Forget about this website, just download the most recent OpenJDK version and get at it! As for IDEs, I do recommend IntelliJ for writing the code, but in case
by kaba0 5y ago
Forget about this website, just download the most recent OpenJDK version and get at it!
As for IDEs, I do recommend IntelliJ for writing the code, but in case you want to understand what happens behind the scenes, you can compile the source code directly in the terminal with `javac YourClass.java`, or *.java, depending on how many files you have.
It will by default place the resulting files in the current directory with the convention of creating directories for packages. If you had no package keyword in your files it will result in a simple YourClass.class file that you can run with `java YourClass` (do note that you run classes, not the file itself). If you had something like com.example as a package, it will be placed under WORK_DIR/com/example/YourClass.class.
It should be run from the current work_dir though!
The reason for that is the notion of a class-path, analog of the PATH variable of unix systems. It lists the package-aware class files, and defaults to the working dir, meaning it will find com.example.* files from here, but not elsewhere.
Dependencies are just that, they get concatenated to this class path and thus will be included.
EDIT: You can also just issue `java YourClassWithMain.java`, it will compile and run your class in one go