When I double click on run.bat file present at C:\\jboss-6.1.0.Final\\bin location, then I jboss is starting perfectly. Even through cmd also it is starting perfectly. But when I am trying to run this bat file through a java program it is not starting. it is showing like "Unable to read the logging configuration from 'file:logging.properties' (java.io.FileNotFoundException: logging.properties (The system cannot find the file specified))"
After that I modified the bat file as below I changed a line from(In below change I have changed %DIRNAME% to ”C:\\Java\\jboss-6.1.0.Final\\bin\\logging.properties)
rem Setup JBoss specific properties
set JAVA_OPTS=-Dprogram.name=%PROGNAME% -Dlogging.configuration=file:%DIRNAME%logging.properties %JAVA_OPTS%"
to
rem Setup JBoss specific properties
set JAVA_OPTS=-Dprogram.name=%PROGNAME% -Dlogging.configuration=file:”C:\Java\jboss-6.1.0.Final\bin\logging.properties\logging.properties"%JAVA_OPTS%"
Now it running but cmd is hanging(text are blinking) and server is not starting.
And the java prog I ve written in eclipse is as below:
public class Batch {
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
String[] command = {"cmd.exe", "/C", "Start", "C:\\jboss-6.1.0.Final\\bin\\run.bat"};
Runtime r = Runtime.getRuntime();
Process p = r.exec(command);
p.waitFor();
}catch(Exception ex){ex.printStackTrace();}
}
}
any body have any idea how to resolve it? Any help would be highly appriciated. :-)
If you are running on windows, wrap C:\\Java\\jboss-6.1.0.Final\\bin\\logging.properties
into ""
(double qoute).
rem Setup JBoss specific properties
set JAVA_OPTS=-Dprogram.name=%PROGNAME% -Dlogging.configuration=file:"C:\Java\jboss-6.1.0.Final\bin\logging.properties" "%JAVA_OPTS%"
I tried to tweak this by writing a batch helper file.This contains steps to navigate to run.bat folder and execute the run.bat file. The runHelper.bat file looks like this.
cd\
cd C:\jboss-6.1.0.Final\bin\
run.bat >LoggerOutput.txt
exit
And my java code looks like this.
String[] command = {"cmd.exe", "/C", "Start", "C:\\jboss-6.1.0.Final\\bin\\runHelper.bat"};
Runtime r = Runtime.getRuntime();
Process p = r.exec(command);
p.waitFor();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.