Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Creating a File object out of the contents of jar/zip file

Thread view: 
kotauk@gmail.com - 06 Apr 2006 13:58 GMT
Hi,
  How to create a File object of .java file contained in jar/zip file.
For eample i have a zip like test.zip
It has a file mypack.today.MyProg.java

Give the jar file how to create File object of the MyProg.java.

Any pointers would be great help

thanxs
kota
Fred Kleinschmidt - 06 Apr 2006 15:37 GMT
> Hi,
>   How to create a File object of .java file contained in jar/zip file.
[quoted text clipped - 7 lines]
> thanxs
> kota

jar -x filename jarname > retrieved_file
Signature

Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project

kotauk@gmail.com - 06 Apr 2006 16:09 GMT
Hi Fred,
  I want to create  java.io.File object programatically

thanks
kota
Roedy Green - 06 Apr 2006 21:36 GMT
>   I want to create  java.io.File object programatically

new File( ... )
see http://mindprod.com/jgloss/file.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

kotauk@gmail.com - 06 Apr 2006 16:10 GMT
Hi Fred,
  I want to create  java.io.File object programatically while reading
the jar using java.util.jar.JarFile

thanks
kota
Thomas Fritsch - 06 Apr 2006 17:18 GMT
> I want to create  java.io.File object programatically while reading
> the jar using java.util.jar.JarFile
Read <http://java.sun.com/j2se/1.4.2/docs/api/java/util/jar/JarFile.html>.
There is all you need to get an InputStream for reading a zip-entry of the
the jar. Open a FileOutputStream for the destination file. Then copy all
bytes from the InputStream to the FileOutputStream.

Signature

"Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.