Bug 40583 - Under Cygwin, fop bash script CLASSPATH problem
Summary: Under Cygwin, fop bash script CLASSPATH problem
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.92
Hardware: PC other
: P2 major
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-22 16:16 UTC by timo
Modified: 2012-04-01 06:53 UTC (History)
1 user (show)



Attachments
alternative fop script (7.41 KB, text/plain)
2006-10-04 13:18 UTC, Simon Pepping
Details
alternative fop script (7.52 KB, text/plain)
2006-10-06 10:55 UTC, Simon Pepping
Details
another alternative fop script (7.23 KB, text/plain)
2006-10-12 11:34 UTC, Simon Pepping
Details

Note You need to log in before you can comment on or make changes to this bug.
Description timo 2006-09-22 16:16:52 UTC
The LOCALCLASSPATH variable in the script is set to longer than 256 characters,
making any reasonable cygwin basic install fail with:

cygpath: error converting
"/cygdrive/c/win2k/fop/lib/xmlgraphics-commons-1.0.jar:/cygdrive/c/win2k/fop/lib/xml-apis-1.3.02.jar:/cygdrive/c/win2k/fop/lib/xercesImpl-2.7.1.jar:/cygdrive/c/win2k/fop/lib/xalan-2.7.0.jar:/cygdrive/c/win2k/fop/lib/serializer-2.7.0.jar:/cygdrive/c/win2k/fop/lib/commons-logging-1.0.4.jar:/cygdrive/c/win2k/fop/lib/commons-io-1.1.jar:/cygdrive/c/win2k/fop/lib/batik-all-1.6.jar:/cygdrive/c/win2k/fop/lib/avalon-framework-4.2.0.jar:/cygdrive/c/win2k/fop/build/fop.jar:/cygdrive/c/win2k/fop/build/fop-sandbox.jar:/cygdrive/c/win2k/fop/build/fop-hyph.jar:"
- File name too long
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/cli/Main

I have ant installed in the same directory, and it does not fail like this. The
reason for this is that it has the ANT_LIB and ANT_HOME directories passed to it
as properties, and (i guess) deals with the classpath issues internally.
Comment 1 Simon Pepping 2006-10-04 13:18:38 UTC
Created attachment 18964 [details]
alternative fop script

Does this script solve the problem?
Comment 2 Simon Pepping 2006-10-04 13:20:25 UTC
I do not run Cygwin here, so I cannot test this problem. Is it really true that
cygpath has such a small upper limit to the path length? If so, can you test
whether the attached script solves the problem?

Simon
Comment 3 J.Pietschmann 2006-10-04 14:33:29 UTC
I can confirm the problem using cygpath on the long path value in the report
above. However, I'm running fop.sh from a cygwin bash for years and didn't have
a problem. I suspect it might be due to the /cygdrive/ prefix.
Comment 4 Simon Pepping 2006-10-05 06:05:33 UTC
(In reply to comment #3)
> I can confirm the problem using cygpath on the long path value in the report
> above. However, I'm running fop.sh from a cygwin bash for years and didn't have
> a problem. I suspect it might be due to the /cygdrive/ prefix.

It will always hurt a person who installs fop under a long path name. Therefore
we better try to prevent it. Can you test that the modified script at least does
not make things worse, and hopefully resolves the problem?
Comment 5 timo 2006-10-05 06:12:25 UTC
Almost, but not quite ;)

It now reports:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/cli/Main

i guess the classpath is still a bit messed.
Comment 6 Simon Pepping 2006-10-05 10:21:15 UTC
(In reply to comment #5)
> It now reports:
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/cli/Main
> 
> i guess the classpath is still a bit messed.

Can you let me know the resulting class path? Is FOP_HOME set? Does
$FOP_HOME/build/fop.jar exist?
Comment 7 timo 2006-10-06 04:40:46 UTC
LocalClasspath =
c:/win2k/fop/lib/xmlgraphics-commons-1.0.jar:c:/win2k/fop/lib/xml-apis-1.3.02.jar:c:/win2k/fop/lib/xercesImpl-2.7.1.jar:c:/win2k/fop/lib/xalan-2.7.0.jar:c:/win2k/fop/lib/serializer-2.7.0.jar:c:/win2k/fop/lib/commons-logging-1.0.4.jar:c:/win2k/fop/lib/commons-io-1.1.jar:c:/win2k/fop/lib/batik-all-1.6.jar:c:/win2k/fop/lib/avalon-framework-4.2.0.jar:c:/win2k/fop/build/fop.jar;c;C:/cygwin/win2k/fop/build/fop-sandbox.jar;c;C:/cygwin/win2k/fop/build/fop-hyph.jar:

Classpath =

fop_home = c:/win2k/fop

fop_exec_command = exec "/cygdrive/c/win2k/Java/jdk1.5.0_04/bin/java" -classpath
"c:/win2k/fop/lib/xmlgraphics-commons-1.0.jar:c:/win2k/fop/lib/xml-apis-1.3.02.jar:c:/win2k/fop/lib/xercesImpl-2.7.1.jar:c:/win2k/fop/lib/xalan-2.7.0.jar:c:/win2k/fop/lib/serializer-2.7.0.jar:c:/win2k/fop/lib/commons-logging-1.0.4.jar:c:/win2k/fop/lib/commons-io-1.1.jar:c:/win2k/fop/lib/batik-all-1.6.jar:c:/win2k/fop/lib/avalon-framework-4.2.0.jar:c:/win2k/fop/build/fop.jar;c;C:/cygwin/win2k/fop/build/fop-sandbox.jar;c;C:/cygwin/win2k/fop/build/fop-hyph.jar:"
org.apache.fop.cli.Main

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fop/cli/Main


My guess is that it is not recognising the path separation as windoes, i.e. c:/
should be c:\
Comment 8 Jan Cumps 2006-10-06 07:07:37 UTC
I think your last trial failed because you used : as path separator.

Even though you are in cygwin, the java.exe is the windows version. It 
expects ; as path separator.

To make CLASSPATH work on my cygwin installation, I have to use this style:
$ export CLASSPATH="c:/library_home/bopiler.jar;c:/library_home/junit/junit4/ju
nit-4.1.jar"

Either with forward or backward slashes.

Using it without quotes fails;
using : in stead of ; fails
using /cygdrive/c/... fails.

But, 
Cygwin has a tool called cygpath, that translates your UNIX-style classpath to 
windows path. See link:
<http://www.ics.uci.edu/~ics185/projects/project0/faq1.html>

Regards, Jan
Comment 9 Simon Pepping 2006-10-06 10:55:37 UTC
Created attachment 18974 [details]
alternative fop script

One more try, with ';' as the path separator. If this does not work, I will
defer to a seasoned Cygwin user.
Comment 10 timo 2006-10-07 06:40:15 UTC
Nope, not quite. Change 
PATH_SEPARATOR=;
to
PATH_SEPARATOR=";"

and it works.
Comment 11 Simon Pepping 2006-10-12 11:34:46 UTC
Created attachment 18995 [details]
another alternative fop script

This script was provided by Mark C. Allman. I builds the Unix path, but with
semicolons instead of colons. Then it applies cygpath as before. This will
cause cygpath to convert the path in pieces, and avoid length problems. This is
a simpler solution than mine. Please, test.
Comment 12 timo 2006-10-12 13:29:50 UTC
FWIW it was the technique i attempted when i first tried to hack it.

both work fine.
Fop - last script:
local class path:
c:/win2k/fop/lib/xmlgraphics-commons-1.0.jar;c:/win2k/fop/lib/xml-apis-1.3.02.jar;c:/win2k/fop/lib/xercesImpl-2.7.1.jar;c:/win2k/fop/lib/xlan-2.7.0.jar;c:/win2k/fop/lib/serializer-2.7.0.jar;c:/win2k/fop/lib/commons-logging-1.0.4.jar;c:/win2k/fop/lib/commons-io-1.1.jar;c:/win2k/fop/lib/batik-all-1.6.jar;c:/win2k/fop/lib/avalon-framework-4.2.0.jar;c:/win2k/fop/build/fop.jar;c;C:/cygwin/win2k/fop/build/fop-sandbox.jar;c;C:/cygwin/win2k/fop/build/fop-hyph.jar;

Fopish - new script:
local class path:
c:/win2k/fop/lib/xmlgraphics-commons-1.0.jar;c:/win2k/fop/lib/xml-apis-1.3.02.jar;c:/win2k/fop/lib/xercesImpl-2.7.1.jar;c:/win2k/fop/lib/xalan-2.7.0.jar;c:/win2k/fop/lib/serializer-2.7.0.jar;c:/win2k/fop/lib/commons-logging-1.0.4.jar;c:/win2k/fop/lib/commons-io-1.1.jar;c:/win2k/fop/lib/batik-all-1.6.jar;c:/win2k/fop/lib/avalon-framework-4.2.0.jar;c:/win2k/fop/build/fop.jar;c:/win2k/fop/build/fop-sandbox.jar;c:/win2k/fop/build/fop-hyph.jar

as you can see, the new one adds the last two jars correctly.

Done IMHO, but will leave for someone else to close.
 
Comment 13 Simon Pepping 2006-10-13 00:07:57 UTC
Patch by Mark C. Allman applied in revision 463578.
Comment 14 Glenn Adams 2012-04-01 06:53:18 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed