diff -ruN QuantLib-SWIG-0.3.14/configure.ac QuantLib-SWIG-0.3.14_java_patch/configure.ac
--- QuantLib-SWIG-0.3.14/configure.ac	2006-07-31 16:34:46.000000000 +0700
+++ QuantLib-SWIG-0.3.14_java_patch/configure.ac	2007-01-29 16:45:49.000000000 +0600
@@ -52,6 +52,37 @@
 
 # Default compilation variables
 
+# check target
+target=`uname`
+case "$target" in
+Linux ) AC_SUBST([SHARED_LIB],[${SHARED_LIB='-shared'}]) 
+	AC_SUBST([_JAVA_HOME_],[${_JAVA_HOME_=$JAVA_HOME}])
+	AC_SUBST([JAVA_SYSTEM_INCLUDE],[${_JAVA_SYSTEM_INCLUDE=$JAVA_HOME/include/linux}])
+	AC_SUBST([LIB_EXTENSION],[${LIB_EXTENSION='so'}]) ;;
+Darwin ) AC_SUBST([SHARED_LIB],[${SHARED_LIB='-dynamiclib'}])
+	AC_SUBST([_JAVA_HOME_],[${_JAVA_HOME_='/Library/Java/Home'}])
+	AC_SUBST([JAVA_SYSTEM_INCLUDE],[${JAVA_SYSTEM_INCLUDE='/Library/Java/Home/include'}])
+	AC_SUBST([LIB_EXTENSION],[${LIB_EXTENSION='dylib'}]) ;;
+esac
+
+AC_MSG_CHECKING([jdk include])
+
+if test -z "${_JAVA_HOME_}"
+then
+AC_MSG_ERROR([set \$JAVA_HOME enveronment to home path to jdk])
+else
+AC_SUBST([JAVA_INCLUDE],[${JAVA_INCLUDE=$_JAVA_HOME_/include}])
+JAVA_INCLUDE=$_JAVA_HOME_/include
+AC_MSG_RESULT([$JAVA_INCLUDE])
+fi
+
+
+AC_MSG_CHECKING([system])
+AC_MSG_RESULT([$target])
+AC_MSG_CHECKING([shared linker flag])
+AC_MSG_RESULT([$SHARED_LIB])
+
+
 AC_SUBST([CXXFLAGS],[${CXXFLAGS='-g -O2 -Wall'}])
 
 # done, output the configured files
diff -ruN QuantLib-SWIG-0.3.14/Java/Makefile.am QuantLib-SWIG-0.3.14_java_patch/Java/Makefile.am
--- QuantLib-SWIG-0.3.14/Java/Makefile.am	2005-10-21 15:11:30.000000000 +0700
+++ QuantLib-SWIG-0.3.14_java_patch/Java/Makefile.am	2007-01-29 16:45:49.000000000 +0600
@@ -1,15 +1,30 @@
 
-CLEANFILES = quantlib_wrap.cpp
+CLEANFILES = 
 
-BUILT_SOURCES = quantlib_wrap.cpp
-
-clean-local:
-	rm -rf org
+BUILT_SOURCES = quantlib_wrap.cpp libquantlib_javawrap compile_jar compile_test
 
 quantlib_wrap.cpp: org/quantlib ../SWIG/*.i
 	$(SWIG) -java -c++ -I../SWIG -outdir org/quantlib \
             -package org.quantlib -o quantlib_wrap.cpp quantlib.i
 
+quantlib_wrap.o: quantlib_wrap.cpp
+	g++ -c quantlib_wrap.cpp -I@JAVA_INCLUDE@ -I@JAVA_SYSTEM_INCLUDE@ -I/usr/include `quantlib-config --cflags` -o quantlib_wrap.o
+
+libquantlib_javawrap: quantlib_wrap.o
+	g++ @SHARED_LIB@ quantlib_wrap.o -Wl -o libquantlib_javawrap.@LIB_EXTENSION@ `quantlib-config --libs`
+
+compile_jar: 
+	mkdir -p bin
+	find org/quantlib -name '*.java' | xargs @_JAVA_HOME_@/bin/javac -d bin
+	@_JAVA_HOME_@/bin/jar cf quantlib-wrapper.jar -C bin org
+
+compile_test: compile_jar
+	@_JAVA_HOME_@/bin/javac -cp quantlib-wrapper.jar ./test/Hello.java
+
+install-exec-local: libquantlib_javawrap.@LIB_EXTENSION@ compile_jar
+	cp libquantlib_javawrap.@LIB_EXTENSION@ $(DESTDIR)/$(libdir)/libquantlib_javawrap.@LIB_EXTENSION@
+	cp quantlib-wrapper.jar @_JAVA_HOME_@/lib/quantlib-wrapper.jar
+
 org/quantlib:
 	mkdir -p org/quantlib
 
@@ -18,5 +33,14 @@
 	cp ./org/quantlib/*.java $(distdir)/org/quantlib
 	touch $(distdir)/quantlib_wrap.cpp
 
+clean:
+	rm quantlib_wrap.cpp
+	rm org/quantlib/* 
+	rm quantlib-wrapper.jar
+	rm ./test/Hello.class
+	rm quantlib_wrap.o
+	rm libquantlib_javawrap.@LIB_EXTENSION@ 
+	rm bin/org/quantlib/* 
+
 EXTRA_DIST = README.txt $(BUILT_SOURCES)
 
diff -ruN QuantLib-SWIG-0.3.14/Java/test/Hello.java QuantLib-SWIG-0.3.14_java_patch/Java/test/Hello.java
--- QuantLib-SWIG-0.3.14/Java/test/Hello.java	1970-01-01 07:00:00.000000000 +0700
+++ QuantLib-SWIG-0.3.14_java_patch/Java/test/Hello.java	2007-01-29 16:45:49.000000000 +0600
@@ -0,0 +1,17 @@
+import org.quantlib.*;
+
+public class Hello { 
+
+	static { 
+		System.loadLibrary("quantlib_javawrap"); 
+	} 
+
+	public static void main(String[] args) { 
+		QuantLib ql = new QuantLib(); 
+		double nd = QuantLib.nullDouble(); 
+		
+		System.out.println("ql nullDouble is "+nd); 
+		System.out.println("and sunday is "+Weekday.Sunday.toString()); 
+	} 
+}
+
diff -ruN QuantLib-SWIG-0.3.14/SWIG/options.i QuantLib-SWIG-0.3.14_java_patch/SWIG/options.i
--- QuantLib-SWIG-0.3.14/SWIG/options.i	2006-08-24 16:40:12.000000000 +0700
+++ QuantLib-SWIG-0.3.14_java_patch/SWIG/options.i	2007-01-29 16:45:49.000000000 +0600
@@ -36,7 +36,7 @@
 // declared out of its hierarchy just to export the inner enumeration
 class Option {
   public:
-    enum Type { Call = -1, Put = 1};
+    enum Type { Call=1, Put=-1 };
   private:
     Option();
 };

