prepare for going back to JRE 1.8
diff --git a/src/bundles/xdccore/custom.mak b/src/bundles/xdccore/custom.mak
index 9c9af82..5bbed14 100644
--- a/src/bundles/xdccore/custom.mak
+++ b/src/bundles/xdccore/custom.mak
@@ -6,8 +6,7 @@
 	       xdchost-Windows.zip xdchost-Linux.zip xdchost-Linux_arm.zip xdchost-MacOS.zip
 
 JRE_Linux    = $(XDCTOOLS_JAVA_HOME)
-#JRE_Windows  = $(JRE_Linux:Linux=Windows)
-JRE_Windows  = /db/rtree/library/vendors/jre/9.0.1/Windows
+JRE_Windows  = $(JRE_Linux:Linux=Windows)
 JRE_Linux_arm = 
 JRE_MacOS    = $(JRE_Linux:Linux=MacOS)
 
diff --git a/src/etc/TOOLS b/src/etc/TOOLS
index d2dbbfa..12433fb 100644
--- a/src/etc/TOOLS
+++ b/src/etc/TOOLS
@@ -8,7 +8,7 @@
 #    JDK	- location of a Java Developer's Kit. The JDK is used to
 #		  build packages that contain Java code.
 #
-#    CLASSPATH	- the classpath used when running the Iliad tools.  The 
+#    CLASSPATH	- the classpath used when running the Iliad tools.  The
 #		  default is "<dir>/iliad.jar;<dir>/antlr.jar;<dir>/js.jar",
 #		  where <dir> is the directory containing iliad.jar.
 #
@@ -22,7 +22,7 @@
 
 ifeq (,$(XDCTOOLS_JAVA_HOME))
     override XDCTOOLS_JAVA_HOME := \
-        $(TOOLS)/vendors/oracle/jre/9.0.1/$(BUILD_HOST_OS)
+	$(TOOLS)/vendors/oracle/jre/9.0.1/$(BUILD_HOST_OS)
 endif
 export XDCTOOLS_JAVA_HOME
 
diff --git a/src/packages/xdc/xs/tcf.c b/src/packages/xdc/xs/tcf.c
index 9085284..59fea15 100644
--- a/src/packages/xdc/xs/tcf.c
+++ b/src/packages/xdc/xs/tcf.c
@@ -1,5 +1,5 @@
 /* --COPYRIGHT--,EPL
- * Copyright (c) 2008-2018 Texas Instruments Incorporated
+ * Copyright (c) 2008-2019 Texas Instruments Incorporated
  *  All rights reserved. This program and the accompanying materials
  *  are made available under the terms of the Eclipse Public License v1.0
  *  which accompanies this distribution, and is available at
@@ -62,12 +62,12 @@
 #define FILSTR	    ";"
 #define JRE	    "jre" DIRSTR
 #define CALLBACK    __stdcall
-#define EXHOME      "'C:\\Program Files\\Java\\jre-9'."
+#define EXHOME      "'C:\\Program Files\\Java\\jre-1.8.0_66'."
 
 /* 64-bit installations don't separate 'client' and 'server' anymore. */
 static String JVMNAMES[] = {
-    JRE "bin\\client\\jvm.dll",
-    JRE "bin\\server\\jvm.dll"
+    JRE "bin\\server\\jvm.dll",
+    JRE "bin\\client\\jvm.dll"
 };
 
 #else
@@ -79,7 +79,7 @@
 #define CALLBACK
 
 #if defined(xdc_target__os_MacOS)
-#define EXHOME      "'/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home'."
+#define EXHOME      "'/Library/Java/JavaVirtualMachines/jdk-1.8.0_66.jdk/Contents/Home'."
 
 static String JVMNAMES[] = {
     JRE "lib/server/libjvm.dylib"
@@ -89,10 +89,11 @@
 //};
 
 #else
-#define EXHOME      "'/usr/lib/jvm/java-9-openjdk-amd64'."
+#define EXHOME      "'/usr/lib/jvm/java-8-openjdk-amd64'."
 
 static String JVMNAMES[] = {
-    JRE "lib/server/libjvm.so",  /* Oracle's JRE */
+    JRE "lib/amd64/server/libjvm.so", /* Oracle's JRE 1.8 */
+    JRE "lib/server/libjvm.so",  /* Oracle's JRE 9 */
     JRE "lib/amd64/classic/libjvm.so", /* IBM's JRE, or /j9vm/ or /default/ */
     JRE "lib/arm/jamvm/libjvm.so",    /* or /cacao/ or /server/ */
     JRE "lib/arm/server/libjvm.so"    /* or /jamvm/ or /cacao/ */
@@ -103,11 +104,11 @@
 
 #define ENOHOME "can't find a JVM; try setting the environment\
  variable 'XDCTOOLS_JAVA_HOME' to the absolute path of any directory\
- containing a 64-bit Java Runtime Environment (9.0 or greater); e.g., " EXHOME
+ containing a 64-bit Java Runtime Environment (1.8.0 or greater); e.g., " EXHOME
 
 #define EBADHOME "can't find a JVM; the environment variable\
  'XDCTOOLS_JAVA_HOME' is set, but does not appear to be a directory\
- containing a 64-bit Java Runtime Environment (9.0 or greater); e.g., " EXHOME
+ containing a 64-bit Java Runtime Environment (1.8.0 or greater); e.g., " EXHOME
 
 typedef struct TCF_Obj {
     JavaVM	*jvm;		/* JVM interface pointer */
@@ -204,9 +205,9 @@
 {
     Char classBuf[MAXPATH + 1];
     String classPath = classBuf;
-    Char rootDirOption[MAXOPTLEN + 1];	    /* -Dconfig.rootDir=... */
+    Char rootDirOption[MAXOPTLEN + 1];      /* -Dconfig.rootDir=... */
     Char debugOption[MAXOPTLEN + 1];        /* -Dconfig.gopts=... */
-    Char classOption[MAXOPTLEN + 1];	    /* -Djava.class.path=... */
+    Char classOption[MAXOPTLEN + 1];        /* -Djava.class.path=... */
 
     JavaVMOption jvmOptions[MAXOPTIONS + 1];	/* +1 for NULL termination */
     Int nOpts;
@@ -306,8 +307,8 @@
 
     /* pass gopts via environment */
     if (strlen(tcf->gopts) < (MAXOPTLEN - 32)) {
-	sprintf(debugOption, "-Dconfig.gopts=%s", tcf->gopts);
-	jvmOptions[nOpts++].optionString = debugOption;
+        sprintf(debugOption, "-Dconfig.gopts=%s", tcf->gopts);
+        jvmOptions[nOpts++].optionString = debugOption;
     }
 
     /* set vfprintf output hook for JVM */
@@ -442,10 +443,11 @@
 {
     jobject jstr;
     jint sid;
-    Int i, len;
+    Int i;
+    SizeT len;
 
     GT_4trace(curTrace, GT_ENTER,
-	"TCF_getOutput(0x%lx, %d, 0x%lx, 0x%lx)\n", ses, s, buf, buflen);
+        "TCF_getOutput(0x%lx, %d, 0x%lx, 0x%lx)\n", ses, s, buf, buflen);
 
     if (buf == NULL || buflen <= 1) {
 	return (0);
@@ -483,7 +485,7 @@
     }
 
     buf[i] = '\0';	    /* NULL terminate the output string */
-    return (len);   	    /* return the length of the message */
+    return ((Int)len);   	    /* return the length of the message */
 }
 
 /*
@@ -705,7 +707,7 @@
 static Void appendCmd(TCF_Handle tcf, String format, ...)
 {
     va_list va;
-    Int count;
+    uintptr_t count;
 
     va_start(va, format);
 
@@ -907,7 +909,7 @@
 
 #if defined(xdc_target__os_Windows)
     String newPath = NULL;
-    UInt32 pathLen;
+    uintptr_t pathLen;
 #endif
 
     GT_2trace(curTrace, GT_ENTER, "getVMCreateFxn(0x%lx, %s)\n", tcf, jvmPath);
@@ -923,20 +925,20 @@
     /* Check how much space we need for old PATH or if PATH is defined */
     pathLen = GetEnvironmentVariable("PATH", NULL, 0);
     if (pathLen != 0 || GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
-        UInt jrebinLen = 0;  /* length of the JRE path prefix to jre/bin */
-        UInt newPathLen;     /* length of path with appended JRE path */
+        uintptr_t jrebinLen = 0; /* length of the JRE path prefix to jre/bin */
+        uintptr_t newPathLen;    /* length of path with appended JRE path */
         Char *cp;
 
         /* locate last "bin/" in jvmPath (which should have msvc*.dll) */
         for (cp = jvmPath; (cp = strstr(cp, "\\bin\\")) != NULL;) {
             cp += 4;
-            jrebinLen = cp - jvmPath; 
+            jrebinLen = cp - jvmPath;
         }
 
         /* if we found a last /bin in jvmPath, add it to the PATH */
         if (jrebinLen != 0) {
             newPathLen = pathLen + jrebinLen + 1; /* add 1 for ';' */
-            if ((newPath = (String)GS_alloc(newPathLen + 1)) != NULL) {
+            if ((newPath = (String)GS_alloc((UInt)newPathLen + 1)) != NULL) {
                 Char *pnt;
                 memcpy(newPath, jvmPath, jrebinLen);
                 pnt = newPath + jrebinLen;
@@ -944,9 +946,10 @@
                     *pnt = '\0';
                     SetEnvironmentVariable("PATH", newPath);
                 }
-                else if ((savedPath = (String)GS_alloc(pathLen + 1)) != NULL){
-                    pathLen = GetEnvironmentVariable("PATH",
-                                                      savedPath, pathLen + 1);
+                else if ((savedPath = (String)GS_alloc((UInt)pathLen + 1))
+                    != NULL) {
+                    pathLen = GetEnvironmentVariable("PATH", savedPath,
+                                                     (UInt32)pathLen + 1);
                     if (pathLen != 0) {
                         *(pnt++) = ';';
                         memcpy(pnt, savedPath, pathLen);
@@ -997,7 +1000,7 @@
 
     if ((tmp = getenv("XDCPATH")) != NULL) {
         String xdcPathBuf;
-        Int len = strlen(prefix) + strlen(tmp) + 1;
+        UInt len = (Int)(strlen(prefix) + strlen(tmp) + 1);
         if ((xdcPathBuf = (String)GS_calloc(len)) != NULL) {
             strcpy(xdcPathBuf, prefix);
             strcat(xdcPathBuf, tmp);