:: Article Deprecated!

:: Fantom 1.0.68 resolves the issue outlined in this article.

:: Article Deprecated!

Fanny the Fantom How to install Fantom 1.0.67 on a Windows 64-bit machine.

If you're running Windows 64-bit and have a 64-bit Java JDK installed then the chances are, when you try to run Fantom, you'll get the following error:

C:\> fan -version

ERROR: Cannot read registry: SOFTWARE\JavaSoft\Java Runtime Environment Current Version

Don't worry, you can fix it in one of two ways:

The Easy Way

The easy way is to install Fantom with:

Fantom Windows Installer

which configures all your environment variables and caters for both 32-bit and 64-bit systems.

Or for a more manual approach, download the Fantom distribution for Windows 64-bit:

fantom-1.0.67-win32-x86_64.zip (9.48 MB)

Note that the installers and distributions above are created and maintained by me, and therefore are not official Fantom releases.

The Hard Way

Alternatively, you can create the distribution yourself by following these steps:

1. Replace.exe files with .cmd files

The registry error is caused by a 32-bit / 64-bit compatibility issue with fan.exe, the Fantom launcher for Windows.

But unless you're compiling Fantom itself in a bootstrap build, there's no real reason to use fan.exe. So we replace the .exe with a .cmd file that calls Java direct:

fan.cmd

@java -cp "%FAN_HOME%\lib\java\sys.jar" fanx.tools.Fan %*

We can also do the same for fant:

fant.cmd

@java -cp "%FAN_HOME%\lib\java\sys.jar" fanx.tools.Fant %*

We can replace the other .exe files with .cmd files that simply route to fan.cmd:

fanp.cmd

@call fan compiler::Fanp %*

fanr.cmd

@call fan fanr %*

fansh.cmd

@call fan fansh %*

flux.cmd

@call fan flux %*

Note: Don't forget to delete the .exe files because these take precedence and Windows will still call fan.exe if it exists.

The distribution also has empty file named null.exe, this is so F4 will still recognise the directory as a valid Fantom install.

2. Install SWT for Windows 64-bit

To run or develop any desktop FWT application you'll need to install a version of SWT for Windows 64-bit.

This is covered in detail in Running FWT On 64-Bit Platforms so I'll not repeat it here.

The distribution also deletes the SWT jars for other platforms.

3. Delete all.DS_Store files

Okay, so this isn't an essential step! But being an OCD Windows user you don't really want those annoying junk files for a MacOS lying around, so lets delete them:

C:\> cd %FAN_HOME%

C:\Apps\fantom-1.0.67> del /s /q /f *.DS_Store

4. Config Tweaks

The distribution also makes some minor tweaks to %FAN_HOME%\etc\sys\config.props. Namely:

Increase the number of stack frames from 25 to 50:

// Default depth of Err.trace used for stack tracing
errTraceMaxDepth=50

Turn on debug info:

// If debug is set to true, then the runtime emits debug
// information such as the LocalVariableTable for debuggers
// This property can only be configured by bootstrap homeDir.
debug=true

If you start to compile java files as part of your Fantom builds then you'll probably have to edit %FAN_HOME%\etc\build\config.props to update the jdkHome property.

5. Done

And that's it! Your Windows 64-bit Fantom installation is good to go!

Test it running fan on the command line:

select all
C:\> fan -version

Fantom Launcher
Copyright (c) 2006-2013, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0

Java Runtime:
  java.version:    1.6.0_45
  java.vm.name:    Java HotSpot(TM) 64-Bit Server VM
  java.vm.vendor:  Sun Microsystems Inc.
  java.vm.version: 20.45-b01
  java.home:       C:\Apps\Java\jdk1.6.0_45\jre
  fan.platform:    win32-x86_64
  fan.version:     1.0.67
  fan.env:         sys::BootEnv
  fan.home:        C:\Apps\fantom-1.0.67

Further Reading

Edits:

  • 31 Jul 2016 - Deprecated.
  • 20 Jan 2015 - A typo in fanr.cmd caused a Batch Recursion Error! Fixed typo and uploaded new .zip file.
  • 22 Aug 2015 - Batch files now handle spaces in the %FAN_HOME% environment variable.
  • 11 Jan 2015 - Original article.

Discuss