Results 1 to 7 of 7
  1. #1
    HansiHE is offline Member
    Join Date
    Sep 2011
    Posts
    3
    Rep Power
    0

    Question Transfer directory from ran java file to external jar

    Anyone have any idea how I can copy a directory from the jar file the user ran, to another external jar file? I have already completed a nice GUI, but I cant seem to figure out how to do this. Any hints?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: Transfer directory from ran java file to external jar

    Please tell the details: exactly what are you trying to do, and perhaps more importantly, why?

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,548
    Rep Power
    23

    Default Re: Transfer directory from ran java file to external jar

    how I can copy a directory from the jar file the user ran, to another external jar file
    Do you mean you want to copy the files that are in a directory in the jar file where the program is executing code to another jar file?

    See the API doc for the JarFile and JarOutputStream classes for ideas.

  4. #4
    HansiHE is offline Member
    Join Date
    Sep 2011
    Posts
    3
    Rep Power
    0

    Default Re: Transfer directory from ran java file to external jar

    What I want to do, is inject a folder of resources(classes, pictures, etc) from a folder in the ran jar file, into another jar file.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,548
    Rep Power
    23

    Default Re: Transfer directory from ran java file to external jar

    Sorry, I don't understand what it means to "inject a folder"?
    Do you mean to copy the contents of a folder in one jar file into another jarfile? Does the other jar file already exist or will it be created? Is the "ran" jar file where the executing code is coming from?

    For reading and writing jar files see the JarFile and JarOutputStream classes and the java.util.zip package classes.
    Last edited by Norm; 09-25-2011 at 04:05 PM.

  6. #6
    HansiHE is offline Member
    Join Date
    Sep 2011
    Posts
    3
    Rep Power
    0

    Default Re: Transfer directory from ran java file to external jar

    I understand everything except one thing:
    I cant make it only extract from one directory. Anyone know any way of reading from only one directory?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,548
    Rep Power
    23

    Default Re: Transfer directory from ran java file to external jar

    Look at the ZipEntry name. I think that contains the directory name.

Similar Threads

  1. Replies: 3
    Last Post: 02-15-2011, 12:27 AM
  2. Replies: 6
    Last Post: 02-08-2011, 07:08 AM
  3. Replies: 4
    Last Post: 03-26-2010, 08:16 AM
  4. File Transfer using java.IO
    By cheng in forum New To Java
    Replies: 0
    Last Post: 12-14-2009, 04:42 AM
  5. Java File Transfer
    By lks0912 in forum Advanced Java
    Replies: 0
    Last Post: 10-23-2008, 12:53 PM

Tags for this Thread

Posting Permissions

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