Wednesday, 30 July 2008

Oracle Forms: Jar Icon Images

Oracle web forms uses image files for icons, by default forms will get each image individually, wasting time and bandwidth.

If you add the images to a jar file they are compressed and are loaded at startup, so each form wouldn't need to load the images each time. It also seems like a neater solution.

This code is a windows command script for creating the icon jar file.
The three parameters need to be set for each system.
  • oh = Oracle home
  • id = Icon directory
  • jf = Jar filename

TITLE Jar Icons

SET oh="C:\Oracle\DS10"
SET id="C:\MyApp\icons"
SET jf="C:\MyApp\icons.jar"

CD /D %id%

%oh%\jdk\bin\jar -cvf %jf% *.*

TITLE Jar Icons Complete


You then need to place the jar file on to your web server, so the web server can access them via a URL.
If you placed the jar file in the forms/java directory you wouldn't need a path, however mixing application and forms files isn't best practice.
The URL path to the jar file needs to be added to the archive parameter in forms/server/formsweb.cfg file, so for example:


or in the archive_jini parameter, if you use JInitiator


You also need to set the imagebase parameter


You can then reference the icons by name inside the form and they should then be displayed.

Quicker, Faster, Neater Forms Icons.. Done.

No comments: