How to install Windows JDK without installation

Sometimes we want to keep our system as much clean as possible and do not want to install JDK from exe installer for . Below is a brief instruction on how to do it:

  1. Download JDK from Oracle site – link
  2. Install 7-zip if not already installed
  3. create unpack.bat file at the same folder where JDK from step 1 was downloaded with below content depends on JDK version:
    1. bat file for JDK 8:
      @echo off
      set PATH=%PATH%;C:\Program Files\7-Zip\
      
      rmdir /s /q "%~dp0\jdk-out"
      rmdir /s /q "%~dp0\unpacked-jdk"
      7z x %1 -o"%~dp0\jdk-out"
      cd /d "jdk-out\.rsrc\1033\JAVA_CAB10"
      extrac32 111
      7z x tools.zip -ojdk
      cd /d "jdk"
      for /r %%x in (*.pack) do .\bin\unpack200 -r "%%x" "%%~dx%%~px%%~nx.jar"
      mkdir "%~dp0\unpacked-jdk"
      xcopy /s "%~dp0\jdk-out\.rsrc\1033\JAVA_CAB10\jdk" "%~dp0\unpacked-jdk"
      cd /d "%~dp0"
      cd /d "jdk-out\.rsrc\1033\JAVA_CAB9"
      extrac32 110
      xcopy /s "%~dp0\jdk-out\.rsrc\1033\JAVA_CAB9\src.zip" "%~dp0\unpacked-jdk"
      cd /d "%~dp0"
      rmdir /s /q "%~dp0\jdk-out"
    2. bat file for JDK 9:
      @echo off
      set PATH=%PATH%;C:\Program Files\7-Zip\
      
      rmdir /s /q "%~dp0\jdk-out"
      rmdir /s /q "%~dp0\unpacked-jdk"
      7z x %1 -o"%~dp0\jdk-out"
      cd /d "jdk-out"
      7z x tools.zip -ojdk
      cd /d "jdk"
      for /r %%x in (*.pack) do .\bin\unpack200 -r "%%x" "%%~dx%%~px%%~nx.jar"
      mkdir "%~dp0\unpacked-jdk"
      xcopy /s "%~dp0\jdk-out\jdk" "%~dp0\unpacked-jdk"
      cd /d "%~dp0"
      rmdir /s /q "%~dp0\jdk-out"
  4. start above script from command line with single parameter (name of downloaded JDK exe installer file). For example:
    unpack jdk-8u152-windows-x64.exe

    or

    unpack jdk-9.0.1_windows-x64_bin.exe

Continue reading “How to install Windows JDK without installation”

How to make JSP scriplets on Java 7, Java 8 and above on Apache Sling and Adobe AEM

Sling implementation allow to render JSP with scriplets (of cause we using scriplets instead of Groovy console for hot-fixes). By default JSP compiler allow to write code compatible with Java 6 therefore if on server we has JVM version greater than 6 and desire to write code for recent JVM with additional benefits like Diamond operators from Java 7 or Lambdas and Streams from Java 8 we should configure JSP Scripts Handler to process required Java version otherwise we will see the compilation error: Continue reading “How to make JSP scriplets on Java 7, Java 8 and above on Apache Sling and Adobe AEM”

Project on Magnolia CMS (Community Edition) from scratch

In this series of articles I’ll try to provide easy steps on how to create Magnolia CMS project with Community Edition version from scratch. I have installed Linux OS (Linux Mint) therefore all  my steps suitable for this OS, if your OS is different from mine you can simply change some paths within commands and all described steps will be valid for you.

Note: Before we start let’s open Magnolia CMS site and check required magnolia version (I’m referrer latest version for new projects). For current time this is 5.5.4 Continue reading “Project on Magnolia CMS (Community Edition) from scratch”