Fiji with python scripts "Failed to install java.nio.charset.UnsupportedCharsetException: cp0


After finding great help to develop a Jython script to analyze bulk images on Fiji, now I got weirdly stuck with the most known error: “Failed to install java.nio.charset.UnsupportedCharsetException: cp0”.

I previously run the script and it worked for most of my folders except crushing at some point and leaving some data un-analyzed. After I opened back Fiji I got the above error.

I checked everywhere online and already tried this fixing:

  • Add -Dpython.console.encoding=UTF-8 in my ImageJ.cfg file
  • Run in debug mode (duplicate the .exe and rename it as debug.exe) +/- activating the debug mode from Fiji
  • Update Java version both manually that through normal installation
  • Remove and re-install Fiji
  • Manually install another version of Jython

Nothing works and I am kind of losing hope… does anyone have any ideas? I can’t find anything online anymore.



This information might help:


Thanks I checked this as well already, the script has been kindly written by a member of this forum and already have this feature!

#@ File (label="Select a directory", style="directory") myDir
from __future__ import print_function
from ij import IJ

def main():
	root = myDir.getPath() # get the root out the java file object
	import os, glob

	# set up bioformats
	from loci.plugins import BF
	from import ImporterOptions
	options = ImporterOptions()
	options.setGroupFiles(True)  # if the files are named logically if will group them
	# this will do the maximum intensity projection
	from ij.plugin import ZProjector
	Zproj = ZProjector()

	for path, subdirs, files in os.walk(root):
		# just get the one of the files that matches your image pattern
		flist = glob.glob(os.path.join(path,"*_?.tif"))
		if( flist ):
			file = flist[0]
			print("Processing {}".format(file))
			imp = BF.openImagePlus(options)[0]

			# show the image if you want to see it

			imp_max =,'max')

			# save the Z projection,file.rsplit('_',1)[0]+'_processed.tif')

			# closes the windows if they are open
if( __name__ == '__builtin__'):

You advice to change the final part with "if name in [‘builtin’, ‘main’]: run_script() " ?