Joyent

Java and the JVM on Accelerators

This page is a guide to creating and deploying applications on your Accelerator developed in the Java programming language, and developed in other languages that run on top of the Java Virtual Machine (JVM).

Java Overview

If you’re new to Java, the JVM, or want a general introduction to developing and deploying Java applications, start off by reading the Java Overview in the All Accelerators Knowledge Base.

Version

An up-to-date version of Java is available “out-of-the-box” with your Accelerator.

Finding the Java Version

admin$ java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Server VM (build 1.6.0_01-b06, mixed mode)

If you see the following error:

Error occurred during initialization of VM
Could not reserve enough space for object heap

try:

admin$ java -Xms16m -Xmx64m -version

For more help on command-line switches, type:

java -h

Location

Java and the JDK can be found in /usr/bin. This is a read-only location, and not user-land software cannot/should not be installed here (see A Tour of Your Accelerator; or, What's where, and why?).

admin$ which javac
javac is /usr/bin/javac

Standard tools should be available to you from /usr/bin:

  • java
  • javac
  • jar
  • javadoc
  • jdb
  • javap
  • javah
  • extcheck
  • apt
  • idlj
  • policytool

Warning on Java memory usage in Accelerators

Java automatically sets a heap size when it starts. The default calculation can give undesirable results in Joyent Accelerators (e.g. consuming half the memory in a container for a simple application).

See this thread for further discussion.

To avoid problems, specify heap size parameters when you launch Java:

# java -Xms16m -Xmx64m MyJavaApp

Installing / Upgrading Java

If you need a version of the JDK that is different to the version contained in /usr/bin, you may be able to install an alternate version within /opt. Please contribute if you are able to make this work.

Installing Java Software

 
accelerators/kb/java.txt · Last modified: 2008/02/17 16:30 by alexbcoles
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki