forked from mbebenita/j2me.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
35 lines (31 loc) · 899 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
function load(file, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", file, true);
xhr.responseType = "arraybuffer";
xhr.onload = function () {
cb(xhr.response);
}
xhr.send(null);
}
function runTest(className, cb) {
var jvm = new JVM();
// This is a hack. We should eliminate CLASSES instead.
CLASSES.classes = {};
load("java/classes.jar", function (data) {
jvm.addPath("java/classes.jar", data);
load("tests/tests.jar", function (data) {
jvm.addPath("tests/tests.jar", data);
jvm.run(className);
cb && cb();
});
});
}
//runTest("TestThread");
runTest("RunAll");
//runTest("Andreas");
//runTest("TestArrays");
//runTest("TestDate");
//runTest("TestByteArrayOutputStream");