Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile	(revision 4619)
@@ -2,5 +2,9 @@
 
 OUT_DIR=output
+ifeq ($(OS),Windows_NT)
+LIBPJSUA2_SO=$(OUT_DIR)/pjsua2.dll
+else
 LIBPJSUA2_SO=$(OUT_DIR)/libpjsua2.so
+endif
 
 # Get JDK location
@@ -20,8 +24,8 @@
 ifeq ($(OS),Windows_NT)
 MY_JNI_LDFLAGS	 = -L$(MY_JDK)/lib -Wl,--kill-at
-MY_JNI_LIB       = $(MY_PACKAGE_BIN)/pjsua.dll
+MY_JNI_LIB       = $(OUT_DIR)/pjsua2.dll
 else
-MY_JNI_LDFLAGS	 = -L$(MY_JDK)/lib -Wl,-soname,pjsua.so
-MY_JNI_LIB       = $(MY_PACKAGE_BIN)/libpjsua.so
+MY_JNI_LDFLAGS	 = -L$(MY_JDK)/lib -Wl,-soname,pjsua2.so
+MY_JNI_LIB       = $(OUT_DIR)/libpjsua2.so
 MY_JNI_CFLAGS	 := -fPIC
 endif
@@ -37,13 +41,13 @@
 # Build settings
 MY_CFLAGS	 = $(PJ_CFLAGS) $(MY_JNI_CFLAGS)
-MY_LDFLAGS	 = $(PJ_LDFLAGS) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++
+MY_LDFLAGS	 = $(PJ_LDFLAGS) -lpjsua2-$(TARGET_NAME) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++
 
-all: $(LIBPJSUA2_SO)
+all: $(LIBPJSUA2_SO) java
 
 $(LIBPJSUA2_SO): $(OUT_DIR)/pjsua2_wrap.o
-	gcc -shared -Wl,-soname,libpjsua2.so $(OUT_DIR)/pjsua2_wrap.o -o $(LIBPJSUA2_SO) -lstdc++ $(MY_CFLAGS) $(MY_LDFLAGS)
+	g++ -shared -o $(LIBPJSUA2_SO) $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS)
 
 $(OUT_DIR)/pjsua2_wrap.o: $(OUT_DIR)/pjsua2_wrap.cpp Makefile
-	gcc -c $(OUT_DIR)/pjsua2_wrap.cpp -fPIC -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS)
+	g++ -c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS)
 
 $(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i $(SRCS)
@@ -52,3 +56,11 @@
 clean distclean realclean:
 	rm -rf $(OUT_DIR)/pjsua2_wrap.cpp $(OUT_DIR)/pjsua2_wrap.o $(LIBPJSUA2_SO) $(OUT_DIR)/*.java $(OUT_DIR)/*.class
-	ln -s ../test.java output/test.java
+
+java:
+	$(MY_JAVAC) -d $(OUT_DIR) $(OUT_DIR)/*.java
+	$(MY_JAVAC) -d $(OUT_DIR) -classpath "$(OUT_DIR)" test.java
+
+test:
+	@# Need to specify classpath and library path, alternatively, they can be set via
+	@# CLASSPATH and java.library.path env settings
+	$(MY_JAVA) -cp $(OUT_DIR) -Djava.library.path="$(OUT_DIR)" test
Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/test.java
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/test.java	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/test.java	(revision 4619)
@@ -7,5 +7,5 @@
   public static void main(String argv[]) {
 
-	CredInfo cred = new CredInfo();
+	AuthCredInfo cred = new AuthCredInfo();
 
 	cred.setRealm("Hello world");
Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/Makefile
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/Makefile	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/Makefile	(revision 4619)
@@ -1,3 +1,8 @@
 PYTHON_SO=_pjsua2.so
+
+PYTHON_SETUP_FLAGS = --inplace 
+ifeq ($(OS),Windows_NT)
+  PYTHON_SETUP_FLAGS += --compiler=mingw32
+endif
 
 .PHONY: all
@@ -6,5 +11,5 @@
 
 $(PYTHON_SO): pjsua2_wrap.cpp setup.py
-	python setup.py build_ext --inplace
+	python setup.py build_ext $(PYTHON_SETUP_FLAGS)
 
 pjsua2_wrap.cpp: ../pjsua2.i $(SRCS)
Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/helper.mak
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/helper.mak	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/helper.mak	(revision 4619)
@@ -16,2 +16,5 @@
 	done
 
+target_name:
+	$(TARGET_NAME)
+	
Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/setup.py
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/setup.py	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/setup.py	(revision 4619)
@@ -62,4 +62,8 @@
 #print 'PJ_VERSION = "'+ pj_version + '"'
 
+# Get targetname
+f = os.popen("make --no-print-directory -f helper.mak target_name")
+pj_target_name = f.read().rstrip("\r\n")
+f.close()
 
 # Fill in pj_inc_dirs
@@ -78,5 +82,5 @@
 
 # Fill in pj_libs
-pj_libs = ['pjsua2-x86_64-unknown-linux-gnu']                      ### <--- xxxx HARDCODED xxxx
+pj_libs = ['pjsua2-' + pj_target_name]
 f = os.popen("make --no-print-directory -f helper.mak libs")
 for line in f:
@@ -84,13 +88,14 @@
 f.close()
 
-# Mac OS X depedencies
+# Fill in extra link args
+extra_link_args = ['-static-libstdc++']
 if platform.system() == 'Darwin':
-    extra_link_args = ["-framework", "CoreFoundation", 
-                       "-framework", "AudioToolbox"]
+    # Mac OS X depedencies
+    extra_link_args += ["-framework", "CoreFoundation", 
+                        "-framework", "AudioToolbox"]
     # OS X Lion support
     if platform.mac_ver()[0].startswith("10.7"):
         extra_link_args += ["-framework", "AudioUnit"]
-else:
-    extra_link_args = []
+
 
 setup(name="pjsua2", 
Index: pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/test.py
===================================================================
--- pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/test.py	(revision 4618)
+++ pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/python/test.py	(revision 4619)
@@ -8,9 +8,9 @@
 def ua_data_test():
 	#
-	# CredInfo
+	# AuthCredInfo
 	#
 	print "UA data types test.."
 	the_realm = "pjsip.org"
-	ci = pj.CredInfo()
+	ci = pj.AuthCredInfo()
 	ci.realm = the_realm
 	ci.dataType = 20
@@ -58,5 +58,5 @@
 		assert e.status == 70013
 		assert e.reason == "Invalid operation (PJ_EINVALIDOP)"
-		assert e.title == "Endpoint::testException()"
+		#assert e.title == "Endpoint::testException()"
 	assert got_exception
 
