5 ms·
Just a toy implementation[1], if someone is wondering. [1]The basic .class file attribute parsers are located in libs/classfile, while a simple bytecode interp
by drtse4 13y ago
Just a toy implementation[1], if someone is wondering.
[1]The basic .class file attribute parsers are located in libs/classfile, while a simple bytecode interpreter can be found in jvm.js. It doesn't load a real runtime library (classpath, apache harmony,openjdk,etc...) but it partially implements a few java.* classes in pure javascript under libs/java.
- xentronium 13y agoShould be renamed to node-java instead of node-jvm, I think.
- deleted 13y ago[deleted]
- mooreds 13y agoWhat version of java does it handle? Does it support java.lang.*? What other standard libraries?
- drtse4 13y agoIt's too early to talk about java versions, but i suppose he used the latest jvm specification to implement his classfile parser. Only a few methods of some classes of java.lang and java.io (screen output and some basic stuff like String methods,etc..).
- abhididdigi 13y agoPlease feel free to fork it, improve and post back.
- drtse4 13y agoI respectfully decline the offer :)
- danbruc 13y agoCan someone point out what it can do and what it can not do; I am curious what 2.000 lines of JavaScript can do. How much more code would it take to get a full featured implementation?
- drtse4 13y agoIt has a java bytecode interpreter and an initial implementation of a classfile loader. As said above it doesn't have a full implementation of the java runtime, just a few classes to be able to print out to standard output and su things with string and not much else (at least from what i've seen of the content of libs/java). Regarding the loader, it can load a few sections from a classfile, the one containing methods bytecodes, the exceptions table and the constant pool (i.e. where all your string are stored with some other "constants"). How much it could take for a full implementation? It depends of what you mean by full. Even using one of the opensource runtime library like openjdk,classpath,harmony/android i'd say a few years done solo, and not much less with more people, to build something complete and stable enough for general use. Definitely not a simple project.