Awesome
Generate Ezvcard type definitions for node-java with TypeScript
Instructions for Windows 10:
-
Install JDK 14
-
Install Python 2
-
Use
node
v6.17.1
(ts-java
won't build on later versions) -
Add this to
package.json
:{ "scripts": { "preinstall": "npm run npm-force-resolutions", "npm-force-resolutions": "npm-force-resolutions" }, "resolutions": { "java": "github:joeferner/node-java#master", "find-java-home": "1.1.0" } }
-
Remove
node_modules
andpackage-lock.json
(just in case) -
Run
npm i npm --save
to upgrade tonpm
which understandspackage-lock.json
-
Run
npm i --ignore-scripts
to generatepackage-lock.json
-
Remove
node_modules/java
andnode_modules/ts-java
(to force reinstallation and re-running of build scripts) -
Run
npm i --python=C:\Python27\python.exe
-
In
node_modules\ts-java\lib\ts-java-main.js
removeclasspath.push(rtJarPath);
line. Instead, we'll download and add it topackage.json
. Make sure that it's a full and not stripped down version, use archive manager to look inside of jar, there should be a lot of folders. Or, grab one from this repo.{ "ts-java": { "classpath": "rt.jar" } }
-
Run
node node_modules\ts-java\bin\ts-java.js
and don't wait, go to the next step -
Don't wait for
ts-java.js
to finish, it will never finish for some reason. Instead, look fortsJavaModule.ts
file to be created or updated. Once it's there - terminate script. -
???
-
Profit!
Usage with node-java instructions:
-
See
usage
folder -
Make sure to replace
var fullJarPath: string = path.join(__dirname, "", jarPath); _java.classpath.push(fullJarPath);
with
_java.classpath.push(jarPath);
in case if you're using absolute paths to your
jar
s. -
Don't forget to switch back to the latest NodeJS version (tested on
v14.7.0
) since we don't have to deal with outdatedts-java
sources anymore -
Install deps from
package.json
-
Run
npx ts-node .\index.ts