Nashorn - Native JavaScript in Java 8 Viktor Gamov Senior Software - - PowerPoint PPT Presentation

nashorn native javascript in java 8
SMART_READER_LITE
LIVE PREVIEW

Nashorn - Native JavaScript in Java 8 Viktor Gamov Senior Software - - PowerPoint PPT Presentation

www.faratasystems.com // follow me : twitter.com/gamussa Nashorn - Native JavaScript in Java 8 Viktor Gamov Senior Software ENGINEER, Farata Systems QCon new york 2014 Why youre here you're excited about JDK8 features Why youre here


slide-1
SLIDE 1 www.faratasystems.com // follow me : twitter.com/gamussa

Nashorn - Native JavaScript in Java 8

Viktor Gamov Senior Software ENGINEER, Farata Systems QCon new york 2014
slide-2
SLIDE 2

Why you’re here

★you're excited about JDK8 features

slide-3
SLIDE 3
slide-4
SLIDE 4

Why you’re here

★you're excited about JDK8 features ★JavaScript enthusiast ★Just need to kill time before Reception

slide-5
SLIDE 5

Who is talking?

★Software engineer and consultant

slide-6
SLIDE 6

WE BUILD APPLICATIONS. WE CREATE IT. YOU OWN IT.

slide-7
SLIDE 7

Who is talking?

★Software engineer and consultant ★co-author and JUG co-lead

slide-8
SLIDE 8
slide-9
SLIDE 9

http://enterprisewebbook.com

Coming to the stores this summer (hopefully)

slide-10
SLIDE 10

Draft available for free

http://enterprisewebbook.com

slide-11
SLIDE 11

Who is talking?

★Software engineer and consultant ★co-author and JUG co-lead ★Guy between you and beer

slide-12
SLIDE 12

Polyglot?

slide-13
SLIDE 13

Everybody knows how to javascript

slide-14
SLIDE 14

JavaScript, wat?

www.destroyallsoftware.com/talks/wat
slide-15
SLIDE 15


 print(3[3]);


slide-16
SLIDE 16

Number.prototype[3] = “qconnewqork"; 
 print(3[3]);


slide-17
SLIDE 17
slide-18
SLIDE 18

MANY good Parts

slide-19
SLIDE 19 SHELL Scripting Extend app functionality on runtime

1 2 3

JAVASCRIPT on JVM USE cASES

WEB-content generation

4

provide extension points for application
slide-20
SLIDE 20

wait, javascript? it’s only for browsers

slide-21
SLIDE 21

JAVAScript is everywhere

★v8 and nodejs ★Rhino was here for years ★Here comes nashorn

slide-22
SLIDE 22

What is Nashorn?

slide-23
SLIDE 23 Ultimate invokedynamic consumer 100% pure Java implementation 100% ECMAScript 5.1 compliant JavaScript Engine for JVM

What is Nashorn?

100% compiled to bytecode, no interpreter http://www.1001ausmalbilder.de/ausmalbilder/gross/ausmalbild-nashorn-7.jpg
slide-24
SLIDE 24

HOW To USE NASHORN?

★ The only API is JSR-223: javax.scripting.* ★ Java from JavaScript and vice versa ★ Create and manipulate Java/JavaScript objects ★ Extend Java classes ★ Implement Java interfaces

slide-25
SLIDE 25

Story one: Curious support engineer

slide-26
SLIDE 26

Story one: Curious support engineer

slide-27
SLIDE 27

Story two: Family BUSINESS

slide-28
SLIDE 28

Story two: Family BUSINESs

slide-29
SLIDE 29

Story Three: NASHORN for Browser

slide-30
SLIDE 30

NASHORN in «wild life»

★ vert.x nashorn module ★ Project Avatar (former node.jar)

slide-31
SLIDE 31

Demo

slide-32
SLIDE 32

Restrictions

★ There ARE No browser APIs: ★ HTML5 canvas ★ HTML5 audio ★ WebWorkers ★ WebSockets ★ WebGL

slide-33
SLIDE 33

SHOW ME THE CODE

https://github.com/gAmUssA/java-scripting-experiments
slide-34
SLIDE 34

Q&A

slide-35
SLIDE 35

THANKS

FOR YOUR ATTENTION www.faratasystems.com // follow me : twitter.com/gamussa