BOF7908_Green - ACTIVEevents.com

sizzlepictureΛογισμικό & κατασκευή λογ/κού

2 Δεκ 2013 (πριν από 3 χρόνια και 4 μήνες)

185 εμφανίσεις

1

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

1

BOF7908 Java and Friends
on the Raspberry Pi:

What to do Next

Daniel Green, Oracle, Java Embedded GBU

Senior Systems Engineer

3

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Java options for the Raspberry Pi device include
Java Development Kit 8 (with
JavaFX) for ARM

early access and the
Oracle Java ME Embedded 3.3

early
access release. Java
-
based solutions such as
Oracle Java Embedded Suite

and
Oracle Event Processing

for Oracle Java Embedded are also options that
are able to run on
ARM
-
based single
-
board computers such as the
Raspberry Pi
. The Raspberry Pi is a good hobbyist / developer ARM board for
getting started with Java and friends with minimum hardware costs, and
additional options such as
Oracle Berkeley DB

and
Minecraft

make it an
interesting platform to experiment with. This session provides examples of what
you can do with Oracle
Java Embedded tools

on this and other embedded
developer platforms.

BOF7908 Session Description

4

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Program Agenda


Raspberry Pi & ARM SBC developer boards overview


Java JDK 8


Java FX


Java SE Embedded


Java ME Embedded


Tools, Database,
Minecraft
, Scratch, Others

5

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


javamagazine.com
-

February 2013,

Java Arrives on a $25 Board


with
Eben Upton, Raspberry Pi Foundation Founder

6

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview



System on Chip:

Broadcom BCM2835


ARM Processor:

ARM1176JZFS @ 700 MHz


Graphics:

Videocore 4 GPU



Also:

floating point
hardware support


7

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


8

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


9

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


10

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


11

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


http://makezine.com/magazine/how
-
to
-
choose
-
the
-
right
-
platform
-
raspberry
-
pi
-
or
-
beaglebone
-
black/

12

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Raspberry Pi & ARM SBC developer boards overview


http://makezine.com/magazine/how
-
to
-
choose
-
the
-
right
-
platform
-
raspberry
-
pi
-
or
-
beaglebone
-
black/

13

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi


Platform
Footprint

Device


CPU/

GPU/I
-
O

Java
Card

Oracle Java
Embedded
Client (CDC)

Medium

Java SE
Embedded

Large

Security

Java ME Embedded
(CLDC)

Small


ARM 7 Cortex M ARM9/11 MIPS32/Intel Atom/ARM CortexA/PPC


50KB
-
1MB

1MB
-
10MB

10MB
-
100MB

CPU

JDK8

JavaFX

JDK 8


14

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi


jdk8.java.net/download.html

15

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi
-

SETUP STEPS


from
oracle.com/hinkmond/entry/quickie_guide_getting_hard_float

1.

Download the
Win32DiskImager

if you are on Windows, or if your are on a Mac/Linux PC skip this download and
use dd instead:

http://downloads.sourceforge.net/project/win32diskimager/Archive/win32diskimager
-
v0.7
-
binary.zip


2.

Download the Raspberry Pi Hard
-
Float Debian Wheezy image from here:


http://downloads.raspberrypi.org/images/raspbian/2012
-
12
-
16
-
wheezy
-
raspbian/2012
-
12
-
16
-
wheezy
-
ra
spbian.zip


3.

Insert a blank SD Card into your Windows/Mac/Linux PC

16

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi
-

SETUP STEPS


from
oracle.com/hinkmond/entry/quickie_guide_getting_hard_float

4.

