WHAT'S NEW?

Launching an Executable Java Program(OCAJP 1.3)

Launching an executable Java file takes us to the core basics of Java development where we need to compile and execute a Java file.

Let say we have a class by name MyClass.java



class MyClass
{
public static void main(String[] args)
{
System.out.println("Welcome to Java with Z");
}
}


Now for compiling this class we need to use Java Commands.


  • javac for compilation
  • java for execution

Start the command prompt and take it to the folder where your file is kept. And we need to use the following command.

javac
So when we start cmd we will type 




If we have some errors it will show on cmd like

In case if you don't have error we can execute it using java command.



java
For executing the file we need to type 


Remember only class name no extension .java


Following video will demonstrate the whole process.

0 comments:

Post a Comment