Issue1330

classification
Title: Spaces in %CLASSPATH% break jython.bat
Type: behaviour Severity: normal
Components: Installer Versions: 2.2.2
Milestone:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: otmarhumbel Nosy List: TimVukman, jaraco, otmarhumbel, took
Priority: normal Keywords:

Created on 2009-04-28.12:44:19 by took, last changed 2010-02-03.08:17:28 by otmarhumbel.

Messages
msg4605 (view) Author: (took) Date: 2009-04-28.12:44:18
Startup script jython.bat brought by Windows installer breaks in case %
CLASSPATH% variable has spaces in it (even if the path components 
containing spaces were surrounded by double quotes).
msg4627 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-05-02.08:55:54
took,

just to be sure: you are not talking about the current beta (2.5b...) 
version?
msg4653 (view) Author: (took) Date: 2009-05-07.14:40:01
Hi,

I'm talking about this one:

C:\apps\jython_2.2>jython.bat --version
Jython 2.2 on java
msg5419 (view) Author: Jason R. Coombs (jaraco) Date: 2010-01-08.23:14:41
This problem still exists with Jython 2.5.1.

To reproduce, install jython, then install Quicktime (or iTunes), then try to launch jython. Output is:

\QuickTime\QTSystem\QTJava.zip was unexpected at this time.

This is apparently due to QuickTime adding its java lib to the global classpath:

CLASSPATH=.;C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip

Who would have thought that buying an iPhone required breaking Jython in Windows?

I'm not sure it's possible to create a batch file that properly handles paths with spaces and quotes in them. I've seen the Apache Tomcat project struggle with this since time=0.

Perhaps a jython.exe bootstrapping executable would do the trick.

Please report back here if there is any proposed solution to this problem. I'm happy to contribute to help get this resolved.
msg5435 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-01-13.18:34:28
TimVukman reported the same under Windows7, using jython 2.5.1
(http://bugs.jython.org/issue1538)
msg5439 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-01-15.23:37:56
Spaces and quotes are not the problem here - the round brackets around x86 in the path come in the way.


The following CLASSPATH works:

CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip

c:\Users\bagside\stuff\jython\jython-2.5.1>if not defined _BOOT_CP (if defined CLASSPATH (set CLASSPATH=c:\Users\bagside\stuff\jython\jython-2.5.1\jython.jar;.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip )  else (set CLASSPATH=c:\Users\bagside\stuff\jython\jython-2.5.1\jython.jar ) )


while a CLASSPATH containing (x86) screws up the batch file:

CLASSPATH=.;C\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip

c:\Users\bagside\stuff\jython\jython-2.5.1>if not defined _ARGS goto argsDone
\Java\jre6\lib\ext\QTJava.zip was unexpected at this time.

c:\Users\bagside\stuff\jython\jython-2.5.1>    set CLASSPATH=c:\Users\bagside\stuff\jython\jython2.5.1\jython.jar;.;C\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
msg5440 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-01-15.23:56:34
A possible solution could be to replace

:argsDone
if not defined _BOOT_CP (
  if defined CLASSPATH (
    set CLASSPATH=%_CP:"=%;%CLASSPATH:"=%
  ) else (
    set CLASSPATH=%_CP:"=%
  )
)

with

:argsDone
rem do not use 'if () else ()' because this does not work with CLASSPATH containing (x86)
if defined _BOOT_CP goto fullCmd
if defined CLASSPATH goto classpathDefined
set CLASSPATH=%_CP:"=%
goto fullCmd
:classpathDefined
set CLASSPATH=%_CP:"=%;%CLASSPATH:"=%
:fullCmd
msg5441 (view) Author: Jason R. Coombs (jaraco) Date: 2010-01-17.15:54:34
Good point. I assumed it was the spaces issue, as that's usually the offending character, and since there was an open bug, it seemed appropriate. Thanks Oti for catching that.
msg5464 (view) Author: Jason R. Coombs (jaraco) Date: 2010-01-28.19:47:31
I've created issue1548 to capture the parenthesis issue separately.
msg5488 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-02-03.08:15:13
Coming back to the original message (http://bugs.jython.org/msg4605):

Downloaded jython 2.2.1 from jython.org,
installed it,
tested id with a CLASSPATH containing a blank space,
and it worked - see output below:


C:\Users\bagside\stuff\jython\jython-2.2.1>jython.bat
*sys-package-mgr*: processing new jar, 'C:\Users\bagside\stuff\jython\jython-2.2.1\jython.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\jre6\lib\ext\QTJava.zip'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\rt.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\sunrsasign.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\jsse.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\jce.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\charsets.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\ext\dnsns.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\ext\ldapsec.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\ext\localedata.jar'
*sys-package-mgr*: processing new jar, 'C:\Program Files\Java\j2sdk1.4.2_17\jre\lib\ext\sunjce_provider.jar'
Jython 2.2.1 on java1.4.2_17
Type "copyright", "credits" or "license" for more information.
>>> import sys;sys.exit()

C:\Users\bagside\stuff\jython\jython-2.2.1>set CLASSPATH
CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip

C:\Users\bagside\stuff\jython\jython-2.2.1>
msg5489 (view) Author: Oti Humbel (otmarhumbel) Date: 2010-02-03.08:17:28
Jython 2.2.1 works for me (see http://bugs.jython.org/msg5488)
Jython 2.5.x is handled by issue1548
History
Date User Action Args
2010-02-03 08:17:28otmarhumbelsetstatus: open -> closed
resolution: works for me
messages: + msg5489
2010-02-03 08:15:14otmarhumbelsetmessages: + msg5488
2010-01-28 19:47:31jaracosetmessages: + msg5464
versions: - 2.5b0, 2.5.1, 2.5b1
2010-01-17 15:54:35jaracosetmessages: + msg5441
2010-01-15 23:56:34otmarhumbelsetmessages: + msg5440
2010-01-15 23:37:58otmarhumbelsetmessages: + msg5439
2010-01-13 18:34:28otmarhumbelsetnosy: + TimVukman
messages: + msg5435
2010-01-08 23:14:42jaracosetnosy: + jaraco
messages: + msg5419
versions: + 2.5b0, 2.5.1, 2.5b1
2009-05-10 20:12:50zyasoftsetpriority: normal
2009-05-07 14:40:02tooksetmessages: + msg4653
2009-05-02 08:55:54otmarhumbelsetassignee: otmarhumbel
messages: + msg4627
nosy: + otmarhumbel
2009-04-28 12:44:19tookcreate