This article comes from Baidu Space
The JBOSS server I downloaded cannot be started, and the environment variables have been configured for a long time. I have tried various methods and collected a lot on the Internet. The most practical and simple solution is reproduced as follows:
If JDK is installed without system environment variables, it cannot be started.
However, you can simply Add the following sentence to the run. bat file in the jboss/bin directory.
Set JAVA_HOME = jdk installation directory (for example, D: \ Program Files \ Java \ jdk1.6.0 _ 13)
Here, jdk1.6.0 _ 13 is the jdk I installed. Now I copy it directly to the jboss directory, and set JAVA_HOME in run. bat to OK.
For more information, see
Rem Find run. jar, or we can't continue
Set RUNJAR = % JBOSS_HOME % \ bin \ run. jar
If exist "% RUNJAR %" goto FOUND_RUN_JAR
Echo cocould not locate % RUNJAR %. Please check that you are in
Echo bin directory when running this script.
Goto END
: FOUND_RUN_JAR
Set JAVA_HOME = jdk installation directory (for example, 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
To disable jboss, add the JAVA_HOME configuration in shutdown. bat as shown in the preceding figure.
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 cocould not locate % MAIN_JAR %. Please check that you are in
Echo bin directory when running this script.
Goto END
: FOUND_MAIN_JAR
Set JAVA_HOME = jdk installation directory (for example, 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
Save.
Double-click shutdown. bat,
You will find a description, telling you that you need to use parameters.
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
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
We can see from the above that the-S parameter should be used to close the service.
That is, the shutdown. bat-S command
You can create another bat file ---- stop. bat in the directory where shutdown. bat is located. The content is as follows:
Shutdown. bat-S
Note that S is capitalized.
Double-click stop. bat to disable jboss.