Results 1 to 9 of 9
  1. #1
    sublixt's Avatar
    sublixt is offline Member
    Join Date
    Jul 2011
    Location
    somewhere
    Posts
    37
    Rep Power
    0

    Default access files in jar

    with a program im writing i need to move class files into a jar but i cannot figure out how to use the jar file as a directory. how can i access the contents of the jar file to move the files in there?

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    If you mean you want to write a program that can put class files into a jar, check out the java.util.jar package. Alternatively, you could use Runtime.exec(..) to execute the Java jar tool (jar.exe).

    If that's not what you mean, please explain in more detail.

  3. #3
    sublixt's Avatar
    sublixt is offline Member
    Join Date
    Jul 2011
    Location
    somewhere
    Posts
    37
    Rep Power
    0

    Default

    how do i tell it which jar to use the input stream on?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,513
    Rep Power
    25

    Default

    how do i tell it which jar to use the input stream on
    Strange question. You use input streams on the file you want to read from.
    What is the "it" in that question?

    Your original question didn't say how many jar files were involved in your project.
    Can you explain what you are trying to do?

  5. #5
    sublixt's Avatar
    sublixt is offline Member
    Join Date
    Jul 2011
    Location
    somewhere
    Posts
    37
    Rep Power
    0

    Default

    sorry you're right that i was un-clear. there is only one jar file that needs the patching i have a set of class files that are downloaded from a repo on the internet and then moved into the jar file. im using the fileinputstream on the class files that was downloaded a jaroutputstream (i think) on the jar that needs the files moved into. im wondering how do i choose the location of the jar and in the jar for where i want to move the file to?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,513
    Rep Power
    25

    Default

    im wondering how do i choose the location of the jar and in the jar for where i want to move the file to
    You could use JFileChooser to choose the location and the jar.

  7. #7
    sublixt's Avatar
    sublixt is offline Member
    Join Date
    Jul 2011
    Location
    somewhere
    Posts
    37
    Rep Power
    0

    Default

    one more thing when i choose the location of the jar and where in the jar i want to move the file can i use mkdir, createnewfile, and exists methods on those paths or is there special jar methods that provide the same function

  8. #8
    sublixt's Avatar
    sublixt is offline Member
    Join Date
    Jul 2011
    Location
    somewhere
    Posts
    37
    Rep Power
    0

    Default

    also the jar that needs patching is in a set location. i just want the user to push one button and all files are downloaded and moved to the jar.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,513
    Rep Power
    25

    Default

    can i use mkdir, createnewfile, and exists methods
    If you're not sure how to use the File class, write a small test program and experiment with the different methods to see what they do.

Similar Threads

  1. Access class files outside of a .jar
    By unaligned in forum Advanced Java
    Replies: 8
    Last Post: 06-06-2011, 08:27 PM
  2. how to access and print the dwg files in java
    By vmag in forum Advanced Java
    Replies: 0
    Last Post: 03-19-2010, 06:29 PM
  3. Access remote machine files
    By blueprats in forum New To Java
    Replies: 16
    Last Post: 02-21-2010, 03:13 PM
  4. Random Access Files concept
    By AralX in forum New To Java
    Replies: 2
    Last Post: 12-25-2007, 07:04 PM
  5. access to dll files
    By Heather in forum Advanced Java
    Replies: 1
    Last Post: 07-08-2007, 12:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •