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
- :
- Hi use this code in CustomcodeRule of message dialog as james specified
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Feb 21, 2008
07:59 AM
pre-install phase - execute binary
I must be doing something wrong (again). During the pre-install phase, I input a tcpip port # from the user. Before I go to the next step, I'd like to see if this port is ok to use or not.
I wrote some java code that opens a socket to determine if it's available (or not). My test code works ok.
However, is there a way to call this? I tried using $USER_INSTALL_DIR$\myfile, etc. However, $USER_INSTALL_DIR$ doesn't exist yet.
I currently execute the check in the post-install phase. It works - but would be much nicer to execute in pre-install (imho).
I wrote some java code that opens a socket to determine if it's available (or not). My test code works ok.
However, is there a way to call this? I tried using $USER_INSTALL_DIR$\myfile, etc. However, $USER_INSTALL_DIR$ doesn't exist yet.
I currently execute the check in the post-install phase. It works - but would be much nicer to execute in pre-install (imho).
(2) Replies
‎Feb 21, 2008
08:18 AM
hi,
we can do like this :
You use a message dialog feature of installanywhere,
then you add a custom code rule on the message dialog
by clicking on evaluate custom rule
Give the path of the jar file which contains the TCPIPPORT.class
Give the fully qualified name of the class next
like com.xxx.installer.TCPIPPORT(.CLASS extension is not required dont give)
Write a custom code rule like this:
public class TCPPORTRuleAnother extends CustomCodeRule {
public boolean evaluateRule() {
try {
/* Write your code for verification here
if it is a TCPIP port
then */
return false
}
else {
return true}
}
}
we can do like this :
You use a message dialog feature of installanywhere,
then you add a custom code rule on the message dialog
by clicking on evaluate custom rule
Give the path of the jar file which contains the TCPIPPORT.class
Give the fully qualified name of the class next
like com.xxx.installer.TCPIPPORT(.CLASS extension is not required dont give)
Write a custom code rule like this:
public class TCPPORTRuleAnother extends CustomCodeRule {
public boolean evaluateRule() {
try {
/* Write your code for verification here
if it is a TCPIP port
then */
return false
}
else {
return true}
}
}
‎Feb 22, 2008
07:51 AM
public boolean evaluateRule()
{
if (!portValue.equals(System.getProperty("port")))
{
if (portScan("localhost", Integer.parseInt(portValue)))
{
ruleProxy.setVariable("errorMsg", "Port number " + portValue + " Port already in use.");
return true;
}
System.setProperty("port", portValue);
}
if (!shutdownPortValue.equals(System.getProperty("shutdownPort")))
{
if (portScan("localhost", Integer.parseInt(shutdownPortValue)))
{
ruleProxy.setVariable("errorMsg", "ShutdownPort number " + shutdownPortValue + " Port already in use.");
return true;
}
System.setProperty("shutdownPort", shutdownPortValue);
}
{
if (!portValue.equals(System.getProperty("port")))
{
if (portScan("localhost", Integer.parseInt(portValue)))
{
ruleProxy.setVariable("errorMsg", "Port number " + portValue + " Port already in use.");
return true;
}
System.setProperty("port", portValue);
}
if (!shutdownPortValue.equals(System.getProperty("shutdownPort")))
{
if (portScan("localhost", Integer.parseInt(shutdownPortValue)))
{
ruleProxy.setVariable("errorMsg", "ShutdownPort number " + shutdownPortValue + " Port already in use.");
return true;
}
System.setProperty("shutdownPort", shutdownPortValue);
}