Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities.

Hello world example

In this example we'll illustrate how to compile a "Hello world !" source on a host PC with Ubuntu Linux using javac and run the bytecode result on the G25 board.

The example of code is the usually Sun example:

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

Install the JDK on your Ubuntu PC using Synaptic. The package name is default-jdk and is the latest Open Source version of Java OpenJDK 6.

Compile the Hello.java file typing:

$ javac Hello.java

Open a terminal session on board and type:

debarm:~# apt-get update
debarm:~# apt-get install default-jre

Go back to the Ubuntu terminal session and copy the Hello.class byte code to the board:

$ scp Hello.class root@:/root
root@'s password: 
Hello.class                                   100%  418     0.4KB/s   00:00    
$

Go to the board and type:

debarm:~# cd /root
debarm:~# java Hello
Hello, world !

Documentation Terms of Use
The Acme Systems srl provides this Debian system development and user manual.
The origin of these doc came from the website: http://www.acmesystems.it
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Creative Commons License

关注我们: 微博

销售邮箱:market@armdevs.com
技术支持: support@armdevs.com
销售电话: +86-755-29638421


核风在线支持>
在线时间:09:00-18:00
Copyright @ 2014 to 2020 - 核风智能技术有限公司