Aug 8th, 2016

Branching Without an if, A Java Puzzle

I returned home late the other night, and saw this tweet in my timeline: Keyboard broken. Write this Java code without using the letter 'f': int bar(Object o) { if (o == null) return 0; else return 1;} Anyone? — Marc Khouzam (@marckhouzam) August 5, 2016 He added a clarifying note that said the ‘?’ [...]

by 14 Comments

Aug 3rd, 2016

Tabris.js 1.9 is here

Picker underline on Android

The long-awaited imageData support is here, together with new lifecycle events, enhancements to WebView handling, and much more. In addition, Tabris.js now has a public playground! Read on for more highlights. Tabris.js playground No more need to sign in via GitHub to see your code in action. In the online playground, the changes you make are instantly available on your [...]

by Leave a Comment
Jul 29th, 2016

Improved Memory Management with J2V8

Memory management in J2V8 has never been easy. Because J2V8 bridges V8 and Java, three different memory models are in play. Both Java and JavaScript provide a managed memory model with their own GC. JNI / C++ which sits in the middle is completely unmanaged. This leads to a complex situation since both JavaScript and [...]

by Leave a Comment
Jul 27th, 2016

Java Methods as JSFunctions

When J2V8 was first released, all callbacks from JavaScript to Java required a registered Java method. That is, all Java methods that you wished to invoke had to be first registered with J2V8. For some applications this was fine, but it made for a complex programming model. Furthermore you could not use anonymous inner classes [...]

by 2 Comments
Jul 26th, 2016

EclipseCon video: Node.js in a Java World

sl1

Last week I finally published the Node.js bindings for Java. These bindings allow developers to embed the Node.js runtime directly onto the JVM through the Java Native Interface. In March I gave a pre-release presentation at EclipseCon on this work, which was recorded by InfoQ. You can check it out at: https://www.infoq.com/presentations/node4j-nodejs-java. The slides are also [...]

by Leave a Comment
Jul 26th, 2016

🎉🌞💐 J2V8 Supports 16bit Characters

Screen Shot 2016-07-25 at 3.22.19 PM

When J2V8 was first released, all Java characters passed between Java and V8 were converted to 8bit C-Style strings. For many applications this was just fine, but if your JavaScript contained 16 bit Unicode characters, then you were hosed. When you use the word "hosed" to mean broken, you're probably Canadian. — Wayne Beaton (@waynebeaton) [...]

by Leave a Comment
Jul 25th, 2016

TypedArrays — Sharing Memory Between V8 and Java

J2V8 provides the technology to link V8 and Node.js with the JVM. Using JNI, Java developers can directly call V8 and Node.js APIs. This seamless integration brings improved JavaScript performance, NPM modules and the Node.js APIs to the Java ecosystem. An alternative approach could have been to invoke two separate processes (Java and Node.js) with a [...]

by Leave a Comment
Jul 20th, 2016

Announcing J2V8 4

After over a year of development, I am very excited to announce that J2V8 4 is publicly available on all supported platforms. J2V8 is a set of V8 bindings for Java. This means that you can embed V8 (Google’s ultra fast JavaScript engine) into your Java applications. J2V8 4 is built on Node.js, which means you can [...]

by 4 Comments
Jul 20th, 2016

Running Node.js on the JVM

J2V8-with-no-2-and-J

Gone are the days of single vendor lock-in, where one technology stack is used across an entire organization. Even small organizations and hobbyists will find themselves mixing technologies in a single project. For years, Java reigned king on the server. Today Node.js is everywhere. But even with the rise of Node.js and popularity of JavaScript, [...]

by 4 Comments