Java Error : IllegalArgumentException when using ImageIO.write

I try to make a java agent to convert .tif to .jpg. I’m using the ImageIO package, but I’m getting an IllegalArgumentException error when executing the agent.

Java Code in agent :

String inputFile = “c:\temp\Images.tif”;

String outputFile = “c:\temp\Images.jpg”;

File in = new File(inputFile);

File out = new File(outputFile);

BufferedImage bufi;

bufi = ImageIO.read(in);

ImageIO.write(bufi, “jpg”, out);

Full Error trace :

java.lang.IllegalArgumentException: im == null!

at javax.imageio.ImageIO.write(ImageIO.java:1459)

at javax.imageio.ImageIO.write(ImageIO.java:1518)

at JavaAgent.NotesMain(JavaAgent.java:41)

at lotus.domino.AgentBase.runNotes(Unknown Source)

at lotus.domino.NotesThread.run(Unknown Source)

When I’m trying this small code in a Java Class in Eclipse, this works well.

Any idea what is different when executing in lotus java agent?

the agent is set with “allow restricted operations…”

Thanks in advance,

Fabian

Subject: which JVM are you using in eclipse ?

Notes/Domino ship with a built in JVM, you should make sure that they are the same version (you can set up eclipse to use different jvms). Also I couldn’t see any variable for ‘im’ - is that a typo ?