File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Unable to access jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unable to access jar file" Watch "Unable to access jar file" New topic

Unable to access jar file

Talitha Bell

Joined: Oct 01, 2007
Posts: 29
Hi All

I tried to access jar file by the command

java -jar JAVA_HOME\demo\jfc\Java2D\Java2Demo.jar from c:\>

but give error [Unable to access jarfile JAVA_HOME\demo\jfc\Java2D\Java2Demo.jar]

i gave the full path instead of JAVA_HOME[C:\Program Files\Java\jdk1.5.0_12] but same problem

but when I tried to access jar file from the directory [C:\Program Files\Java\jdk1.5.0_12\demo\jfc\Java2D]
by command java -jar Java2Demo.jar
it works fine

any one tell me why ,how i will access it from c:\>

Thanks <br />Talitha
Joe Ess

Joined: Oct 29, 2001
Posts: 8710

You have to tell the command processor you are using an environment variable. On windows, this is done by enclosing the variable in %:

Using the full path:

works for me as well.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Rob Spoor

Joined: Oct 27, 2005
Posts: 19543

It would be better to use quotes, so you can have spaces in the path:

Using the full path:

How To Ask Questions How To Answer Questions
Talitha Bell

Joined: Oct 01, 2007
Posts: 29
Joe Ess and Rob Prime for reply

Rob formula works fine.
I agree. Here's the link:
subject: Unable to access jar file
Similar Threads
Java3D Editor
DOMBuilder and NoClassDefFoundError
How to plot this contour ?
How can i set path and classpath?
JAR file problem