phoenix_ml
Level 3

Running command in new window

HI All,

In my installation I need to start up the BEA Weblogic in a different window, however, I have tried using the command line and script/batch file commands with /K but it is not triggering a new window and have tried running the commands in an infinite loop within the installer (the option to wait until process is completed is ticked)

I have even tried creating a temporary batch file with the following and then executing the script/batch file action but still it does not work

cd C:\temp\
run.bat

where run.bat has the following commands in it
C:\windows\system32\cmd.exe /K C:\bea\user_projects\domains\test\bin\startWeblogic.cmd

Any advice would be appreciated

thank!
Labels (1)
0 Kudos
2 Replies
purcellk24
Level 7

I create a WLST .py file and execute
java weblogic.WLST startup.py
In that py file, I have a timeout, so if it doesn't start after so long, it gives an exit code which I then look for. I then configure WL and shut it down.

But if you want to keep it running, I wrote custom code which basically uses the ANT project and ExecTask with setSpawn(true) while launching the startWebLogic.cmd file. I don't know if it is the best way, but it works for me.

  public void install(InstallerProxy ip) throws InstallException
{
// Get IA variables
String domainDirName = ip.substitute("$WL_DOMAIN_DIR$");
//String domainName = ip.substitute("$WL_DOMAIN_NAME$");
String logFileName = domainDirName + "/adminserver.log";
boolean isWindows = ((System.getProperty("os.name").toLowerCase()).indexOf("win") > -1);

// Initialize Ant project
Project p = new Project();
p.init();

// Setup re-direct file and workinf dir
Variable envRedirectLog = new Variable();
envRedirectLog.setKey("WLS_REDIRECT_LOG");
envRedirectLog.setValue(logFileName);

File domainDir = new File(domainDirName);
ExecTask et = new ExecTask();
et.setProject(p);
et.setSpawn(true);
et.setDir(domainDir);
et.addEnv(envRedirectLog);

// Create Arguments to execute
Argument commandLine = et.createArg();
boolean resolveExecutable = false;
String executable = null;
String argValue = null;
if (isWindows)
{
resolveExecutable = true;
executable = "cmd.exe";
argValue = "/c " + domainDir.getAbsolutePath() + "\\startWebLogic.cmd";
}
else
{
resolveExecutable = false;
executable = "/bin/sh";
argValue = domainDir.getAbsolutePath() + "/startWebLogic.sh";
commandLine.setValue("-c");
}

et.setExecutable(executable);
et.setResolveExecutable(resolveExecutable);
commandLine.setValue(argValue);

et.execute();

// Sleep for linux startups or it goes too quickly
try
{
Thread.sleep(5000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
0 Kudos
phoenix_ml
Level 3

Thanks heaps for that purcell!
0 Kudos