Silk Web Hosting: Java

Modified

Long-term support (LTS) versions of Java are available.

Choosing a version

You can choose among multiple versions of Java:

Silk platform Java version Command-line path Sunset Date
silkv2 1.8 (default) /etc/alternatives/java_sdk_1.8.0/bin/java May 2026
11 /etc/alternatives/java_sdk_11/bin/java September 2023
silkv3 17 (default) /opt/mise/installs/java/17/bin/java September 2026
21 /opt/mise/installs/java/21/bin/java September 2028

Due to changes in the Java release cycle, the next LTS release will be Java SE 17.

If you need to switch Java versions, you can do so by creating or editing your site’s .silk.ini file (for example ~/www-root/.silk.ini) and adding the version to the [java] section:

[java]
version = 11

Valid version choices are default, any of the versions listed in the table above, or newest (which provides the newest available on the system).

Web applications

Java web applications in the form of directories or bundled .war files use NGINX Unit as an application server. You can run an application by doing the following:

  1. Edit the .silk.ini file in your site root. Add a section similar to the following.

    [app]
    type = java
    root = myapp
    uri = /*
    startup-script = myapp.war
    jvm-classpath = /users/m/y/mynetid/www-root/classes
    env.MYVAR = some value

    The .silk.ini section name should be either “app” or any descriptive name you wish for your application that starts with “app: “. This could be useful if you wish to configure multiple apps.

    root is an optional directory under your site root containing all your application files.

    uri is a pattern matching the part of a web request URL after the hostname that should match this application, usually ending in *. For example, /* matches all pages, while /myapp* matches all pages that begin with /myapp.

    document-root is the directory under your app root in which static files will be located.

    startup-script is the name of the .war file or directory containing your application files.

    jvm-classpath is an optional list of file paths to class directories or JAR files that should be available to your application.

    Any line beginning with env. will set an environment variable available within your application.

  2. If this is the first web application in your site, a new app server will be started for your account within ten minutes.

  3. Load your application with silk app <hostname> load. If you have multiple sites and/or multiple apps, <hostname> is followed by the URI path of your app, such as dev.mynetid.w3.uvm.edu/app2. If you see an error, check the app server log for details.

Reloading applications

An application needs to be restarted for code changes to take effect. You can do this the same way you originally loaded your application:

[myusername@silk21 ~]$ silk app <hostname> load

Console logs

App server logs are available at /usr/lib/unit-user-<mynetid>/unit.log.