## gate.util
Class Jdk

    java.lang.Object
      |
      +--gate.util.Jdk

public class Jdk
extends Object

Jdk encapsulates some utilities for poking around in your Java environment.

Constructor Summary
`Jdk()` Anonymous construction.

Method Summary
`byte[]` `compile(String javaCode, String className)` Compile a class from its source code string.
`Class` `defineClass(String classQualifiedName, byte[] classBytes)` Define a class from its qualified name and the byte array of its binary.
`File` `getToolsHome()` Returns a File specifying the location of the JDK tools, i.e.
`Object` `instantiateClass(Class theClass)` Create an instance of a class.
`Class` `loadActionClass(String classFileName)` Load a class.
`static void` `main(String[] args)` main.
`byte[]` `readClass(String classFileName)` Read the bytes for a class.
`void` `testMe()` Test method.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Jdk

    public Jdk()

  Anonymous construction.

Method Detail

### main

    public static void main(String[] args)
                     throws GateException

  main.

### testMe

    public void testMe()
                throws GateException

  Test method. Better to use TestJdk via the TestGate suite instead.

### getToolsHome

    public File getToolsHome()
                      throws GateException

  Returns a File specifying the location of the JDK tools, i.e. the location of programs like `java, javac, jar`. It assumes that if it finds `javac` or `javac.exe` then it found the tools home.

### compile

    public byte[] compile(String javaCode,
                          String className)
                   throws GateException

  Compile a class from its source code string.
  Parameters:
    `className` - should have the package path to the source, e.g. com/thing/MyClass.java.

### readClass

    public byte[] readClass(String classFileName)
                     throws GateException

  Read the bytes for a class.
  Parameters:
    `classFileName` - should have the path to the .class file, e.g. com/thing/MyClass.class.

### loadActionClass

    public Class loadActionClass(String classFileName)
                          throws GateException

  Load a class.
  Parameters:
    `classFileName` - is the path to the .class file, e.g. com/thing/MyClass.class.

### defineClass

    public Class defineClass(String classQualifiedName,
                             byte[] classBytes)
                      throws GateException

  Define a class from its qualified name and the byte array of its binary.
  Parameters:
    `classQualified` - name should be e.g. com.thing.MyClass.
    `contains` - the bytes from a .class file.

### instantiateClass

    public Object instantiateClass(Class theClass)
                            throws GateException

  Create an instance of a class.