forked from notmasteryet/jvm-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.html
43 lines (38 loc) · 1.23 KB
/
run.html
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
36
37
38
39
40
41
42
43
<html>
<head>
<script type="text/javascript" src="longvalue.js"></script>
<script type="text/javascript" src="jvm-loader.js"></script>
<script type="text/javascript" src="jvm.js"></script>
<script type="text/javascript" src="jvm-lib.js"></script>
<script type="text/javascript" src="jar-reader.js"></script>
</head>
<body>
<div>
<select id="code">
<option>Hello</option>
<option>Bottles</option>
<option>ZeroDiv</option>
<option>ZeroDivCatch</option>
<option>Class1</option>
<option>TestJar</option>
<option>Gen1</option>
</select> <button id="run">Run</button>
</div>
<script type="text/javascript">
getFactory.searchLocations = [
"sandbox/simple",
loadJarFile("sandbox/jar/testjar.jar"),
"sandbox/generics"
];
var log = function(s) { document.getElementById("log").innerHTML += s.replace(/\</g, "<").replace(/\n/g, "<br>"); };
function run() {
var codeElement = document.getElementById("code");
var className = codeElement.options[codeElement.selectedIndex].value;
document.getElementById("log").innerHTML = "";
var factory = getFactory(className);
factory.statics.main([]);
}
document.getElementById("run").addEventListener("click", run, false);
</script>
<p id="log"></p>
</body></html>