Friday 22 May 2015

Building OpenJFX 9 on Windows with Visual Studio 2013 Community

This post is a step by step to build OpenJFX 9 on Windows (10 64bits). It is a refresh of the "Building OpenJFX on Windows" for the 9 sources and with Visual Studio 2013 (Community here) which is now used by Oracle.

Last updated: 2016-10-08, Mercurial URL change
  1. Create a C:\dev directory
  2. Download and install JDK 9 b109
  3. Delete C:\Program Files\Java\jdk-9\lib\jfxrt.jar as otherwise the build won't succeed 
  4. Download Gradle 2.11 and extract it into C:\dev
  5. Download and install Visual Studio 2013 Community
    1. Download (it may be faster to download the ISO)
    2. Install
      • uncheck all the options
      • or download AdminDeployment.xml to C:\dev\temp then start the installation with:
        vs_community.exe /AdminFile C:\dev\temp\AdminDeployment.xml
  6. Download and install Babun
  7. Download and install Mercurial
  8. In C:\dev open a standard console
  9. Get the sources:
    In the console copy:
    hg clone http://hg.openjdk.java.net/openjfx/9/rt/ jfx
    (or hg clone http://hg.openjdk.java.net/openjfx/9-dev/rt/ jfx which is slighly ahead)
  10. Set up some environment variables:
    Still in the console:
    set GRADLE_HOME=C:\dev\gradle-2.11
    set JAVA_HOME=C:\Program Files\Java\jdk-9
    set PATH=%PATH%;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%USERPROFILE%\.babun\cygwin\bin


  11. Build:
    Still in the console:
    cd jfx
    gradle
  12. Build the JDK (see the full instructions)

  13. In the console that built OpenJFX:
    set JIGSAW_HOME=C:\dev\jdk9\build\windows-x86_64-normal-server-release\images\jdk

    gradle apps
    then
    %JIGSAW_HOME%\bin\java -jar C:\dev\jfx-jake\apps\samples\Ensemble8\dist\Ensemble8.jar
  14. Hack...

Using Babun seems to take care of the Cygwin packages that are needed by OpenJFX, those that may not be already installed may be added using:
pact install  <package name>
(an exception being g++: mingw64-x86_64-gcc-g++ )

Thursday 14 May 2015

Building Java 9 on Windows with Visual Studio 2013 Community

As the JDK moves to Visual Studio 2013 for its toolchain, this version focuses on building Java 9 on Windows (10 64bits) with Visual Studio 2013 (Community). As it takes a few short-cuts, refer to the Java 9 with plain Windows SDK version or/and to the Java 8 version (for using plain Cygwin).

  1. Create a C:\dev\ directory
  2. Download and install Visual Studio 2013 Community
    1. Download (it may be faster to download the ISO)
    2. Install
      • uncheck all the options
      • or download AdminDeployment.xml to C:\dev\temp then start the installation with:
        vs_community.exe /AdminFile C:\dev\temp\AdminDeployment.xml
    3. Add the path to MSBuild to the PATH environement variable (required to build Freetype):
      C:\Program Files (x86)\MSBuild\12.0\Bin
  3. Download and install the Mercurial for Windows 
  4. Download and install Java 8 (if not already done)
  5. Download and install Babun, then use its package manager to install zip :
    pact install zip
  6. Download Freetype source (2.5.5) and extract to C:\dev\freetype-2.5.5
  7. In the Babun console:
    cd /cygdrive/c/dev
  8. Get the root source:
    hg clone http://hg.openjdk.java.net/jdk9/jdk9/
     (or the more bleeding edge http://hg.openjdk.java.net/jdk9/dev/ )
  9. Move to the new directory
    cd /cygdrive/c/dev/jdk9
  10. Get the remainder of the source
    ./get_source.sh 
  11. Force the permissions
    chmod -R u+rwxs .
    (otherwise some files get access denied errors)
  12. Run the auto-conf script
    bash configure --with-freetype-src=/cygdrive/c/dev/freetype-2.5.5
  13. Time for cooking
    make images
  14. Once done, open a new standard Windows console and navigate to
    C:\dev\jdk9\build\windows-x86_64-normal-server-release\images\jdk
    check that java runs:
    bin\java -version
    or for something a bit more visual:
    bin\jconsole
  15. enjoy!
For day to day refresh do the following (in the Babun shell):
  1. Go to the JDK directory
    cd /cygdrive/c/dev/jdk9
  2. Get the sources updates
    ./get_source.sh
  3. Force the permissions
    chmod -R u+rwxs .
  4. Remove the build directory
    rm -rf build/
  5. Rerun the auto-conf script to update the time stamp of the build:
    bash configure --with-freetype-src=/cygdrive/c/dev/freetype-2.5.5
  6. Re-heat
    make images

Thursday 5 February 2015

Using JDK9/Jigsaw-m2 for Netbeans projects

Last updated: 2015-12-06, nightly builds (aka Development builds) now support the current JDK 9, so this post is no longer of any use.

When Jigsaw/m2 appeared on the OpenJDK, I tried it with my usual guinea pig, NetBeans. Launching was fine, however using Jigsaw as the platform for a project was not due to the new image (JEP 220). In due time it will be supported but currently it isn't. So I set out to see if I could not add some support myself.
Since I first wrote this post the NetBeans team started their work for supporting JDK 9, check the NetBeans JDK 9 support wiki page for more.

For now the following seem to work for me:
  • define a JDK 9 platform
  • class indexation and autocompletion
  • run
I tested with an own build jdk9/jdk9 (so it should also work with a recent JDK9 early access build)

To try with your own NetBeans build:
  1. Download the diff (view)
  2. Import it with Mercurial
To run NetBeans with JDK 9 yet develop for it, add the following lines to <nb working copy>/nbbuild/user.build.properties :
nbjdk.home=C:\\Program Files\\Java\\jdk1.7.0_76
# if nbjdk.home is pointing to a JDK8 then uncomment:
#permit.jdk8.builds=true
To launch an instance of NetBeans running JDK 9 via NetBeans, in <nb working copy>/nbbuild/build.xml, for the tryme target, change the value of the <arg file="${nbjdk.home}"/> of the exec task to the path to JDK9

Explore!