Illegal UTF8 string in constant pool in class file


February 2019


7.3k time


I am trying to make a Java applet for my website. I'm having major issues getting it to work.

I get this error: Illegal UTF8 string in constant pool in class file

You can see this error here:

The code for this applet can be found here:

This applet was exported as a Jar in Eclipse, and uploaded to my website via CoffeeCup Direct FTP.

4 answers


This happened to me when a ubuntu laptop powered down during n SBT project compile in IntelliJ.

"Illegal UTF8 string in constant pool in class file org/apache/spark/ml/linalg/DenseMatrix"

The solution was to restart the laptop then do a invalidate/cache restart.


illegal utf8 in constant pool class format error.... this java error tired me. ı could not solve it for several weeks in mac. finally found the way mac>preferences>java>genral>settings>delete files>default settings was the solution


(EDIT: The jar file on the server has now changed...)

It's hard to help without any background, code etc.

Given that the jar file itself is invalid (I've just downloaded it and tried to open it) I suspect you did something like uploading it to your hosting provider in ASCII instead of BINARY mode.

If my psychic debugging powers have failed this time (and this was really stretching them) I strongly suggest you give us more information - importantly:

  • How did you build your jar file?
  • Does your jar file work locally?
  • How have you uploaded it to your hosting provider?

Looking at the jar file with a hex editor, it appears to have some Java source code in it in plain text - uncompressed which would be somewhat odd in a jar file. It also doesn't open as a valid zip file...


I have faced similar issue while running command gradle clean build in my spring boot project. I have just restarted my laptop. Then problem solved!.