This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Copy Jar File

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I wanna copy jar file from one location to another.How will I do that?

I have tried "jar x -C Dir C:\AnyPath\" but it is not working.
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you want to use the Windows command line to copy a file from one place to another? That's what "copy" does; what are you trying to achieve using "jar"?

I'll move it to a more appropriate forum.
 
vineet kumar chaudhry
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a abc.jar(It is used as archive for applet) in my folder vineet.And I a getting the position of vineet folder through getting the enviorment variable(I have set that for it).Now I am using third party api which generates some output in some directory xxx.Now I want my abc.jar in xxx

Can we copy it using ResourceAsStream or something like that ,I just want to copy jar file frome one location to another
 
Ulf Dittmer
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you don't want to do this from the command line, you want to do this using Java code? Searching for "java file copy" or some such term will find code to do that.
 
vineet kumar chaudhry
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just wana do it ,It can be any how
 
Greenhorn
Posts: 9
Eclipse IDE Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If anyhow copying is ok.. then use the windows "copy".

Process will contain information about the command execution. You can fetch the value from this to know whether execution is success/failed.
 
Sheriff
Posts: 22151
117
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the overhead of creating a new process, reading its streams (When Runtime.exec() won't) and waiting for it to exit, will cause this solution to be much slower than any Java-only solution. So just use FileInputStream + FileOutputStream and start copying contents.
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic