github.com/ryanslade/nomad@v0.2.4-0.20160128061903-fc95782f2089/website/source/docs/drivers/java.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Drivers: Java" 4 sidebar_current: "docs-drivers-java" 5 description: |- 6 The Java task driver is used to run Jars using the JVM. 7 --- 8 9 # Java Driver 10 11 Name: `java` 12 13 The `Java` driver is used to execute Java applications packaged into a Java Jar 14 file. The driver currently requires the Jar file be accessible via 15 HTTP from the Nomad client. 16 17 ## Task Configuration 18 19 The `java` driver supports the following configuration in the job spec: 20 21 * `artifact_source` - The hosted location of the source Jar file. Must be 22 accessible from the Nomad client 23 24 * `checksum` - (Optional) The checksum type and value for the `artifact_source` 25 image. The format is `type:value`, where type is any of `md5`, `sha1`, 26 `sha256`, or `sha512`, and the value is the computed checksum. If a checksum 27 is supplied and does not match the downloaded artifact, the driver will fail 28 to start 29 30 * `args` - (Optional) A list of arguments to the optional `command`. 31 References to environment variables or any [intepretable Nomad 32 variables](/docs/jobspec/index.html#interpreted_vars) will be interpreted 33 before launching the task. For example: 34 35 ``` 36 args = ["$nomad.ip", "$MY_ENV", "$meta.foo"] 37 ``` 38 39 * `jvm_options` - (Optional) A list of JVM options to be passed while invoking 40 java. These options are passed not validated in any way in Nomad. 41 42 ## Client Requirements 43 44 The `java` driver requires Java to be installed and in your systems `$PATH`. 45 The `artifact_source` must be accessible by the node running Nomad. This can be an 46 internal source, private to your cluster, but it must be reachable by the client 47 over HTTP. 48 49 ## Examples 50 51 A simple config block to run a Java Jar: 52 53 ```json 54 # Define a task to run 55 task "web" { 56 # Run a Java Jar 57 driver = "java" 58 59 config { 60 artifact_source = "https://dl.dropboxusercontent.com/u/1234/hello.jar" 61 checksum = "md5:123445555555555" 62 jvm_options = "-Xmx2048m -Xms256m" 63 } 64 ``` 65 66 ## Client Attributes 67 68 The `java` driver will set the following client attributes: 69 70 * `driver.java` - Set to `1` if Java is found on the host node. Nomad determines 71 this by executing `java -version` on the host and parsing the output 72 * `driver.java.version` - Version of Java, ex: `1.6.0_65` 73 * `driver.java.runtime` - Runtime version, ex: `Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)` 74 * `driver.java.vm` - Virtual Machine information, ex: `Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)` 75 76 ## Resource Isolation 77 78 The resource isolation provided varies by the operating system of 79 the client and the configuration. 80 81 On Linux, Nomad will attempt to use cgroups, namespaces, and chroot 82 to isolate the resources of a process. If the Nomad agent is not 83 running as root many of these mechanisms cannot be used. 84 85 As a baseline, the Java jars will be run inside a Java Virtual Machine, 86 providing a minimum amount of isolation. 87