This is a simple demo for hybrid Java exercises using native Java compiler but executed with an Embdedded Micro Java VM supporting extended run-time profiling.

An internal execution function (command) callable from websh:

[FUN]
async function runExe(print,workdir,argv) {
  print(workdir+": uJ "+argv.join(' '))
  var classes = await FS.list(workdir)
  console.log(classes)
  if (!(classes instanceof Error)) {
    var classes=classes.files.filter(file => /\.class/.test(file.name)).map(file => file.name)
    var files={}
    for(file of classes) {
      print("Loading class file "+file)
      var data = await FS.load(workdir,file,'binary')
      if (!(data instanceof Error) && data.reply)
        files[file]=data.reply
      else print("Failed loading class file "+file,data);
    }
    main=argv[0]
    classes=classes.filter(file => file!=main)
    UJ.run(print,[main],files,console.log)
  } else print("Cannot get class list from container.\n");
}

wex

The software wex (Web Browser Execution Service) at least Ver. 1.11.1 is required. the WebSocket conenction service must be available (requires ws nodejs package).

After starting wex you should get the following messages:

[WEX] WebSocket Service started (ws://localhost:11112)
[WEX] WEB Processor Ver. 1.11.2 started.
[WEX] HTTP Service started (http://localhost:11111)

And after opening this exercise:

[WEX] Opened shell session 0 on WS port 11113
[WEX] session ws.connection.open

Java

You need a Java SDK (run-time package is not sufficient) installation with propoer set-up of the executable paths.

uJ

#label

{ height:20; file:"$TEMPDIR0/Test.java"; autosave:1}
Java Code (Test.java)

{ _rows:25; la:"ls -la"; make:"javac --release 7 -cp RT.real.jar:RT.fake.jar Test.java";
  run:"$runExe Test.class"; _workdir:"/tmp"; _tmp:"test", _filecopy:"RT.fake.jar,RT.real.jar"}
Test the test. Execute make (Linux, Mac) or makew (Windows) and run. (websh index 0)
Type help or hit TAB for a list of commands.


Created by the NoteBook Compiler Ver. 1.39.2 (c) Dr. Stefan Bosse (Mon Nov 03 2025 21:13:38 GMT+0100 (Central European Standard Time))