• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Copy Jar File

 
vineet kumar chaudhry
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I just wana do it ,It can be any how
 
Deep Purohit
Greenhorn
Posts: 9
Eclipse IDE Flex Java
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic