This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Simple .cmd file works under Cygwin but not Window's cmd interpreter.
- From: Andrey Repin <anrdaemon at yandex dot ru>
- To: "Andy Hall" <fixpertise-consulting at comcast dot net>, cygwin at cygwin dot com
- Date: Sun, 6 Mar 2016 00:44:41 +0300
- Subject: Re: Simple .cmd file works under Cygwin but not Window's cmd interpreter.
- Authentication-results: sourceware.org; auth=none
- References: <002c01d176fc$ba3ed090$2ebc71b0$ at comcast dot net>
- Reply-to: cygwin at cygwin dot com
Greetings, Andy Hall!
> This is a puzzle that I have not been able to sort out despite trying all
> sorts of variations. Basically, I maintain a bunch of Crystal Reports based
> on Crystal reports XI R2. Sorry, I have no choice there.
> I have this installed and running on a Widows 10 machine. How I did that is
> another story.
> Recently I was asked what it would take to internationalize these reports.
> Fortunately, CR has a mechanism that allows you to define your own functions
> that can be used in reports which allow you to access properties files
> containing the localized entities just as you would for a
> normal Java app. All well and good.
> So I set about trying to get this to work. The plugin to CR XI R2, is not
> well integrated with the base system and a bit of not so nice manual
> configuration is necessary.
> You have to follow this to the letter, but that is not sufficient.
> Out of the box I could not get it to work. So to debug what was going on I
> wrote a simple bash script to try to get it to work.
> Lo and behold this simple script works:
> #!/bin/bash
> echo " "
> echo "CLASSPATH = $CLASSPATH"
> echo " "
> #JAVA_HOME=C":\Program Files (x86)\Java\jdk1.6.0_45"
> echo "JAVA_HOME = $JAVA_HOME"
> echo " "
> echo "PATH = $PATH"
> cd "/cygdrive/c/Program Files (x86)/Business Objects/Crystal Reports 11.5"
> java -version
> crw32.exe
> Notice that this seem to do nothing but display some key variables and the
> run CR in its installation directory, just as the normal shortcut does.
> It launches CR which finds the plugin and loads it.
> Now I have a need to do the same outside of the Cygwin environment, so I
> wrote a simple equivalent .cmd file:
> @Echo off
> :: Display CLASSPATH
> set CLASSPATH
echo %CLASSPATH%
> :: Set and display JAVA_HOME
> ::set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_45
> set JAVA_HOME
echo %JAVA_HOME%
> :: Add 32-bit JDK to PATH and display
> ::set PATH=%JAVA_HOME%\bin;%PATH%
> set PATH
Just start Java from %ProgramData%\Oracle\Java\javapath\java.exe
In truth, it IS ALREADY in your %PATH%, if you didn't removed it.
> pushd C:\Program Files (x86)\Business Objects\Crystal Reports 11.5
CD /D "C:\Program Files (x86)\Business Objects\Crystal Reports 11.5"
> java.exe -version
> crw32.exe
> popd
> If I run this from a bash command prompt it works as well. It also works
> if I launch cmd from bash and then run the cmd
> file. That makes sense.
> But here is the puzzle, If I simply click on the runCR.cmd file, say from
> the file explorer, CR launches but does not find the plugin.
> The same happens if I launch a Windows cmd window and run the cmd file outside of Cygwin.
Then the environment is different.
"set > file" in both CMD prompts and diff the output.
> So the question is: ?What could possibly be the difference between the
> Cygwin environment and the Windows cmd environment that makes this work in
> one and not the other??
> I have examined the PATH used in the Cygwin environment and set the PATH in
> the Windows environment to be identical. No change.
It may be some other environment variable.
> I thought it might have to do with whether or not a 32-bit or 64-bit JVM is
> configured in the path, but that does not seem to make a difference.
> It fails if the JVM in the path is 32-bit or 64-bit probably because CR
> really gets its JVM from a registry setting.
> I am at a loss, Does anybody have an idea?
> BTW, I would have expected the reverse to be the case: works in Windows but not Cygwin.
If I were you, I'd remove all Java versions and then install only one, and see
if it works or not.
--
With best regards,
Andrey Repin
Sunday, March 6, 2016 00:31:40
Sorry for my terrible english...