diff --git a/appveyor.yml b/appveyor.yml
index 019aa5c73e2828eb363d5c4a308b9b074aab84e4..a00843bc1f41ad27097f5ab2c2e021afbcdad2a8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,12 +25,13 @@ environment:
       LIBEWF_HOME: "C:\\libewf_64bit"
       POSTGRESQL_HOME_64: "C:\\Program Files\\PostgreSQL\\9.5"
       PYTHON: "C:\\Python36-x64"
+      JDK_HOME: C:\Program Files\Java\jdk1.8.0
 services:
       - postgresql95;
 
 build_script:
       - python setupLibs.py
-      - python %TSK_HOME%\win32\updateBuildLibs.py -m
+      - python win32\updateBuildLibs.py -m
       - ps: ant -version
       - ps: pushd bindings/java
       - cmd: ant dist-PostgreSQL
diff --git a/setupLibs.py b/setupLibs.py
index e11adf3464909e747f5d74e5b1c93315aa701c62..da58702b806106e37d0ec4da19f6499d0aebb654 100644
--- a/setupLibs.py
+++ b/setupLibs.py
@@ -39,17 +39,18 @@ def main():
         base_Library_path["libewf_64bit"] = os.path.dirname(libewf_home)
     else:
         print('Please set the env variable LIBEWF_HOME')
+        sys.exit(1)
 
     if(libvhdi_home != None):
         base_Library_path["libvhdi_64bit"] = os.path.dirname(libvhdi_home)
     else:
         print('Please set the env variable LIBVHDI_HOME')
-
+        sys.exit(1)
     if(libvmdk_home != None):
         base_Library_path["libvmdk_64bit"] = os.path.dirname(os.path.dirname(libvmdk_home))
     else:
         print('Please set the env variable LIBVMDK_HOME')
-
+        sys.exit(1)
 
     setupLibrary(base_Library_path);
 
diff --git a/win32/updateBuildLibs.py b/win32/updateBuildLibs.py
index 442d7163dd206c3082c47a77155ed1d990b42cfd..9a04d61a2c775b5bb455b7f121d843fbf65bffe3 100644
--- a/win32/updateBuildLibs.py
+++ b/win32/updateBuildLibs.py
@@ -20,7 +20,6 @@
 CURRENT_PATH = os.getcwd()
 # save the build log in the output directory
 LOG_PATH = os.path.join(CURRENT_PATH, 'output', time.strftime("%Y.%m.%d-%H.%M.%S"))
-APPVEYOR = os.getenv("APPVEYOR",False)
 MINIMAL = False
 def pullAndBuildAllDependencies(branch):
     '''
@@ -210,7 +209,12 @@ def buildTSK(wPlatform, target):
 
     print ("Building TSK " + str(wPlatform) + "-bit " + target + " build.")
     sys.stdout.flush()
-    if(APPVEYOR):
+    TSK_HOME = os.getenv("TSK_HOME",False)
+
+    if not TSK_HOME:
+        print("Please set the TSK_HOME environment variable")
+        sys.exit(1)
+    else:
         os.chdir(os.path.join(os.getenv("TSK_HOME"),"win32"))
 
     vs = []