diff --git a/tutorial/java/JavaClient b/tutorial/java/JavaClient
new file mode 100755
index 0000000..68d87b8
--- /dev/null
+++ b/tutorial/java/JavaClient
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+java -cp tutorial.jar:/usr/local/lib/libthrift.jar JavaClient
diff --git a/tutorial/java/JavaServer b/tutorial/java/JavaServer
new file mode 100755
index 0000000..8961600
--- /dev/null
+++ b/tutorial/java/JavaServer
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+java -cp tutorial.jar:/usr/local/lib/libthrift.jar JavaServer
diff --git a/tutorial/java/build.xml b/tutorial/java/build.xml
new file mode 100644
index 0000000..0ec1ea4
--- /dev/null
+++ b/tutorial/java/build.xml
@@ -0,0 +1,47 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project name="tutorial" default="tutorial" basedir=".">
+
+  <description>Thrift Tutorial</description>
+
+  <property name="src" location="src" />
+  <property name="gen" location="../gen-java" />
+  <property name="build" location="build" />
+  <property name="cpath" location="/usr/local/lib/libthrift.jar" />
+
+  <target name="init">
+    <tstamp />
+    <mkdir dir="${build}"/>
+  </target>
+
+  <target name="compile" depends="init">
+    <javac srcdir="${gen}" destdir="${build}" classpath="${cpath}" />
+    <javac srcdir="${src}" destdir="${build}" classpath="${cpath}:${gen}" />
+  </target>
+
+  <target name="tutorial" depends="compile">
+    <jar jarfile="tutorial.jar" basedir="${build}"/>
+  </target>
+
+  <target name="clean">
+    <delete dir="${build}" />
+    <delete file="tutorial.jar" />
+  </target>
+
+</project>
diff --git a/tutorial/java/src/JavaClient.java b/tutorial/java/src/JavaClient.java
new file mode 100644
index 0000000..5dc70ed
--- /dev/null
+++ b/tutorial/java/src/JavaClient.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Generated code
+import tutorial.*;
+import shared.*;
+
+import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransportException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+
+import java.util.AbstractMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.ArrayList;
+
+public class JavaClient {
+  public static void main(String [] args) {
+    try {
+
+      TTransport transport = new TSocket("localhost", 9090);
+      TProtocol protocol = new TBinaryProtocol(transport);
+      Calculator.Client client = new Calculator.Client(protocol);
+
+      transport.open();
+
+      client.ping();
+      System.out.println("ping()");
+
+      int sum = client.add(1,1);
+      System.out.println("1+1=" + sum);
+
+      Work work = new Work();
+
+      work.op = Operation.DIVIDE;
+      work.num1 = 1;
+      work.num2 = 0;
+      try {
+        int quotient = client.calculate(1, work);
+        System.out.println("Whoa we can divide by 0");
+      } catch (InvalidOperation io) {
+        System.out.println("Invalid operation: " + io.why);
+      }
+
+      work.op = Operation.SUBTRACT;
+      work.num1 = 15;
+      work.num2 = 10;
+      try {
+        int diff = client.calculate(1, work);
+        System.out.println("15-10=" + diff);
+      } catch (InvalidOperation io) {
+        System.out.println("Invalid operation: " + io.why);
+      }
+
+      SharedStruct log = client.getStruct(1);
+      System.out.println("Check log: " + log.value);
+
+      transport.close();
+
+    } catch (TException x) {
+      x.printStackTrace();
+    }
+
+  }
+
+}
diff --git a/tutorial/java/src/JavaServer.java b/tutorial/java/src/JavaServer.java
new file mode 100644
index 0000000..14440eb
--- /dev/null
+++ b/tutorial/java/src/JavaServer.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TSimpleServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+
+// Generated code
+import tutorial.*;
+import shared.*;
+
+import java.util.HashMap;
+
+public class JavaServer {
+
+  public static class CalculatorHandler implements Calculator.Iface {
+
+    private HashMap<Integer,SharedStruct> log;
+
+    public CalculatorHandler() {
+      log = new HashMap<Integer, SharedStruct>();
+    }
+
+    public void ping() {
+      System.out.println("ping()");
+    }
+
+    public int add(int n1, int n2) {
+      System.out.println("add(" + n1 + "," + n2 + ")");
+      return n1 + n2;
+    }
+
+    public int calculate(int logid, Work work) throws InvalidOperation {
+      System.out.println("calculate(" + logid + ", {" + work.op + "," + work.num1 + "," + work.num2 + "})");
+      int val = 0;
+      switch (work.op) {
+      case Operation.ADD:
+        val = work.num1 + work.num2;
+        break;
+      case Operation.SUBTRACT:
+        val = work.num1 - work.num2;
+        break;
+      case Operation.MULTIPLY:
+        val = work.num1 * work.num2;
+        break;
+      case Operation.DIVIDE:
+        if (work.num2 == 0) {
+          InvalidOperation io = new InvalidOperation();
+          io.what = work.op;
+          io.why = "Cannot divide by 0";
+          throw io;
+        }
+        val = work.num1 / work.num2;
+        break;
+      default:
+        InvalidOperation io = new InvalidOperation();
+        io.what = work.op;
+        io.why = "Unknown operation";
+        throw io;
+      }
+
+      SharedStruct entry = new SharedStruct();
+      entry.key = logid;
+      entry.value = Integer.toString(val);
+      log.put(logid, entry);
+
+      return val;
+    }
+
+    public SharedStruct getStruct(int key) {
+      System.out.println("getStruct(" + key + ")");
+      return log.get(key);
+    }
+
+    public void zip() {
+      System.out.println("zip()");
+    }
+
+  }
+
+  public static void main(String [] args) {
+    try {
+      CalculatorHandler handler = new CalculatorHandler();
+      Calculator.Processor processor = new Calculator.Processor(handler);
+      TServerTransport serverTransport = new TServerSocket(9090);
+      TServer server = new TSimpleServer(processor, serverTransport);
+
+      // Use this for a multithreaded server
+      // server = new TThreadPoolServer(processor, serverTransport);
+
+      System.out.println("Starting the server...");
+      server.serve();
+
+    } catch (Exception x) {
+      x.printStackTrace();
+    }
+    System.out.println("done.");
+  }
+}
