How to write a node module in Java

58 views
Skip to first unread message

Reza Razavipour

unread,
Aug 4, 2017, 2:13:48 AM8/4/17
to nodejs
I know node can make Java calls. 
What I want to do is the reverse. I want to make my Java code into a node module.

Is that possible? If so, how? If not, why?

Xinyong Wang

unread,
Aug 7, 2017, 5:56:11 PM8/7/17
to nodejs
maybe you can use JNI as a bridge

Xinyong Wang

unread,
Aug 7, 2017, 10:05:01 PM8/7/17
to nodejs

It is possible.

1. You can wrapper the java calls to a separate process, and run it in a subprocess, use stdin/stdout for communication.

OR

2. use JNI, you can implement a native module for nodejs, and call java method in the native module via JNI.

On Friday, August 4, 2017 at 2:13:48 PM UTC+8, Reza Razavipour wrote:
Reply all
Reply to author
Forward
0 new messages