'Unable to access jar file' from a Cygwin Bash Script

Album Cover: Flight of the Conchords

"She's so hot, she's making me sexist."
Flight of the Conchords / Boom

Posted on May 12, 2008 5:28 PM in Computers
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

I ran into an interesting problem today while working on a bash script (funny where we end up, isn't it?) to be run in Cygwin. For the life of me, I could not get the bash script to execute a JAR file. I kept getting an error along the lines of:

Unable to access jarfile batik-rasterizer.jar

Because I'm working from Cygwin, I assumed that I might need to add the path to that JAR file either in my .bashrc script or at least explicitly from the Cygwin command line. However, doing so didn't make any difference. My next guess was to include the absolute path to the JAR in the bash script, like so:

java -jar "/cygdrive/c/Program Files/batik-1.7/batik-rasterizer.jar" ...

However, that approach didn't work either. As a total long shot, I decided to try using a Windows file path as the argument to the above command, as opposed to the Cygwin-friendly path shown. Therefore, my new command ended up looking like:

java -jar "C:∖Program Files∖batik-1.7∖batik-rasterizer.jar" ...

Believe it or not, doing so did the trick and I was able to execute the JAR file from within my bash script. It seems really strange, since almost everything tends to require a Cygwin-friendly path in order to execute properly. But maybe since the JRE was installed for Windows rather than from within Cygwin itself, the hack makes more sense.

Comments

Jason Terk on May 13, 2008 at 1:13 PM:

This isn't really a hack, just a silly incompatibility between Cygwin and normal Windows applications. Because it's a Windows JRE, the java executable has no idea how to use a Cygwin path. It's interesting, however, that things didn't work when specifying just the JAR filename. I'll bet that the JRE is looking for the %CD% environment variable to tell it the current working directory, which won't be set in a Cygwin shell.

Permalink

Guido Smeets on May 18, 2009 at 12:19 PM:

Thanks a lot, this helped me solve my issue as well. For other people that stumble upon this site when searching for this problem: you can use CLASSPATH=`cygpath -wp ...` so you don't have to rewrite all the paths by hand.

Permalink

J. Bond on May 19, 2013 at 4:09 PM:

Sir, I thank you. This was driving me nuts.

Permalink

Alfonso on September 22, 2013 at 2:42 AM:

Nice information, it helped me to solve a problem that was driving me crazy. Thanks a lot for having posted it. :)

Regards
Alfonso

Permalink

Manually blog commenting on September 03, 2016 at 1:20 AM:

I concede, I have not been on this site page in quite a while... be that as it may it was another delight to see It is such a vital subject and overlooked by such a variety of, even experts. experts. I thank you to help making individuals more mindful of conceivable issues.

Permalink

minecraft free on September 28, 2016 at 4:07 AM:

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post.

Permalink

free netflix account on September 28, 2016 at 4:08 AM:

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses.

Permalink

free netflix account on September 28, 2016 at 4:08 AM:

Thanksasd for providing recent updates regarding the concern, I look forward to read more.

Permalink

The Lost Ways Book on October 04, 2016 at 5:26 AM:

We are making a new school for master degree.

Permalink

twitter follower kaufen on October 08, 2016 at 8:21 AM:

I would like to say that this blog really convinced me to do it! Thanks, very good post. twitter follower kaufen|how to get more views on youtube

Permalink

Bar Brothers Review on October 08, 2016 at 10:42 AM:

the Bar Brothers is a digital course created by the Bar Brothers that you get only from the official website as online access and digital download.
The program comes with educational, instructional and motivational information to help you.

Permalink

Japanese Toenail Fungus Code Review on October 13, 2016 at 7:31 AM:

That is the tested remedy to healing your toenail fungus and does not any lethal side effects. This product will kill ninety nine. foot and nail fungus with few easy steps to use conveniently at dwelling.

Permalink

TubeLoom Program on October 14, 2016 at 2:59 AM:

is a real and actual residence trade that anybody can from their residence to earn someadditional income. At the same time using this Tubeloom by using Charlotte White.

Permalink

7 Steps to Health and The Big Diabetes Lie on November 03, 2016 at 9:43 AM:

you will additionally obtain a quantity of related books as a bonus, similar to healthful recipes or a text on the importance of water in your everyday movements.

Permalink

Vientre Plano Durante la Noche on December 01, 2016 at 6:22 AM:

Su progreso de pérdida de peso y averiguar lo que pueden hacer para ponerse en camino hacia el casting fuera de la grasa del vientre obstinado.

Permalink

Turmeric with BioPerine on December 04, 2016 at 5:05 PM:

Is a blend of specific elements including curcumin which is the main ingredient that helps to avert inflammation and cut down fat on your physique.

Permalink

Nutrio2 Review on December 07, 2016 at 11:41 AM:

claims to contain a extra bioavailable type of oxygen than what is found in normal water. Somehow, this leads the manufacturer to make significant claims about the advantages of taking.

Permalink

Japanese Toe Nail Fungus Code on December 15, 2016 at 12:32 PM:

is a entirely official eastern remedy that involves taking no drugs and expenditures a fraction of the price of toenail fungus medicines or creams.

Permalink

Japanese Toe Nail Fungus Code on December 15, 2016 at 12:48 PM:

is a entirely official eastern remedy that involves taking no drugs and expenditures a fraction of the price of toenail fungus medicines or creams.

Permalink

Japanese Toe Nail Fungus Code on December 15, 2016 at 12:59 PM:

is a entirely official eastern remedy that involves taking no drugs and expenditures a fraction of the price of toenail fungus medicines or creams.

Permalink

Diabetes Loophole on December 23, 2016 at 1:40 AM:

Your own co-workers are usually flaming about the products additionally right now I simply uncover the reason why.

Permalink

Social Home Jobs Review on January 04, 2017 at 8:22 AM:

You shouldn't have any competition or any restrictions on what that you can earn.

Permalink

diy smart saw projects on January 05, 2017 at 1:19 AM:

The computing device moves just as you need it and the measurements are additionally the precise ones and perfectly accurate.

Permalink

vientre plano de la noche ala mañana on January 05, 2017 at 12:19 PM:

La razón por la que recomiendo este truco fácil barriga plana noche es que los métodos documentados en su plan son seguros.

Permalink

The Diabetes Loophole Reviews on January 27, 2017 at 10:40 AM:

This Book integrated easy to use methods, normal ways that can systematically decrease infection.

Permalink

memory repair protocol recipes on January 31, 2017 at 7:13 AM:

The development charts and the step-via-step instructional materials for the best way to use everything. Including all the proven strategies.

Permalink

دكتورة on March 26, 2017 at 1:38 AM:

A brilliant piece of writing, a must read it has been always a pleasure reading your Guestbook.

Permalink

designer mens luggage bags on April 04, 2017 at 7:10 AM:

Offering wide collection of men designer bags made from high quality materials. Our bags made in Italy and we ship it for free to you.

Permalink

فينير on April 09, 2017 at 10:42 AM:

Hi! Thanks for the great information you havr provided! You have touched on crucuial points!

Permalink

seo backlinks service on April 20, 2017 at 1:23 AM:

Very good written article. It will be supportive to anyone who utilizes it, including me.

Permalink

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.