title: how to call Nodejs function from java
body: <p>I want to call node js function from java:</p>
  <p>here is my hello.js javascript code:</p>
  <pre><code>function myFun(param)
  {
       console.log(&quot;hello&quot;+param);
  }
  </code></pre>
  <p>here is my java code:</p>
  <pre><code>public static void main(String[] args) throws IOException {
    Process process = new ProcessBuilder(&quot;C:\\Program Files\\nodejs\\node.exe&quot;,&quot;hello.js&quot;).start();
    InputStream is = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    
    
    while ((line = br.readLine()) != null) {
      System.out.println(line);
    }
      }
  </code></pre>
  <p>With this java code i am able to execute hello.js file but i want to call myFun function and set the parameters in this function from java code .. is it possible to do this.</p>