944,202 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 119188
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 29th, 2005
0

'Unable to access jarfile'

Expand Post »
When I try to execute my jar file through the command prompt by typing:
java -jar myJar.jar
It returns an error message saying that it can not access the jar file. Why is this? myJar.jar is the exact name of my jar file.
Similar Threads
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jul 30th, 2005
0

Re: 'Unable to access jarfile'

Where is your jarfile and where are you trying to do that?
And what's your classpath?
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jul 30th, 2005
0

Re: 'Unable to access jarfile'

my jar file is MyJar.jar located at C:\Documents and Settings\Josh\My Documents\JAVA Programs.
My Class path is payroll, The jarfile and manifest files are all correct I believe.
I am trying to execute 'payroll' through the command prompt.
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jul 30th, 2005
0

Re: 'Unable to access jarfile'

you'd have to be in that very directory then. And add '.' to your classpath and path.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jul 31st, 2005
0

Re: 'Unable to access jarfile'

how would you get into that directory?
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jul 31st, 2005
0

Re: 'Unable to access jarfile'

Hi everyone,

Do this list what is in your manifest file here. Also list exactly what you are typing on the command line with all the full path and class path so we can see what's wrong

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Jul 31st, 2005
0

Re: 'Unable to access jarfile'

I am sure that my jar and manifest files are correct:
Manifest-Version: 1.0
Created-By: 1.4.2_04 (Sun Microsystems Inc.)
Main-Class: Payroll


I was typing in the command prompt: java -jar myJar.jar
it returns 'unable to access jar file.

my jar file is myJar.jar located at C:\Documents and Settings\Josh\My Documents\JAVA Programs.
My Class path is payroll
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jul 31st, 2005
0

Re: 'Unable to access jarfile'

Hi everyone,

Do this

Java Syntax (Toggle Plain Text)
  1. java -jar -cp .;C:\Documents and Settings\Josh\My Documents\JAVA Programs myjar.jar

I haven't run java programs from the command line for quite some time but i think this is it. Someone correct me if i am wrong

The manifest file looks correct.

Let me know if it works

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Jul 31st, 2005
0

Re: 'Unable to access jarfile'

hmm.. when I type that in it says 'Unable to access jarfile and'
Maybe its because the starting prompt says: C:\Documents and Settings\Josh> ?
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Aug 1st, 2005
0

Re: 'Unable to access jarfile'

Hi everyone,

Quote originally posted by joshSCH ...
hmm.. when I type that in it says 'Unable to access jarfile and'
Maybe its because the starting prompt says: C:\Documents and Settings\Josh> ?
The starting prompt needs to be the location of java.exe

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Recognizing and working with an array's contents
Next Thread in Java Forum Timeline: help with Java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC