本文來源於百度空間
我下載的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