简体   繁体   English

jboss的run.bat文件未通过Java程序运行

[英]jboss run.bat file is not running through java program

When I double click on run.bat file present at C:\\jboss-6.1.0.Final\\bin location, then I jboss is starting perfectly. 当我双击位于C:\\ jboss-6.1.0.Final \\ bin位置的run.bat文件时,那么我的jboss可以完美启动了。 Even through cmd also it is starting perfectly. 即使通过cmd,它也可以完美启动。 But when I am trying to run this bat file through a java program it is not starting. 但是,当我尝试通过Java程序运行此bat文件时,它没有启动。 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))" 它显示为“无法从'file:logging.properties'(java.io.FileNotFoundException:logging.properties(系统找不到指定的文件))中读取日志记录配置”

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) 之后,我按如下所示修改了bat文件,我将一行从(在以下更改中,我将%DIRNAME%更改为“ 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. 现在它正在运行,但cmd挂起(文本闪烁),并且服务器未启动。

And the java prog I ve written in eclipse is as below: 我用eclipse编写的Java程序如下:

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). 如果您在Windows上运行, C:\\Java\\jboss-6.1.0.Final\\bin\\logging.properties包裹在"" (双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. 我试图通过编写批处理助手文件来对此进行调整,其中包含导航到run.bat文件夹并执行run.bat文件的步骤。 The runHelper.bat file looks like this. runHelper.bat文件如下所示。

    cd\
    cd C:\jboss-6.1.0.Final\bin\
    run.bat >LoggerOutput.txt
    exit

And my java code looks like this. 我的Java代码看起来像这样。

    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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM