Skip to content

Porting Java applications to OSv

Geraldo Netto edited this page Feb 26, 2018 · 8 revisions

The easiest way to Port a Java application to OSv is using Capstan.

You can use the following example as a starting point.

Using a ready Java enable OSv VM

  • Build JVM & CLI image first

    make image=java,cli
    
  • Run OSv instance

    ./scripts/run.py -n
    
  • Upload new .jar file

    curl -X POST http://192.168.122.89:8000/file/js.jar [email protected]
    
  • Run the application

    curl -X PUT http://192.168.122.89:8000/app?command=java.so%20-jar%20js.jar
    

Alternatively, you can change the image cmdline and reboot:

  • Change cmdline to run .jar file

    curl -X POST -d cmdline="java.so -jar js.jar" \
    http://192.168.122.89:8000/os/cmdline
    
  • Reboot OSv instance

    curl -X POST http://192.168.122.89:8000/os/reboot
    

Troubleshooting

In case your Java application goes outside the JVM and uses system calls, it might fail on a missing symbol or a system call. We will publish a short guide on how to solve these issues soon.

Clone this wiki locally