From the error I guess that, you are running JBoss AS at Windows OS and you are not running run.bat at the right location.
From which path you are executing the run.bat file?
Which version of JBoss AS you are using?
If you have installed JBoss AS in the location C:\jboss-4.0.4.GA then you should go into that location from the command prompt.
Let assume the location as JBOSS_HOME=C:\jboss-4.0.4.GA
at command prompt,
Go into the <JBOSS_HOME>/bin directory,
And run the file run.bat.
For more details, see the following link.
The 4.0.5 run.bat script has this new piece to check if the JVM supports the -server flag, in order to add it.
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)
'findstr' must be on the PATH. It's under windows\system32 on my winxp box.