本文来源于百度空间
我下载的JBOSS服务器启动不了,环境变量配了好久,尝试了各种方式,网上也都搜集了好多,,现将最实用简单的解决方法转载如下:
如果装了JDK,没有配系统环境变量的话,是启动不了的
不过,不配也行,可以直接在jboss/bin目录下的run.bat文件中加上如下一句话就行
set JAVA_HOME=jdk的安装目录(如:D:\Program Files\Java\jdk1.6.0_13)
这里的jdk1.6.0_13是我安装的JDK,我现在直接把它复制到jboss目录下,然后在run.bat中设置一下JAVA_HOME就OK了
具体的加在哪里,可以参考下面的
rem Find run.jar, or we can't continue
set RUNJAR=%JBOSS_HOME%\bin\run.jar
if exist "%RUNJAR%" goto FOUND_RUN_JAR
echo Could not locate %RUNJAR%. Please check that you are in the
echo bin directory when running this script .
goto END
:FOUND_RUN_JAR
set JAVA_HOME=jdk的安装目录(如:D:\Program Files\Java\jdk1.6.0_13)
if not "%JAVA_HOME%" == "" goto ADD_TOOLS
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SKIP_TOOLS
:ADD_TOOLS
set JAVA=%JAVA_HOME%\bin\java
如果要关闭jboss的话,同样也得在shutdown.bat中像上面那样加一句JAVA_HOME配置,如下
rem Find MAIN_JAR, or we can't continue
set MAIN_JAR=%DIRNAME%\%MAIN_JAR_NAME%
if exist "%MAIN_JAR%" goto FOUND_MAIN_JAR
echo Could not locate %MAIN_JAR%. Please check that you are in the
echo bin directory when running this script .
goto END
:FOUND_MAIN_JAR
set JAVA_HOME=jdk的安装目录(如:D:\Program Files\Java\jdk1.6.0_13)
if not "%JAVA_HOME%" == "" goto HAVE_JAVA_HOME
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SKIP_SET_JAVA_HOME
:HAVE_JAVA_HOME
然后保存.
直接双击shutdown.bat是不行的,
会发现有一段说明,告诉你,需要用使用参数才行.
A JMX client to shutdown (exit or halt) a remote JBoss server.
usage: shutdown [options] <operation>
options:
-h, --help Show this help message (default)
-D<name>[=<value>] Set a system property
-- Stop processing options
-s, --server=<url> Specify the JNDI URL of the remote server
-n, --serverName=<url> Specify the JMX name of the ServerImpl
-a, --adapter=<name> Specify JNDI name of the MBeanServerConnection to
use
-u, --user=<name> Specify the username for authentication
-p, --password=<name> Specify the password for authentication
operations:
-S, --shutdown Shutdown the server
-e, --exit=<code> Force the VM to exit with a status code
-H, --halt=<code> Force the VM to halt with a status code
从上面的可以看出要使用 -S参数来进行关闭
即shutdown.bat -S命令
那么可以在shutdown.bat所在目录再新建一个bat文件----stop.bat,内容如下:
shutdown.bat -S
注意S是大写的
然后双击stop.bat即可关闭jboss