有没有一种方法可以通过Node.js访问不是主方法的Java类?

huangapple go评论99阅读模式
英文:

Is there a way to access Java classes that are not the main method through node.js?

问题

我需要通过node.js访问一个Java算法,该算法对图像进行AES/CBC/PKCS5Padding加密。我尝试在node.js中重新创建这个逻辑,但有些库只能在Java中找到。

我无法更改.jar文件,只能调用它的方法。

提前感谢!

英文:

I need to access a Java algorithm through node.js that encrypts an image to AES/CBC/PKCS5Padding. I tried recreating the logic in node.js but there are certain libraries that can only be found in Java

I can't make changes to the .jar file, I can only call it's methods.

Thanks in advance!

答案1

得分: 0

我认为从Node.js代码库到JAR文件的通信是不可能的。如果您想要加密图像,以下模块将有所帮助:

  1. node-file-encrypt - npm
  2. file-encryptor - npm
  3. crypto
英文:

I think that is not possible to communicate from nodejs code base to jar file. if you want to encrypt an image below modules will help.
1.node-file-encrypt - npm
2.file-encryptor - npm
3. crypto

答案2

得分: 0

我已经弄清楚如何做了。所以你可以使用node-jre并使用它来调用.jar文件,设置jar路径和主类

我不得不对原始的.jar文件进行更改,并添加一个主类来调用它。

英文:

just figured how to do it. So we you can use node-jre and use that to call the .jar file by setting the jar path and the main class

I had to make changes in the original .jar file and add a main class to call it

huangapple
  • 本文由 发表于 2020年7月30日 10:15:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/63165159.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定