Issue in Java path

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue in Java path

Rakhi Batra - Assistant Manager Publication
Hello,
I am facing an issue in the path of the file. Whenever I am executing the
below command. The slashes in classpath are replaced with dots and I am
unable to navigate to files in order to run the scripts. Kindly guide why
this is happening and what is the solution. Thank you.

(java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`
org.dspace.app.launcher.ScriptLauncher "$@")

--
Regards,

Rakhi

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

RE: [cygwin] Issue in Java path

Jason Pyeron
> -----Original Message-----
> From: Rakhi Batra - Assistant Manager Publication
> Sent: Tuesday, September 24, 2019 3:38 AM
>
> Hello,
> I am facing an issue in the path of the file. Whenever I am executing the
> below command. The slashes in classpath are replaced with dots and I am

By dots, do you mean ":" ? Can you please provide a concrete example of the input and output?

> unable to navigate to files in order to run the scripts. Kindly guide why this is
> happening and what is the solution. Thank you.
>
> (java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`

This is a bad idea for at least 2 reasons.

1. the CLASSPATH variable has special meaning and the java executable will act on it if it exists - use $CP or anything else
2. you should "$(...)" not `...`

> org.dspace.app.launcher.ScriptLauncher "$@")
>
> --
> Regards,
>
> Rakhi
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Issue in Java path

Eliot Moss
In reply to this post by Rakhi Batra - Assistant Manager Publication
On 9/24/2019 3:38 AM, Rakhi Batra - Assistant Manager Publication wrote:
> Hello,
> I am facing an issue in the path of the file. Whenever I am executing the
> below command. The slashes in classpath are replaced with dots and I am
> unable to navigate to files in order to run the scripts. Kindly guide why
> this is happening and what is the solution. Thank you.
>
> (java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`
> org.dspace.app.launcher.ScriptLauncher "$@")

Seeing as you did not supply specifics it's a little hard to know exactly
what's going on, but it is conceivable that you need to put $CLASSPATH
inside double quotes, i.e., if it has the Windows ; separator in it.  Also,
I discovered that if Windows drives are mentioned, such as C:, the next
character needs to be \, that is: C:\..., not (e.g.) C:a\b.

But turning \ or / into . would not have been done by cygpath.  That
would be done by Java.

But lastly I note that I am not aware of any version of Java built for
cygwin.  Java is a Windows program, so you'd be wanting something more
like:

java $JAVA_OPTS -classpath "$(cygpath -pw "$CLASSPATH")" ...

$(...) is the more modern version of ` `, which is now deprecated.
The " " around $( ) is to prevent the ; in the path from ending the
java command line as it is being processed by bash.

For a path that starts with drive letter C (say), start the path with
/cygdrive/c.

Regards - EM

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Issue in Java path

Andrey Repin
In reply to this post by Rakhi Batra - Assistant Manager Publication
Greetings, Rakhi Batra - Assistant Manager Publication!

> I am facing an issue in the path of the file. Whenever I am executing the
> below command. The slashes in classpath are replaced with dots and I am
> unable to navigate to files in order to run the scripts. Kindly guide why
> this is happening and what is the solution. Thank you.

> (java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`
> org.dspace.app.launcher.ScriptLauncher "$@")

There's multiple issues beyond what has already been mentioned.
3. Missing quotation of an unknown variable.
4. There's no Cygwin Java, and using Cygwin paths with native Java is sure to
cause interoperability issues.


--
With best regards,
Andrey Repin
Tuesday, September 24, 2019 15:48:28

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Issue in Java path

Brian Inglis
In reply to this post by Rakhi Batra - Assistant Manager Publication
On 2019-09-24 01:38, Rakhi Batra - Assistant Manager Publication wrote:
> I am facing an issue in the path of the file. Whenever I am executing the
> below command. The slashes in classpath are replaced with dots and I am
> unable to navigate to files in order to run the scripts. Kindly guide why
> this is happening and what is the solution. Thank you.
>
> (java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`
> org.dspace.app.launcher.ScriptLauncher "$@")

There is no Cygwin Java, so please just define a Windows env var using Windows
paths and separators, do not explicitly specify it in the command line, and run
from a .cmd or .bat to avoid issues and bad assumptions:

set CLASSPATH=C:\Java\classes\lib.jar;C:\Java\classes\util.jar
java %JAVA_OPTS% org.dspace.app.launcher.ScriptLauncher %1 %2 %3 %4 %5 %6 %7 %8 %9

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Issue in Java path

Rakhi Batra - Assistant Manager Publication
Thank you so much for the response.  It is working fine now. I just
replaced  `...` with this  "$(...)"


On Wed, Sep 25, 2019 at 4:05 AM Brian Inglis <
[hidden email]> wrote:

> On 2019-09-24 01:38, Rakhi Batra - Assistant Manager Publication wrote:
> > I am facing an issue in the path of the file. Whenever I am executing the
> > below command. The slashes in classpath are replaced with dots and I am
> > unable to navigate to files in order to run the scripts. Kindly guide why
> > this is happening and what is the solution. Thank you.
> >
> > (java $JAVA_OPTS -classpath `cygpath -pu $CLASSPATH`
> > org.dspace.app.launcher.ScriptLauncher "$@")
>
> There is no Cygwin Java, so please just define a Windows env var using
> Windows
> paths and separators, do not explicitly specify it in the command line,
> and run
> from a .cmd or .bat to avoid issues and bad assumptions:
>
> set CLASSPATH=C:\Java\classes\lib.jar;C:\Java\classes\util.jar
> java %JAVA_OPTS% org.dspace.app.launcher.ScriptLauncher %1 %2 %3 %4 %5 %6
> %7 %8 %9
>
> --
> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
>
> This email may be disturbing to some readers as it contains
> too much technical detail. Reader discretion is advised.
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>

--
Regards,

Rakhi

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple