From 28c28d298a0ae2f4b378ed8706a0228cae5a2feb Mon Sep 17 00:00:00 2001 From: Quinton Ashley Date: Mon, 21 Feb 2022 11:32:58 -0500 Subject: [PATCH] 1.1.12 --- README.md | 6 +++++- docs/ide.js | 2 +- jdk.js | 4 ++-- package.json | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b355a20..17a3550 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The java2js transpiler supports: This function imports the standard java.lang classes into the global scope. You must use it before translating or running files. -- root (optional) path to the parent folder of the JS `jdk` folder, by default it is `.` (the current directory) you could also link to this package online 'https://unpkg.com/java2js' +- root (optional) path to the JS JDK folder, by default it is `./jdk` (the java2js JS JDK), for online use on codepen or similar code sharing sites you can use this link as the root path: 'https://unpkg.com/java2js/jdk' ### await jdk.transpile(javaFile) @@ -95,3 +95,7 @@ This project builds upon the [java-to-javascript](https://github.com/wyattades/j ## Contribute I've only done a partial implementation of the Java 17 JDK in JavaScript, so if you're interested in adding more please go for it and submit a pull request! + +## Commercial Use + +This project is licensed under the copyleft GNU GENERAL PUBLIC LICENSE 3.0 (only) license. If you'd like to request legal permission to use this code in a commerical product or closed source project please email me (qashto@gmail.com) with a proposal of how you would like to use `java2js`. diff --git a/docs/ide.js b/docs/ide.js index 22052ac..25e966a 100644 --- a/docs/ide.js +++ b/docs/ide.js @@ -1,6 +1,6 @@ (async () => { jdk.log = document.getElementById('javaConsole'); - await jdk.init('..'); + await jdk.init('../jdk'); let file0 = document.getElementById('javaFile'); file0.onchange = async () => { diff --git a/jdk.js b/jdk.js index 1b2a3e3..73938f9 100755 --- a/jdk.js +++ b/jdk.js @@ -48,7 +48,7 @@ constructor() {} async init(root) { - this.root = root || '.'; + this.root = root || './jdk'; this.java = {}; let pkgs = ['com', 'io', 'lang', 'org', 'security', 'time', 'util']; for (let pkg of pkgs) { @@ -129,7 +129,7 @@ imp.load = null; imp.classPath = className.split('.'); - let src = this.root + '/jdk'; + let src = this.root; for (let part of imp.classPath) { src += '/' + part; } diff --git a/package.json b/package.json index da1d307..1e09765 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "java2js", - "version": "1.1.11", + "version": "1.1.12", "description": "Converts Java to JavaScript and runs it with a JS JDK", "main": "jdk.js", "scripts": {