Java Getting Started | |||
| |||
Some PCs might have Java already installed. To check if you have Java installed on a Windows PC, search in the start bar for Java or type the following in Command Prompt (cmd.exe):
If Java is installed, you will see something like this (depending on version):
If you do not have Java installed on your computer, you can download it for free at oracle.com. Note: In this tutorial, we will write Java code in a text editor. However, it is possible to write Java in an Integrated Development Environment, such as IntelliJ IDEA, Netbeans or Eclipse, which are particularly useful when managing larger collections of Java files. Java Quickstart In Java, every application begins with a class name, and that class must match the filename. Let's create our first Java file, called Main.java, which can be done in any text editor (like Notepad). The file should contain a "Hello World" message, which is written with the following code:
For now, focus on how to run the code above. Save the code in Notepad as "Main.java". Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type "javac Main.java":
This will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type "java Main" to run the file:
The output should be like below:
Tags: Java Java Environment Java Install Java Setup | |||
| |||
| |||
Login for comment |
OTHER POSTS IN THE SAME CATEGORYJava Abstract Classes and MethodsJava Classes and ObjectsJava RecursionJava ScopeJava MethodsJava ArraysJava While Loop/Do While Loop/For Loop/For-Each Loop/Break/ContinueJava Switch StatementsJava Short Hand If...Else (Ternary Operator)Java If ... ElseJava MathJava VariablesJava CommentsThe Print() MethodJava SyntaxWhat is Java? |