This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Re: Win32RegistryService in custom code
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 05, 2011
10:59 AM
Win32RegistryService in custom code
Hi,
I am writing some customcode to access the Windows registry and it is not compiling. I get a the following error in my ant output:
[CODE] [javac] ...\customcode\com\progress\devstudio\install\action\FindPathInWindowsRegistry.java:84: cannot access com.installshield.wizard.service.Service
[javac] class file for com.installshield.wizard.service.Service not found
[javac] String[] instanceKeys = wrs.getSubkeyNames(hive, winregKeyProduct);
[javac] ^[/CODE]
I searched these forums for answers and found this thread: http://community.flexerasoftware.com/showthread.php?t=183357. Following Robert Dickau's final post, I have services.jar and windowsppk.jar in my classpath, but I cannot figure out how to "Add service support for custom code" in my IA2011 project. Does anyone know how to do that?
Below is my java. If you could help me get past this compiling issue that would be great.
-Jeff
[CODE]
import com.zerog.ia.api.pub.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.platform.win32.*;
public class FindPathInWindowsRegistry extends CustomCodeAction
{
public void install( InstallerProxy ip ) throws InstallException
{
// Get Input vars
String pathToMatch = ip.substitute("$PATH_TO_MATCH$");
String winregKeyProduct = ip.substitute("$WINREG_KEY_PRODUCT$");
// Init some vars
int hive = 0;
String pathMatch = "false";
String winregKeyProductInstance = null;
Win32RegistryService wrs = (Win32RegistryService) ip.getService(Win32RegistryService.class);
try
{
hive = wrs.HKEY_LOCAL_MACHINE;
String[] instanceKeys = wrs.getSubkeyNames(hive, winregKeyProduct);
for ( int i=1; i {
if ( wrs.getStringValue(hive, instanceKeys, "Path", true).matches(pathToMatch) )
{
winregKeyProductInstance = instanceKeys;
pathMatch = "true";
break;
}
}
}
catch(ServiceException se) {
//System.out.println(se.getMessage());
se.printStackTrace( );
}
// Set Output vars
ip.setVariable("$WINREG_KEY_PRODUCT_INSTANCE$", winregKeyProductInstance);
ip.setVariable("$PATH_MATCH$", pathMatch);
}
// ...
}
[/CODE]
I am writing some customcode to access the Windows registry and it is not compiling. I get a the following error in my ant output:
[CODE] [javac] ...\customcode\com\progress\devstudio\install\action\FindPathInWindowsRegistry.java:84: cannot access com.installshield.wizard.service.Service
[javac] class file for com.installshield.wizard.service.Service not found
[javac] String[] instanceKeys = wrs.getSubkeyNames(hive, winregKeyProduct);
[javac] ^[/CODE]
I searched these forums for answers and found this thread: http://community.flexerasoftware.com/showthread.php?t=183357. Following Robert Dickau's final post, I have services.jar and windowsppk.jar in my classpath, but I cannot figure out how to "Add service support for custom code" in my IA2011 project. Does anyone know how to do that?
Below is my java. If you could help me get past this compiling issue that would be great.
-Jeff
[CODE]
import com.zerog.ia.api.pub.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.platform.win32.*;
public class FindPathInWindowsRegistry extends CustomCodeAction
{
public void install( InstallerProxy ip ) throws InstallException
{
// Get Input vars
String pathToMatch = ip.substitute("$PATH_TO_MATCH$");
String winregKeyProduct = ip.substitute("$WINREG_KEY_PRODUCT$");
// Init some vars
int hive = 0;
String pathMatch = "false";
String winregKeyProductInstance = null;
Win32RegistryService wrs = (Win32RegistryService) ip.getService(Win32RegistryService.class);
try
{
hive = wrs.HKEY_LOCAL_MACHINE;
String[] instanceKeys = wrs.getSubkeyNames(hive, winregKeyProduct);
for ( int i=1; i
if ( wrs.getStringValue(hive, instanceKeys, "Path", true).matches(pathToMatch) )
{
winregKeyProductInstance = instanceKeys;
pathMatch = "true";
break;
}
}
}
catch(ServiceException se) {
//System.out.println(se.getMessage());
se.printStackTrace( );
}
// Set Output vars
ip.setVariable("$WINREG_KEY_PRODUCT_INSTANCE$", winregKeyProductInstance);
ip.setVariable("$PATH_MATCH$", pathMatch);
}
// ...
}
[/CODE]
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2011
01:38 AM
Open your project in Advanced Designer, then go to Project/Java, there you'll find the "Add service support for custom code" checkbox.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 07, 2011
01:48 PM
Does anyone know why my code isn't compiling? Please help!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 19, 2011
11:01 AM
Problem solved.
I took a break from this issue for a bit, tried it again, this time with my classpath properly set, and, magically, it compiled. Funny how that works...
Oh, I also needed uninstall, getInstallStatusMessage and getUninstallStatusMessage methods. Without them I got this error: ... is not abstract and does not override abstract method getUninstallStatusMessage() in com.zerog.ia.api.pub.CustomCodeAction.
-Jeff
I took a break from this issue for a bit, tried it again, this time with my classpath properly set, and, magically, it compiled. Funny how that works...
Oh, I also needed uninstall, getInstallStatusMessage and getUninstallStatusMessage methods. Without them I got this error: ... is not abstract and does not override abstract method getUninstallStatusMessage() in com.zerog.ia.api.pub.CustomCodeAction.
-Jeff