Use Win32DiskImager on a Windows PC (or on Mac/Linux use "
sudo dd if=<path_to_raspian.img> of=/dev/[diskNN|sdd]
bs=[1m|4m]
" or similar command to burn the unzipped image from
#2

to the SD Card.

5.
Insert the SD Card into your Rasberry Pi. Connect an Ethernet cable from your RPi Ethernet port to your network.
Connect the RPi Power Adapter.

6.

The RPi will boot onto your network. Find its IP address by referring to your
network DHCP settings or by using
Windows
Wireshark

or the Mac/Linux tcpdump command:



sudo tcpdump
-
vv
-
i[en0|en1|eth0|eth1] port 67 and port 68



<Password: "raspberry">

17

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi
-

SETUP STEPS


from
oracle.com/hinkmond/entry/quickie_guide_getting_hard_float

7. Download JDK 8 for ARM Early Access (with Hard
-
Float support):


http://jdk8.java.net/download.html


NOTE: First click the "Accept License Agreement" button, then choose:


Linux ARMv6/7 VFP, HardFP ABI "tar.gz" under the "JDK" column

8. scp the bundle from step #7 to your RPi:



scp <jdk8
-
zip
-
bundle> pi@<ip_addr_rpi>:/home/pi



<Password: "raspberry">

9. ssh to your RPi:



ssh <ip_addr_rpi>
-
l pi


<Password: "raspberry">


18

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi
-

SETUP STEPS


from
oracle.com/hinkmond/entry/quickie_guide_getting_hard_float

10.

Untar the bundle from step
#8

and rename (move) the top level directory to /usr/local/java



cd /home/pi



tar zxvf jdk
-
8
-
ea
-
b36e
-
linux
-
arm
-
hflt
-
29_nov_2012.tar.gz



sudo mv jdk1.8.0 /usr/local/java



export PATH=$PATH:/usr/local/java/bin



java
-
version



...


19

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java JDK 8 for Raspberry Pi
-

SETUP STEPS


from
oracle.com/hinkmond/entry/quickie_guide_getting_hard_float

11. Compile on your device!




cd /home/pi



cat > HelloWorld.java



public class HelloWorld {



public static void main(String args[]) {



java.lang.System.out.println("Hello World!");



}



}



^D



javac HelloWorld.java



java
-
cp . HelloWorld

20

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

20

Java JDK 8 for Raspberry Pi
-

support in NetBeans 7.4



finally, for development, get NetBeans 7.4 from
http://netbeans.org


NetBeans 7.4 has
redesigned to more easily support the JDK 8 architecture and JavaFX 2

21

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX



Rapberry Pi Graphics Hardware: Videocore 4 GPU


GPU is capable of
BluRay

quality playback


using H.264 at 40MBits/s.


fast 3D core accessed using OpenGL ES2.0 and OpenVG libraries


JavaFX Graphics Features


JavaFX features are listed on
http://javafx.com


Media support and WebView are not currently
supported for Raspberry Pi


see demo shown at
http://fxexperien
ce.com/2013/08/javafx
-
hd
-
menus
-
on
-
raspberrypi/

for description
of work
around for omx media player integration

22

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX


JavaFX and Media on Raspberry Pi

Jasper

Potts

says
:

There

is

no

JavaFX

media

support

on

Pi
,

we

prototyped

passing

hardware

decoded

frames

of

video

into

OpenGL

so

that

it

could

be

drawn

in

JavaFX

Scene

but

performance

was

not

great
.

So

what

we

do

is

draw

JavaFX

with

a

transparent

background

just

like

a

transparent

window

on

desktop
.

Then

use

the

native

omx

media

player

to

play

video

to

a

lower

layer

under

the

JavaFX

graphics
.

So

basically

standard

hardware

overlay

graphics
.

This

works

great

on

PI

and

there

is

only

about

a

10
%

drop

in

JavaFX

performance

when

playing

a

HD

video

stream

underneath
.

So

simple

animations

we

can

get

50
+

fps

with

video

at

same

time
.

23

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX

and Media on Raspberry Pi


VIDEO AVAILABLE AT:

https://dl.dropboxusercontent.com/u/1352106/Oracle/JavaOne/2013/BOF7908_JaFotRP_Wtdn/Chess%20R
obot%20at%20JavaOne%202013.mov

24

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX

on Raspberry Pi vs.
BluRay

Disc Java


Previous demo shows a
basic overlay of graphics on top of video


we could have done the same with the Java ME CDC Personal Basis
Profile API in BluRay Disc Java


The

2.5D


effect in the scene menu is an affine transform done in graphics
hardware


you
can't do that in BluRay Disc
-
Java
, to get the same effect you would
have had to prepare sheared versions of the scene images in advance


Other demo elements, all are
trivial in JavaFX in RPi GPU Hardware



large text (you can do this in BluRay Disc Java)


rotated text (can't do it in BluRay Disc Java)


animated text (can't do well in BluRay Disc Java)


rotated images in the scene menu (BluRay Disc Java would pre
-
prepared
sheared images)

25

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX on Raspberry Pi vs. BluRay Disc Java


The demo show an animated 3D carousel


this is
way beyond what BluRay Disc Java


the
models

used were
prepared using standard tools

(Autodesk, Maya) and
imported by JavaFX


this is now starting to tax the abilities of the Raspberry Pi
GPU hardware, on faster hardware it would perform more
smoothly


Additional demo bits have a 3D robot figure


the figure was developed in a
standard 3D modeling tool


a number of updates around

improved JavaFX importers
were mentioned in the conference keynote

26

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

JavaFX Samples



http://www.oracle.com/technetwork/java/javafx/sampl
es/index.html


O
ver 100 sample applications including:


graphics, UI controls, animation, charts


Source code for each sample and links to API
documentation are provided


http://www.oracle.com/technetwork/java/javase/down
loads/jdk7
-
downloads
-
1880260.html


Samples include:


An end
-
to
-
end solution for a fictional global
automobile company


Login demo UI that demonstrates a simple
login system and user
sessionBrickBreaker classic game that
demonstrates the use of JavaFX
animation, images, and effects

27

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

27

JavaFX Samples (from NetBeans)


28

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded for Raspberry Pi


Platform
Footprint

Device


CPU/

GPU/I
-
O

Java
Card

Oracle Java
Embedded
Client (CDC)

Medium

Java SE
Embedded

Large

Security

Java ME Embedded
(CLDC)

Small


ARM 7 Cortex M ARM9/11 MIPS32/Intel Atom/ARM CortexA/PPC


50KB
-
1MB

1MB
-
10MB

10MB
-
100MB

CPU

JDK8

JavaFX

JDK 8


29

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded


oracle.com/technetwork/java/embedded/downloads/javase/index.html

30

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded and Hard Float
vs

Soft Float


Different types of Java Standard Edition Embedded binary for download


pure soft
-
float

ƒ
won't use the Floating Point Unit ARM hardware even if it's
available


VFP

(Vector Floating Point)


uses the soft
-
float ABI but will internally use the Floating Point Unit
ARM hardware if it's available


hard float


uses the Floating Point Unit ARM hardware directly


There’
s a
big difference

in floating point performance between

hard
float


and

soft float



There

s
not much difference

between

hard float


and

VFP


unless

you

re running a lot of platform

native code via JNI

which involves floating
point calculations

31

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded plus Embedded Suite

32

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded plus Embedded Suite

Oracle Java Embedded Suite 7 includes:


-

Java SE Embedded 7u6 &higher


-

Java DB 10.8 & higher


-

Glassfish 3.1 & higher


-

Jersey 1.11 & higher

33

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded plus Oracle Event Processing

Java SE
Embedded

Java SE
Embedded

Java Enterprise
Edition

Java EE

Java
EE

34

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java SE Embedded plus Oracle Event Processing


Visual and Java
-
based
development tooling for
defining event processing
applications and networks



Supports high throughput
(hundreds of thousands of
events per second) and low
latency processing



Comprehensive event
processing query language
based on standard SQL
syntax


Pre
-
Integration with best
-
in
-
class Oracle Java
Embedded platforms


High
-
speed real
-
time data
capture and analysis
optimized for embedded
devices

35

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

also recently announced avatar.java.net


JavaScript / Nashorn vs. full Java Standard Edition


Glassfish application server, similar to JES / OEP bundles

36

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded for Raspberry Pi


Platform
Footprint

Device


CPU/

GPU/I
-
O

Java
Card

Oracle Java
Embedded
Client (CDC)

Medium

Java SE
Embedded

Large

Security

Java ME Embedded
(CLDC)

Small


ARM 7 Cortex M ARM9/11 MIPS32/Intel Atom/ARM CortexA/PPC


50KB
-
1MB

1MB
-
10MB

10MB
-
100MB

CPU

JDK8

JavaFX

JDK 8


37

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded


oracle.com/technetwork/java/embedded/downloads/javame/index.html

38

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded



JavaOne 2013 Robotic Chess Demo


Robot is controlled with a Raspberry Pi running Java
ME code

39

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded Demo

VIDEO AVAILABLE AT:

https://dl.dropboxusercontent.com/u/1352106/Oracle/JavaOne/2013/BOF7908_JaFotRP_Wtdn/Chess%20Robot
%20at%20JavaOne%202013.mov

40

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded Example on
Keil

Board

41

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded Example with GPIO Array

https://www.youtube.com/watch?v=nA7AMuTK9sE

Getting Started with Oracle Java ME Embedded and Raspberry Pi
-

Simon
Ritter

42

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Java ME Embedded and Raspberry Pi GPIO Array


Pi Cobbler from Adafruit
Industries


costs a whopping $7.95


plugs in directly to
Raspberry Pi GPIO
Array pins


Provides small
breadboard for
electronics experiments

43

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

43


Tools, Database, Minecraft, Scratch, Others

oracle.com/technetwork/java/javame/javamobile/download/sdk/index.html

44

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

oracle.com/technetwork/products/berkeleydb/overview/index.html

45

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

http://pi.minecraft.net

46

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

adafruit.com/blog/2013/07/19/raspberry_pi
-
piday
-
raspberrypi
-
8/


excessive

amounts of info on
scratch available at:


http://scratch.mit.edu


http://scratched.media
.mit.edu

47

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


A Humble Plug for Java, Minecraft and Scratch via Raspberry Pi

drag

&
drop

coding

in

Java

A.K.A. BOF8012 Teaching Java with
Minecraft, Greenfoot and Scratch

TUESDAY 4:30PM Hilton Continental Ballroom 5

48

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

Showdown: JavaFX on Raspberry Pi

[BOF2247]

Monday, Sep 23, 5:30 PM
-

6:15 PM
-

Hilton
-

Plaza A


Creating
a Supercomputer with the Raspberry Pi, Using Hazelcast

[BOF7786]

Monday,
Sep 23, 5:30 PM
-

6:15 PM
-

Hotel Nikko
-

Monterey I/II


Mocha Raspberry Pi

Cooking Class

[HOL7865]

Tuesday, Sep 24,
12:30 PM
-

2:30 PM
-

Hilton
-

Franciscan A/B/C/D


Performance Testing with a
Raspberry Pi Wall Running Java

[CON4177]

Thursday, Sep 26, 12:30 PM

-

1:30 PM
-

Hilton
-

Continental Ballroom 5


Let

s Get Physical: I/O Programming
with Java on the Raspberry Pi with Pi4J

[CON7968]

Wednesday, Sep 25, 11:30 AM
-

12:30

PM
-

Hotel Nikko
-

Monterey I/II


M2M with Enterprise Java on the Raspberry Pi

[BOF7871]

Tuesday, Sep 24, 5:30 PM
-

6:15 PM
-

Hotel N
ikko
-

Nikko Ballroom II/III


Beyond Beauty: JavaFX, Parallax, Touch, Raspberry Pi,
Gyroscopes, and Much More

[CON2540]

Wednesday, Sep 25, 11:30 AM
-

12:30 PM
-

Hilton
-

Pla
za A

49

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

Java and the Raspberry Pi: DIY to a New Level

[UGF10548]

Sunday, Sep 22, 9:15 AM
-

10:15 AM
-

Moscone West
-

3020


JMS, WebSo
cket, and the Internet of Things: Controlling Physical Devices on the Real
-
Time Web

[CON3914]

Wednesday
, Sep 25, 1:00 PM
-

2:00 PM
-

Hotel Nikko
-

Carmel I/II


Making Your JavaFX
Application Fly on the Raspberry Pi

[CON4367]

Monday, Sep 23, 3:
00 PM
-

4:00 PM
-

Hilton
-

Plaza A


Of Raspberries, Dolphins, an
d Chickens: Visualizing Embedded Data with JavaFX

[CON2258]

Wednesday, Sep 25, 10:00 AM

-

11:00 AM
-

Hilton
-

Plaza A


Is It a Car? Is It a Computer? No, It

s a Raspberry Pi JavaFX Informatics System

[CON3243]

Tuesday, Sep 24, 11:30 AM
-

12:30 PM

-

Hilton
-

Plaza A


Collect Real
-
Time Enterprise Data with Raspber
ry Pi, Java SE Embedded, Oracle Event Processing

[CON7132]

Tuesday, Sep 24, 3:00 PM
-

4:00 PM
-

Hotel Ni
kko
-

Carmel I/II

50

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

Zero to Deploy: Getting Up to Speed on Oracle Java SE Embedded

[TUT7730]

Tuesday, Sep 24, 4:30 PM
-

6:30 PM
-

Hotel Nikko
-

Nikko Ballroom I


Connect a

Raspberry Pi to a Data Center with Oracle Java SE Embedded Communication Protocols

[BOF7102]

Tuesday,

Sep 24, 6:30 PM
-

7:15 PM
-

Hotel Nikko
-

Nikko Ballroom II/III


Java Embedded Extr
eme Mashups: Building Self
-
Powering Sensor Nets for the Internet of Things

[TUT3676]

Tuesday, Sep 24,
12:30 PM
-

2:30 PM
-

Hotel Nikko
-

Nikko Ballroom I


Anatomy of a Hybrid JavaScr
ipt/Java Server Application

[BOF7981]

Monday, Sep 23, 7:30 PM
-

8:15 PM
-

Hilton
-

Imperial Ballroom B


JavaFX, Widgets, and Apps, Oh My! La
unching Frameworks for Platforms Large and Small

[BOF2605]

Tuesday, Sep 24, 6:30 PM
-

7:15 PM
-

Hilton
-

Plaza A


How to Get More Kids to Code

[CON3023]

Wednes
day, Sep 25, 11:30 AM
-

12:30 PM
-

Hil
ton
-

Continental Ballroom 6


Angry Nerds II: The Nerds Strike Back

[CON4030]

Tuesda
y, Sep 24, 1:00 PM
-

2:00 PM
-

Hilton
-

Plaza A

51

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.


Tools, Database, Minecraft, Scratch, Others

Internet of Things Edge Devices: ARM Embedded for Java Developers

[CON6607]

Wednesday, Sep 25, 3:00 PM
-

4:00 PM
-

Hotel Nikko
-

Monterey I/II


JavaRCX:
A Java Embedded Lego Mindstorm RCX Emulator

[BOF7901]

Tuesday,

Sep 24, 7:30 PM
-

8:15 PM
-

Hotel Nikko
-

Monterey I/II


Home Automation in

Action

[CON7773]

Tuesday, Sep 24,
3:00 PM
-

4:00 PM
-

Hotel Nikko
-

Nikko Ballroom II/III


nuvos: The Universal SDK

Wr
ite in Java; Run on IOS, Android, HTML5, and JVM

[CON10821]

Wednesday, Sep 25, 8:30 AM

-

9:30 AM
-

Hilton
-

Golden Gate 4/5

Thursday, Sep 26, 11:00 AM
-

12:00 PM
-

Hilton
-

Golden Gate 4/5


Home Automation for Geeks

[CON9177]

T
hursday, Sep 26, 11:00 AM
-

12:00 P
M
-

Hotel Nikko
-

Monterey I/II

BOF7908 Java and Friends
on the Raspberry Pi:

What to do Next

Daniel Green, Oracle, Java Embedded GBU

Senior Systems Engineer

53

Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

53