I figured out the answer. I did not have a manifest file in my eclipse project, so I created a file called manifest.mf
and put the following code into it.
Manifest-Version: 1.0
Trusted-Library: true
When building the jar file in eclipse, on the 3rd page, it asks you for a manifest file. I believe it defaults this option to 'Create a manifest file for me', but this manifest file only contains the first line above. Choose the option that says 'Use existing manifest from workspace', and choose your manifest.mf file you just created. Then sign your jar as you normally would.
It was the Trusted-Library
attribute that fixed the problem. Check out this page for more information on this attribute and other Privileged code jar files.