Friday, November 13, 2015

OO Hello World - Nashorn

Hello world in Nashorn is here! An ECMAScript/JavaScript engine implemented by Oracle.

"The Nashorn engine is an implementation of the ECMAScript Edition 5.1 Language Specification. It was fully developed in the Java language as part of the Nashorn project. The code is based on the new features of the Da Vinci Machine, which is the reference implementation of Java Specification Request (JSR) 292: Supporting Dynamically Typed Languages on the Java Platform. 

The Nashorn engine is included in the Java SE Development Kit (JDK). You can invoke Nashorn from a Java application using the Java Scripting API to interpret embedded scripts, or you can pass the script to the jjs or jrunscript tool." Taken from

By the way, you can see my previous post here: where I give some details on WHY these "OO Hello World series" samples.

Version 1 (Minimal):
The minimum you need to type to get your program compiled and running.
function Greet(name) { = name.charAt(0).toUpperCase() + name.slice(1, name.length); 
 this.salute = function() {
  print("Hello " + + "!");

// Greet the world!
var g = new Greet("world");

Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
function Greet(name) { = name.charAt(0).toUpperCase() + name.slice(1, name.length); 

Greet.prototype.salute = function() {
 print("Hello " + + "!");

var g = new Greet("world");

The Program Output:


Nashorn Info:
“Nashorn is a JavaScript engine developed in the Java programming language by Oracle. It is based on the Da Vinci Machine (JSR 292) and has been released with Java 8.” Taken from:

Current Version:
Nashorn 1.8 JavaScript 5.1  (latest version in "Languages" page
Developed by:
Influenced by:
JavaScript (Brendan Eich)
Predecessor Language
Predecessor Appeared
Predecessor Creator
Runtime Target:
Latest Framework Target:
Mono Target:
Allows Unmanaged Code:
Source Code Extension:

Case Sensitive:
Free Version Available:
Open Source:
JSR292 ECMA-262
Latest IDE Support:
Any text editor for JavaScript
Language Reference:
Extra Info:


  1. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    Security Services in Chennai

  2. keep sharing your information regularly for my future reference. This content creates a new hope and inspiration with in me
    Invisalign Treatment In Chennai

  3. Finding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
    SEO Company in Chennai

  4. Truly a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic
    Manpower Consultancy in Bangalore
    Hr Consultancy in bangalore
    Recruitment Consultancy in Bangalore


  5. تتعدد الشركات التي تقدم خدمات ىالتنظيف لاكن لا يمكن ان تكون كلها في نفس مستوي الجوده فان كنت من الباحثين عن جودة الشركه قبل اي شئ اخر فانصحة بزيارة احدي تلك الصفحات
    شركة تنظيف مساجد بالرياض
    شركة تنظيف خزانات بالخرج
    شركة تنظيف بالخرج
    والتي تقدم افضل خدمات التنظيف بالمنزل باعلي مستوي من الكفائه

  6. Its fantatic explaintion lot of information gather it...nice article....
    seo company in Chennai

  7. you are posting a good information for people and keep maintain and give more update too.
    seo services in india


  8. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Payday Cash Advance loan
    Title Car loan
    Cash Advance Loan

  9. very very amazing explaintion....many things gather about yourself...yes realy i enjoy it
    SEO Company in India


  10. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.

    Pawn Shop

    Pawn Loans

    Pawn Shops

    Pawn Loan

    Pawn Shop near me