New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

java2js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

java2js - npm Package Compare versions

Comparing version 1.1.9 to 1.1.10

3

ide.js

@@ -8,7 +8,6 @@ (async () => {

jdk.log.value = '';
let translation = await jdk.translate(file0.value);
let translation = await jdk.transpile(file0.value);
console.log(translation);
jdk.load(translation);
jdk.run();
};
})();

@@ -6,5 +6,5 @@ jdk.imports['java.io.InputStream'].load = async () => {

let _this = this;
if (window?.ide) {
ide.log.onkeyup = () => {
_this.stream = ide.log.value;
if (jdk.log) {
jdk.log.onkeyup = () => {
_this.stream = jdk.log.value;
};

@@ -11,0 +11,0 @@ }

{
"name": "java2js",
"version": "1.1.9",
"version": "1.1.10",
"description": "Converts Java to JavaScript with support for p5.js and QuintOS.",

@@ -5,0 +5,0 @@ "main": "jdk.js",

@@ -5,8 +5,6 @@ # Java to JavaScript (java2js)

I made significant improvements to the [java-to-javascript](https://github.com/wyattades/java-to-javascript) transpiler by @wyattades. I also did a modern JS implementation of the fundamental classes in the JDK (Java Development Kit), inspired by [java2javascript](https://github.com/java2script/java2script) by @BobHanson, @zhourenjian, @abego, and others.
Try out the `demo.html` and `ide.js`, a barebones implementation.
I created this project so intro level computer science students could write Java code but still use my [QuintOS](https://github.com/quinton-ashley/quintos) retro game engine library, which is web based.
## Java classes included in the java2js JDK
## Java Classes Included in the JS JDK
| java.io | | |

@@ -41,2 +39,15 @@ | ------- | ----------- | ----------- |

## Features
The java2js transpiler supports:
- imports
- static classes
- static methods
- array literals
- arrays with initial size
- two dimensional arrays
- lambda arrow functions
- triple quotes
## API

@@ -46,18 +57,14 @@

- root (optional) path to the parent folder of the JS `jdk` folder, by default it is `./` you could also link to this package online 'https://unpkg.com/java2js'
This function imports the standard java.lang classes into the global scope. You must use it before translating or running files.
This function imports much of 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'
### await jdk.translate(javaFile)
### await jdk.transpile(javaFile)
- javaFile is a string with contents of a Java file
Translates a Java class and loads it.
returns the Java file translated into JavaScript
- javaFile is a String with a Java class in it
### jdk.load(translatedJSFile)
returns a String with the JavaScript transpilation of the Java class
- translatedJSFile is the translated JS class to run
Loads the JS class file but doesn't run the main method.
### jdk.run(jvmArgs)

@@ -67,13 +74,2 @@

## Features
- imports
- static classes
- static methods
- array literals
- arrays with initial size
- two dimensional arrays
- lambda arrow functions
- triple quotes
## Known limitations

@@ -95,4 +91,12 @@

## Why did you make this?
I created this package so intro level computer science students could write Java code but still use my [QuintOS](https://github.com/quinton-ashley/quintos) retro game engine library, which is web based.
## Credits
This project builds upon the [java-to-javascript](https://github.com/wyattades/java-to-javascript) transpiler by @wyattades. I also did a modern JS implementation of the fundamental classes in the JDK (Java Development Kit), which I got the inspiration to do from [java2javascript](https://github.com/java2script/java2script) by @BobHanson, @zhourenjian, @abego, and others.
## 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!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc