• Post Reply Bookmark Topic Watch Topic
  • New Topic

To create .jar from batch file through command prompt  RSS feed

 
kamal palia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have .bat file which i run through command prompt to create jar file.
EX:: epgSupport.bat file contains the path of class files, but when i run batch file it shows following error and generate temp files(jartmp952913122216805571.tmp):::

java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file s
pecified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)

and i have checked that the file is present in the given location but still it shows same error.
Please give your suggestions to handle this problem.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16047
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kamal palia wrote:and i have checked that the file is present in the given location but still it shows same error.

That must mean you're still doing something wrong with the path, because the computer isn't lying to you. What's the current directory when you run the program? Are you sure the file epgSupport.jar is in the current directory?
 
kamal palia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below are the files::
a) epgSupport.bat file which i run through cmd contains

jar -cvf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerLister.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerRegister.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\CodeDescProvider.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\SysRespCodeProvider.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\AuthenticatorBaseInterface.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\BaseAuthenticator.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\RelatedTxnAuthenticator.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\RootTxnAuthenticator.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\cardchecker\CardChecker.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\MPIResponseValidator.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\MPIResponseValidatorConfiguration.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\auditaccessor\AuditTblListPresentationObject.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\auditaccessor\AuditTblListDataObject.class

b) If i check the path D:\epgFDC\src\com\opus\epg\acqregistration then it contains that file(AcquirerLister.class)
but in command prompt it shows

D:\epgFDC\src>jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\RelatedTxnAuthenticator.class
java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file specified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)

D:\epgFDC\src>jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\cardchecker\CardChecker.class
java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file specified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)

D:\epgFDC\src>jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\MPIResponseValidator.class
java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file specified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kamal palia wrote:Below are the files::
a) epgSupport.bat file which i run through cmd contains

jar -cvf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerLister.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerRegister.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\CodeDescProvider.class



Are these the only lines your batch file contains???
If this is the case, then after running the above batch file, it first creates a Jar file in the location where you saved the Batch File...

kamal palia wrote:
b) If i check the path D:\epgFDC\src\com\opus\epg\acqregistration then it contains that file(AcquirerLister.class)
but in command prompt it shows

D:\epgFDC\src>jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\RelatedTxnAuthenticator.class
java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file specified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)


So, to run the above command, you should ensure that your batch file is saved at location : - D:\epgFDC\src... as that is where the Jar file will be created, and then only you will be able to find the jar...


Better, you can modify your batch file as: -

d:
cd epgFDC
cd src
and then your command..
jar -cvf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerLister.class
jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\acqregistration\AcquirerRegister.class

This modification is liable, if you have not added it already to the batch file....
Else, check whether your batch file is in the location: - D:\epgFDC\src
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kamal palia wrote:

b) If i check the path D:\epgFDC\src\com\opus\epg\acqregistration then it contains that file(AcquirerLister.class)
but in command prompt it shows

D:\epgFDC\src>jar -uf epgSupport.jar D:\epgFDC\src\com\opus\epg\authenticator\RelatedTxnAuthenticator.class
java.io.FileNotFoundException: epgSupport.jar (The system cannot find the file specified.)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:123)
at sun.tools.jar.Main.run(Main.java:204)
at sun.tools.jar.Main.main(Main.java:1161)



It's not about the path of your class file, rather about the path of your JAR file...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!