This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Error in starting Jboss through Command Prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Error in starting Jboss through Command Prompt" Watch "Error in starting Jboss through Command Prompt" New topic
Author

Error in starting Jboss through Command Prompt

Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Dear Friends,
I tried to run JBoss through command prompt but got the following error:
C:\jboss-4.0.5.GA\bin>run
'findstr' is not recognized as an internal or external command,
operable program or batch file.


The JAVA_HOME environment variable is correctly set.

My run.bat file is provided below, but I don't know how to interpret this file. However, 'findstr' is present in the following file:

@echo off
rem -------------------------------------------------------------------------
rem JBoss Bootstrap Script for Win32
rem -------------------------------------------------------------------------

rem $Id: run.bat 56327 2006-08-28 10:34:13Z dimitris@jboss.org $

@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal

set DIRNAME=.\
if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
set PROGNAME=run.bat
if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%

rem Read all command line arguments

REM
REM The %ARGS% env variable commented out in favor of using %* to include
REM all args in java command line. See bug #840239. [jpl]
REM
REM set ARGS=
REM :loop
REM if [%1] == [] goto endloop
REM set ARGS=%ARGS% %1
REM shift
REM goto loop
REM :endloop

rem Find run.jar, or we can't continue

set RUNJAR=%DIRNAME%\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

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

if exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
echo Could not locate %JAVA_HOME%\lib\tools.jar. Unexpected results may occur.
echo Make sure that JAVA_HOME points to a JDK and not a JRE.

:SKIP_TOOLS

rem Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
rem compatible distribution to which JAVA_HOME points

set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar

rem If JBOSS_CLASSPATH is empty, don't include it, as this will
rem result in including the local directory, which makes error tracking
rem harder.
if "%JBOSS_CLASSPATH%" == "" (
set JBOSS_CLASSPATH=%JAVAC_JAR%;%RUNJAR%
) else (
set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%
)

rem Setup JBoss specific properties
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
set JBOSS_HOME=%DIRNAME%\..

rem Add -server to the JVM options, if supported
"%JAVA%" -version 2>&1 | findstr /I hotspot > nul
if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)

rem JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

rem With Sun JVMs reduce the RMI GCs to once per hour
set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%

rem Setup the java endorsed dirs
set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed

echo ===============================================================================
echo.
echo JBoss Bootstrap Environment
echo.
echo JBOSS_HOME: %JBOSS_HOME%
echo.
echo JAVA: %JAVA%
echo.
echo JAVA_OPTS: %JAVA_OPTS%
echo.
echo CLASSPATH: %JBOSS_CLASSPATH%
echo.
echo ===============================================================================
echo.

:RESTART
"%JAVA%" %JAVA_OPTS% "-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%" -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %*
if ERRORLEVEL 10 goto RESTART

:END
if "%NOPAUSE%" == "" pause

:END_NO_PAUSE


Kindly Help
Nitin
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9912
    
158

Have a look at FindstrCommandNotFound


[My Blog] [JavaRanch Journal]
Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Thanks Jai !! findstr was missing on PATH. Issue has been resolved.
Thanks again!!
anil kumar khichar
Greenhorn

Joined: Dec 23, 2010
Posts: 8
to resolve this follow the simplest steps:-
step I: got to "C:\Windows\system32\" and copy "findstr" file.
stepII: now paste this file into the location "C:\Program Files\Java\jdk1.6.0_24\bin" .
StepIII: now run your jboss again you will get out of this.....

Thanks!
anil kumar khichar
software engg.
India (Jai Hind)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9912
    
158

Anil, welcome to JavaRanch!

anil kumar khichar wrote:to resolve this follow the simplest steps:-
step I: got to "C:\Windows\system32\" and copy "findstr" file.
stepII: now paste this file into the location "C:\Program Files\Java\jdk1.6.0_24\bin" .


That's actually not recommended. The correct way is to set the PATH environment variable to include the folder (in this case C:/Windows/system32) which contains the findstr command.
anil kumar khichar
Greenhorn

Joined: Dec 23, 2010
Posts: 8
Jaikiran Pai wrote:Anil, welcome to JavaRanch!

anil kumar khichar wrote:to resolve this follow the simplest steps:-
step I: got to "C:\Windows\system32\" and copy "findstr" file.
stepII: now paste this file into the location "C:\Program Files\Java\jdk1.6.0_24\bin" .


That's actually not recommended. The correct way is to set the PATH environment variable to include the folder (in this case C:/Windows/system32) which contains the findstr command.



Yes, the best way is to set path. The easiest method is

go to Run-->cmd -->
now type set path=C:\Windows\System32 and press enter.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

now type set path=C:\Windows\System32 and press enter.

I would not do that either. By doing so you are removing all of the other things that will need to be in the PATH. You are better off adding the System32 directory to the PATH in the System Variables section of the Environment Variables dialog box (accessible from Computer | Properties | Advanced)


JBoss In Action
mritesh kumar
Greenhorn

Joined: Sep 20, 2012
Posts: 1
anil kumar khichar wrote:to resolve this follow the simplest steps:-
step I: got to "C:\Windows\system32\" and copy "findstr" file.
stepII: now paste this file into the location "C:\Program Files\Java\jdk1.6.0_24\bin" .
StepIII: now run your jboss again you will get out of this.....

Thanks!
anil kumar khichar
software engg.
India (Jai Hind)



Hi Anil....

I am glad that by following the above step I have solved the issue I was facing...and really thanks a lot for that.
But one think i want to know is why, my installation is not having the "findstr" file 'Or' what is the actual use of findstr file.

Thanks
Ritesh
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5811
    
    7

I don't know why findstr doesn't always show up, on my PC it's in system32. Here is some info on it:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/findstr.mspx?mfr=true
Siitesh Hind
Ranch Hand

Joined: Sep 06, 2012
Posts: 51
Not sure why this setting is there by default on all desktops that I have come across. None of the users had ever set that setting.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in starting Jboss through Command Prompt
 
Similar Threads
java.lang.Unsatisfiedlinkerror
The console/command window disappears (jboss via run.bat)
JBoss run.bat not launching not showing any errors just going to next line in the command prompt
Starting JBoss
jboss on windows 98