title: Can a Java Object be a Prototype of an JavaScript Object in Nashorn?
body: <p>Is it possible to make an Java object the prototype of a JavaScript object? Like the following:</p>
  
  <pre class="lang-js prettyprint-override"><code>var Person = Java.type("Person");
  var hans = new Person();
  hans.name = "Hans";
  
  var employeeFactory = function() {
      var F = function(){};
      F.prototype = hans;
      return new F();
  };
  
  var fritz = employeeFactory();
  print(fritz.name);
  </code></pre>
  
  <p>Here Person is a Java Bean. The variable hans is set as the instance of this Java class. The line hans.name = "Hans" sets the name field in the Java object as expected. But when the object fritz is created in the factory function, it doesn't get linked to the expected prototype. Is there any reason why the Java instance isn't accepted as prototype?</p>