3 ms·
Actually, a lot of the useful things like ADT illustrations tend to be written as ancient Java applets as well. On the other hand, the Java bytecode is simple
by jcranmer 11y ago
Actually, a lot of the useful things like ADT illustrations tend to be written as ancient Java applets as well.
On the other hand, the Java bytecode is simple enough that it shouldn't be too much work to write an emulator in JS, and, as most of Java is written in Java, all one really needs to write around that is a shell for the AWT and maybe a bit of class/string functionality to get the viewer working. Threading and I/O would be a truly nasty pain, but you could probably bypass most of that.
I'd be more surprised if there weren't already some attempts to work on this.
- tomjen3 11y agoThe problem is that the graphics class allowed you to do things that can only be done in canvas with direct pixel manipulation, which is too slow for interactive programs.
- sand500 11y agoHow about web assembly?
- tomjen3 11y agoA subset of javascript can't do things you already couldn't do in javascript and I doubt their canvas operations are optimized that much (e.g you have to traverse all the pixels and access all their neighbors to write a blur filter, no matter how you do it).
- yincrash 11y agoYou can emulate a 2d canvas in webgl.
- tomjen3 11y agoThat requires webgl to be widely available.
- renaudpawlak 11y agoYes there is: https://dukescript.com/ https://dukescript.com/. But you can also think of transpiled approaches such as GWT. Personally my favorite is JSweet (http://www.jsweet.org http://www.jsweet.org) because you get to write actual JavaScript in Java, and I find that the canvas API and other SVG or WebGL APIs allow much more things that what was done in Java.