cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
james_decosta
Level 9

this is the code but it does not work

hi,
How should i use getResource(),i am including a file got valuetouse.txt in the installer and then in the pre install custom code action class i am using it in the public void install (method)

public void install(InstallerProxy ip) throws InstallException {
// TODO Auto-generated method stub
URL somepath=ip.getResource("/valuetouse.txt");
String forManipulation=somepath.toString();
System.out.println(forManipulation);
ip.setVariable("$SOMETHING$",forManipulation);

}
What is the correct way for passing valuetouse.txt in the installer??????????
Where am i going wrong
the code is like this:

/**
*
*/
package com.installanywhere.exper;

import java.net.URL;

import com.zerog.ia.api.pub.CustomCodeAction;
import com.zerog.ia.api.pub.InstallException;
import com.zerog.ia.api.pub.InstallerProxy;
import com.zerog.ia.api.pub.UninstallerProxy;

/**
* @author james
*
*/
public class SampleCustomCodeAction extends CustomCodeAction {

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#getInstallStatusMessage()
*/
@Override
public String getInstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#getUninstallStatusMessage()
*/
@Override
public String getUninstallStatusMessage() {
// TODO Auto-generated method stub
return null;
}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#install(com.zerog.ia.api.pub.InstallerProxy)
*/
@Override
public void install(InstallerProxy ip) throws InstallException {
// TODO Auto-generated method stub
URL somepath=ip.getResource("/valuetouse.txt");
String forManipulation=somepath.toString();
System.out.println(forManipulation);
ip.setVariable("$SOMETHING$",forManipulation);

}

/* (non-Javadoc)
* @see com.zerog.ia.api.pub.CustomCodeAction#uninstall(com.zerog.ia.api.pub.UninstallerProxy)
*/
@Override
public void uninstall(UninstallerProxy arg0) throws InstallException {
// TODO Auto-generated method stub

}

}

But when i used it ,i got the value as null when i checked for $SOMETHING$
Labels (1)
0 Kudos
(1) Reply
james_decosta
Level 9

hi,
i want to know if anyone has tried this one.
james
0 Kudos