[ nice-Bugs-1102993 ] Error in nicec.bat

"SourceForge.net" <[email protected]> Sun, 16 Jan 2005 11:35:29 -0800
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1102993, was opened at 2005-01-15 18:08
Message generated for change (Comment added) made by bonniot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1102993&group_id=12788

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Daniel Bonniot (bonniot)
Summary: Error in nicec.bat

Initial Comment:
The classpath argument to java requires opening and
closing quotes so that the JVM does not choke on a
classpath containing spaces.

No quotes around classpath yields an exception:

D:\Program Files\Nice>java -classpath
%NICEPATH%\nice.jar;%CLASSPATH% nice.tools.unit
.console.dispatch
Exception in thread "main"
java.lang.NoClassDefFoundError:
Files\Nice\nice/jar;classes;D:\Program

Quotes around classpath results in successful execution:

D:\Program Files\Nice>java -classpath
"%NICEPATH%\nice.jar;%CLASSPATH%" nice.tools.un
it.console.dispatch
Usage: niceunit [OPTIONS] PACKAGE

Type "niceunit --help" to list the options

Configuration:
Nice 1.9.9
JDK 5.0
Windows 2000 SP2
CLASSPATH=classes;D:\Program
Files\Parser\antlr-2.7.2;D:\Program
Files\Parser\antlr-2.7.2\antlr.jar;


----------------------------------------------------------------------

>Comment By: Daniel Bonniot (bonniot)
Date: 2005-01-16 20:35

Message:
Logged In: YES 
user_id=88952

Thanks for your suggestions. I fixed all the batch files in CVS.

----------------------------------------------------------------------

Comment By: Derek Mahar (derekmahar)
Date: 2005-01-15 18:28

Message:
Logged In: YES 
user_id=963180

Upon further investigation, I found that quotes alone in
nicec.bat did not fix the problem.  I had to change both
nicec.bat and niceclasspath.bat, quoting all path-related
environment variable references.

rem niceclasspath.bat
rem -- This is a utility to determine the location of the
nice.jar file
rem -- which is needed by several Nice utilities (nicec,
nicedoc, ...).

rem -- do we have a nice environment variable?
for %%x in (%NICE%) do goto gotNiceEnvVar

rem -- try some standard places

set NICEPATH=c:\nice
if exist "%NICEPATH%\nice.jar" goto end

set NICEPATH=c:\Program Files\nice
if exist "%NICEPATH%\nice.jar" goto end

set NICEPATH=c:\programs\nice
if exist "%NICEPATH%\nice.jar" goto end

set NICEPATH=d:\nice
if exist "%NICEPATH%\nice.jar" goto end

set NICEPATH=d:\Program Files\nice
if exist "%NICEPATH%\nice.jar" goto end

set NICEPATH=d:\programs\nice
if exist "%NICEPATH%\nice.jar" goto end

goto error

:envError
echo Could not find the file: %NICE%\nice.jar
echo The NICE environment variable is not pointing to the
right directory!

:error
echo You must set the NICE environment variable to point to
the directory you've installed nice in e.g.
echo set NICE=C:\programs\nice	echo (note: do not add a ';'
at the end)
echo You can do it by modifying Autoexec.bat or in the
system settings.
set NICEPATH=
goto end

:gotNiceEnvVar
if not exist "%NICE%\nice.jar" goto envError
set NICEPATH=%NICE%

:end

----

rem nicec.bat
@echo off
rem
---------------------------------------------------------------------------
rem nicec.bat - a nice compiler batch file
rem
rem Environment Variariable Prerequisites:
rem
rem     NICE - the root directory where nice is installed
rem
---------------------------------------------------------------------------

call niceclasspath

for %%x in (%NICEPATH%) do goto gotNice

goto end

:gotNice
java -Xms8M -classpath "%CLASSPATH%;%NICEPATH%\nice.jar"
nice.tools.compiler.console.dispatch
--runtime="%NICEPATH%\nice.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9

:end
rem -- clean up a bit
set NICEPATH=
@echo on

----


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1102993&group_id=12788


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt