cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
trackercanada
Level 2

putResource/getResource issue

Hello, I have used putResource( "path/filename", "filename") to
put files into the installation archive from a build() method.
The files are properly added to archive.

No problem so far.

However, I have created a custom control and want to be
able to access the file with URL url = something?.getResource( "filename" ) from
within a actionPerformed() method for the control.

Is there a way to do this?

James
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

For auxiliary files you want to use at run time but not install, per se, you might look at the Support Files view and the topic "Using Support Files". (For example, the license-agreement dialog box uses this technique.)

I haven't tried it from a dialog box class, but if you have used putResource in a build method somewhere, you can use the com.installshield.util.FileUtils class with something like this:
// get the location of the resource in the archive...
java.net.URL url = getResource("resource.name");

// ...extract the resource to a temporary location...
String tempfile =
FileUtils.createTempFile(url, "temp.resource.name");

// ...and then do something with contents of tempfile
(I think you'll need to catch java.io.IOException with this.)
0 Kudos
tjcemc
Level 4

Does this technique apply to DLL files. I have some custom code that calls out to a jar file (successfully imported using support.putArchive()) BUT the class in that jar file eventually makes a call to a DLL file (which is not in the PATH and not in the current directory). I know where the DLL is, I just don't know how to include it in my project. I tried to change the PATH variable, with no luck. How the heck do I simply supply some dependant DLLs that the install shield JVM will know about!
0 Kudos