This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Here's why bad command appears... (WIN98) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Here Watch "Here New topic

Here's why bad command appears... (WIN98)

Noel Castillo

Joined: Jan 03, 2001
Posts: 12
when you run J2EE.BAT in win98 even if you have set the correct pathnames (path=%PATH%;d:\j2sdkee1.3\bin) and variable names JAVA_HOME and J2EE_HOME.
J2EE.BAT calls SETENV.BAT w/c causes a syntax error at the set JAAS_OPTIONS=.. line because DOS does not accept 2 '=' signs for the SET command (try SET VAR=VAR1=VAR2 in DOS and you'll see what I mean). On the last statement, set JAVACMD=, nothing is assigned to JAVACMD, so after the call to SETENV.BAT - returning to J2EE.BAT, the %JAVACMD% command cannot be recognized because there's no value set for it. Now, we realize why Win95/98 is not a supported platform for J2EE.
So the best thing is to comment out all the lines with the double '=', eg. set %JAAS_OPTIONS%, and the set JAVACMD= line as well. But first, backup the files you are trying to change because you might make some mistakes and may need to go back to the original file to start all over again.
In the J2EE.BAT, comment out the %JAVACMD% line and substitute the commented out variables in SETENV.BAT, eg. %JAVACMD%, %SSL_OPTIONS%, etc. with the hardcoded values. This is how my %JAVACMD% %LISTEN_OPTIONS -Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter ... line finally looks like:
%JAVA_HOME%\bin\java -Xmx128m\lib\security\cacerts.jks\lib\security\jaas.policy
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2

Take note of the spacings because some of them could actually be line feeds. If this happens you will see a break in the command chain, and you will get bad command again. Also, hard tabs can wreak havoc to your syntax in .bat and .config files. I was using an editor that did not display the tab characters and I only discovered them when I opened the file in Notepad.
One last note, the variable %JAVACMD% might be referenced by other .BAT files in the \bin direcotry so you should check to make sure it is substituted properly.
Now, you are ready to face the next set of problems of running J2EE!
[This message has been edited by Noel Castillo (edited June 05, 2001).]
Noel Castillo

Joined: Jan 03, 2001
Posts: 12

SET CLASSPATH=D:\jdk1.3\jre\lib\rt.jar;D:\j2sdkee1.3\lib\j2ee.jar;
SET J2EE_HOME=D:\j2sdkee1.3

My SETENV.BAT (renamed to SETENV0.BAT):

@echo off
rem Set JAVA_HOME and J2EE_HOME before running this script.
rem first include user-specified definitions.
call %J2EE_HOME%\bin\userconfig.bat
if "%JMS_HOME%" == "" set JMS_HOME=%J2EE_HOME%
set LIBDIR=%J2EE_HOME%\lib
set LOCALEDIR=%J2EE_HOME%\lib\locale
set J2EEJARS=%LIBDIR%\j2ee.jar
set JAVART=%JAVA_HOME%\jre\lib\rt.jar
set JAVATOOLS=%JAVA_HOME%\lib\tools.jar
rem JMS DB PATH must end in slash to specify a directory
set JMS_DB_PATH=%J2EE_HOME%\repository\%COMPUTERNAME%\db\
set JMS_RI_JDBC=%SYSTEM_LIB_DIR%\cloudscape.jar;%SYSTEM_LIB_DIR%\tools.jar

rem set\lib\security\jaas.policy
rem set\lib\security\cacerts.jks
rem set SOCKET_FACTORY=-Dcom.sun.CORBA.connection.ORBSocketFactoryClass=com.sun.enterprise.iiop.IIOPSSLSocketFactory
rem set LISTEN_OPTIONS=-Dcom.sun.CORBA.connection.ORBListenSocket=SSL:0,SSL_MUTUALAUTH:0,PERSISTENT_SSL:1060
rem set JAVACMD=%JAVA_HOME%\bin\java -Xmx128m %SSL_OPTIONS% %JAAS_OPTIONS%

My J2EE.BAT (renamed to J2EE0.BAT):

@echo off
rem Set JAVA_HOME and J2EE_HOME before running this script.
rem set JAVA_HOME to the path where you have Java 2 (JDK1.2) installed.
rem set J2EE_HOME to the path where you have installed this package (EJB server).
if not "%J2EE_HOME%" == "" goto CONT0
echo ERROR: Set J2EE_HOME before running this script.
goto END
if EXIST "%J2EE_HOME%\bin\setenv0.bat" goto CONT1
echo ERROR: Set J2EE_HOME to the path of a valid j2sdkee.
goto END
call %J2EE_HOME%\bin\setenv0.bat
if not "%JAVA_HOME%" == "" goto CONT2
echo ERROR: Set JAVA_HOME before running this script.
goto END
if EXIST "%JAVA_HOME%\bin\java.exe" goto CONT3
echo ERROR: Set JAVA_HOME to the path of a valid jdk.
goto END

rem @echo on
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2
@echo on
java -Xmx128m
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2


D:\j2sdkee1.3\bin>j2ee0 -verbose
D:\j2sdkee1.3\bin>java -Xmx128m -Dorg.xml.sax.parser=org.xml.sax.helpers.XMLRead
erAdapter -Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl -Djms.hom
e=D:\j2sdkee1.3 -Dcom.sun.jms.service.jdbc.dbpath=D:\j2sdkee1.3\repository\\db\\j2sdkee1.3\config\
D:\j2sdkee1.3\lib\security\login.config -Dcom.sun.enterprise.home=D:\j2sdkee1.3
-classpath "D:\j2sdkee1.3\lib\system\cloudscape.jar;D:\j2sdkee1.3\lib\system\too
:\j2sdkee1.3\lib\jhall.jar" com.sun.enterprise.server.J2EEServer -verbose
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource =
Starting JMS service ... Initialization complete - waiting for client requests
Binding : < JMS Destination : jms/Topic , javax.jms.Topic >
Binding : < JMS Destination : jms/Queue , javax.jms.Queue >
Binding : < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Binding : < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Binding : < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties<br /> >
Binding : < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties<br /> >
Starting web service at port:8000
Starting secure web service at port:7000
Apache Tomcat/4.0-b1
Starting web service at port:9191
Apache Tomcat/4.0-b1
J2EE server startup complete.


  1. My RAM(64KB) or DOS cannot handle a very long command line so I had to take out the %LISTEN_OPTIONS% values. I don't know what the later effects of that would be.
  2. Pay attention to the variable assignments, I had problems with these while playing around with the SET= settings. Type SET in the DOS prompt to display the variables' values (but you already know that).
  3. Check the echoed JAVA command line to make sure all the expected values are displayed up to "-verbose". If the values are incomplete J2EE will not run.
  4. You may have realized by now the futility of starting J2EE in WIN98 so it might be wise to get ORION SERVER if you are like me who don't want to switch to WIN2000 yet.
  5. I have not deployed any application yet - I've tried the JAVA PET STORE on ORION but got stuck somewhere, posted for help on this site and got 0 reply. Oh now I remember why I switched to J2EE server. If you got something pls. reply to that post.

  6. ~Noel

    [This message has been edited by Noel Castillo (edited June 05, 2001).]
I agree. Here's the link:
subject: Here's why bad command appears... (WIN98)