github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/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 `java` command. 31 32 * `jvm_options` - (Optional) A list of JVM options to be passed while invoking 33 java. These options are passed not validated in any way in Nomad. 34 35 ## Client Requirements 36 37 The `java` driver requires Java to be installed and in your systems `$PATH`. 38 The `artifact_source` must be accessible by the node running Nomad. This can be an 39 internal source, private to your cluster, but it must be reachable by the client 40 over HTTP. 41 42 ## Examples 43 44 A simple config block to run a Java Jar: 45 46 ```json 47 # Define a task to run 48 task "web" { 49 # Run a Java Jar 50 driver = "java" 51 52 config { 53 artifact_source = "https://dl.dropboxusercontent.com/u/1234/hello.jar" 54 checksum = "md5:123445555555555" 55 jvm_options = "-Xmx2048m -Xms256m" 56 } 57 ``` 58 59 ## Client Attributes 60 61 The `java` driver will set the following client attributes: 62 63 * `driver.java` - Set to `1` if Java is found on the host node. Nomad determines 64 this by executing `java -version` on the host and parsing the output 65 * `driver.java.version` - Version of Java, ex: `1.6.0_65` 66 * `driver.java.runtime` - Runtime version, ex: `Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)` 67 * `driver.java.vm` - Virtual Machine information, ex: `Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)` 68 69 ## Resource Isolation 70 71 The resource isolation provided varies by the operating system of 72 the client and the configuration. 73 74 On Linux, Nomad will attempt to use cgroups, namespaces, and chroot 75 to isolate the resources of a process. If the Nomad agent is not 76 running as root many of these mechanisms cannot be used. 77 78 As a baseline, the Java jars will be run inside a Java Virtual Machine, 79 providing a minimum amount of isolation. 80