How it works...

To test the JVM, we can byte-compile a Java class on our host and copy it to the target to execute it. For instance, we can use the following simple HelloWorld.java example:

class HelloWorld { 
  public static void main(String[] args) { 
    System.out.println("Hello World!"); 
  } 
} 

To byte-compile it in the host, we need to have a Java SDK installed. To install a Java SDK in Ubuntu, just run the following:

$ sudo apt-get install openjdk-8-jdk

To byte-compile the example, we execute the following:

$ javac HelloWorld.java

To run it, we copy the HelloWorld.class to the target and from the same folder we run the following:

# java HelloWorld
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset