Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#147 closed enhancement (invalid)

classpath limits

Reported by: wlhartzell Owned by:
Priority: minor Milestone: Enhanced
Component: general Version: 1.6.0-b22 GA
Severity: medium Keywords:
Cc:

Description

I have two Java programs that won't work because the classpath statements are too long. I think that this is a command.exe bug, but it affects Java. The programs are Freemind 0.9.0 found at <http://freemind.sourceforge.net/> and Squirrel 3.2.1 found at <http://www.squirrelsql.org>. The only direct solution would be to use ./././., etc. in classpath to add all files in subdirectory of program directory, and subdirectories of the subdirectory, etc., or require us to switch to bash to run these programs. Adding levels of indirection would be an Odin feature. The following is the freemind cmd file:
setlocal
d:
cd \OA\freemind
set classpath=D:\OA\freemind\lib\freemind.jar;D:\OA\freemind\lib\forms-1.0.5.jar;D:\OA\freemind\lib\bindings.jar;D:\OA\freemind\lib\jibx\xpp3.jar;D:\OA\freemind\lib\jibx\jibx-run.jar;D:\OA\freemind\lib\SimplyHTML\SimplyHTML.jar;D:\OA\freemind\lib\SimplyHTML\gnu-regexp-1.1.4.jar;D:\OA\freemind\browser\freemindbrowser.jar;D:\OA\freemind\plugins\help\help_plugin.jar;D:\OA\freemind\plugins\help\jhall.jar;D:\OA\freemind\plugins\script\scripting_plugin.jar;D:\OA\freemind\plugins\script\groovy-all-1.5.6.jar;
set SVG=D:\OA\freemind\plugins\svg\batik-awt-util.jar;D:\OA\freemind\plugins\svg\batik-bridge.jar;D:\OA\freemind\plugins\svg\batik-css.jar;D:\OA\freemind\plugins\svg\batik-dom.jar;D:\OA\freemind\plugins\svg\batik-ext.jar;D:\OA\freemind\plugins\svg\batik-extension.jar;D:\OA\freemind\plugins\svg\batik-gui-util.jar;D:\OA\freemind\plugin
set SVG2=D:\OA\freemind\plugins\svg\batik-squiggle.jar;D:\OA\freemind\plugins\svg\batik-svg-dom.jar;D:\OA\freemind\plugins\svg\batik-svggen.jar;D:\OA\freemind\plugins\svg\batik-swing.jar;D:\OA\freemind\plugins\svg\batik-transcoder.jar;D:\OA\freemind\plugins\svg\batik-util.jar;D:\OA\freemind\plugins\svg\batik-xml.jar;
set SVG3=D:\OA\freemind\plugins\svg\batik-gvt.jar;D:\OA\freemind\plugins\svg\batik-parser.jar;D:\OA\freemind\plugins\svg\batik-script.jar;D:\OA\freemind\plugins\svg\js.jar;D:\OA\freemind\plugins\svg\pdf-transcoder.jar;D:\OA\freemind\plugins\svg\svg_plugin.jar;D:\OA\freemind\plugins\svg\xerces_2_5_0.jar;D:\OA\freemind\plugins\svg\xml-apis.jar;
set Java_Home=j:\java6\jre
j:\java6\jre\bin\java -Xms512M -Xmx512M -cp %SVG%;%SVG2%;%SVG3% freemind.main.FreeMindStarter?
endlocal

Change History (4)

comment:1 Changed 8 years ago by dmik

  • Resolution set to invalid
  • Status changed from new to closed

This is a bug of CMD.EXE indeed (approx. 1024 bytes per the command line).

AFAIR, you may overcome this by doing something like:

set CLASSPATH=part1
set CLASSPATH=%CLASSPATH%;part2
set CLASSPATH=%CLASSPATH%;part3
...

The maximum length of the environment variable's value is ~64KB IIRC.

Or you can use SH.EXE instead of CMD.EXE.

Anyway, has nothing to do with Java.

comment:2 Changed 8 years ago by wlhartzell

IS that not what I did when I used -cp the three variables? Tried that:
set classpath=%classpath%%svg%
set classpath=%classpath%%svg2%
set classpath=%classpath%%svg3%
set Java_Home=j:\java6\jre
j:\java6\jre\bin\java -Xms512M -Xmx512M freemind.main.FreeMindStarter?
endlocal
Still get input line too long error. The extra semicolons are not needed. And I corrected the missing semicolon on one line end. sys1065 is the error. You are right on the line limit, but not right on the solution. Using Bash should not be required. Need to fix the finding of jar files.

comment:3 Changed 8 years ago by dmik

Yes, right, the solution doesn't work since the variables are expanded before passing them for execution. I mixed it with REXX. So you will have to use REXX to overcome this using the above technique:

/* REXX */
cp = 'part1'
cp = cp||'part2'
cp = cp||'part3'
call value 'CLASSPATH', cp, 'OS2ENVIRONMENT'
'java blabla'

Note that the string constant in REXX is no longer than 256 characters, so you will have to split it more often. Also note that I use Object REXX, I can't check the classic REXX to make 100% sure it will work there (but I guess it will).

This is all we can do.

comment:4 Changed 8 years ago by wlhartzell

I heard back from the openJDK crew and they say that the Jigsaw sub project is working upon this classpath problem. Maybe you should monitor that list to see that OS/2 needs are included. BTW, that is for OpenJDK 8. <http://openjdk.java.net/projects/jigsaw/> I'll try the ORexx suggestion in the mean time.

Note: See TracTickets for help on using tickets.