Question:
I wrote a simple Hello World program in notepad and saved it as it should.
What to do next to get a program out of it?
Answer:
on the gnu/linux operating system, with the javac
and java
programs installed, this is the file:
class helloworld {
public static void main(String[] args) {
System.out.println("hello world!");
}
}
saved in the current directory as helloworld.java
can be compiled with the command:
$ javac helloworld.java
and run the resulting helloworld.class
file with the command:
$ java helloworld
conclusion:
hello world!
You can install the javac
and java
programs in different ways, the simplest and most logical one is from the repository of your distribution. for example, on debian -major distributions, this can be done with the command:
$ sudo apt install default-jdk