Forked from pegasuskim/using java (.jar) in node.js
Created
September 4, 2019 19:21
-
-
Save rnkhouse/06b1ddd4d5b73502ec503a5b470578f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// step 1 install java | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java7-installer | |
sudo npm install java --save | |
// step 2 using | |
var java = require("java"); | |
var jarfile = "jarfileName.jar"; | |
java.classpath.push(jarPath); | |
java.import('package name'); | |
// Examples proguard retrace.jar load | |
var jarfile = "retrace.jar"; //Download -> https://sourceforge.net/projects/proguard/ | |
var jarPath = path.join(__dirname, '..', 'proguard', jarfile); | |
java.classpath.push(jarPath); | |
var retrace = java.import('proguard.retrace.ReTrace'); | |
// use Examples function | |
retrace.getRetracedResult("param 1","param 2") // -> [Function: bound callStaticMethod] | |
retrace.getRetracedResultSync("param 1","param 2") // -> [Function: bound callStaticMethodSync] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment