This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unable to access jar file" Watch "Unable to access jar file" New topic
Author

Unable to access jar file

Talitha Bell
Greenhorn

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
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

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
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

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

Using the full path:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Talitha Bell
Greenhorn

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

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