Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Background Command Line Processes

  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default File array to String array?

    I would like to know how to convert a file array to a string array so it can be displayed on a JList.
    Last edited by KILL3RTACO; October 2nd, 2011 at 02:55 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Background Command Line Processes

    how to convert a file array to a string array
    Not sure what a file array is? Can you explain?

    You could read each record from the file and put it into the next slot in the array.
    The problem with arrays is that you need to make the array have enough slots to hold all the data that will be put into it. Using a class like ArrayList keeps you from having this problem.

  3. #3
    Junior Member Mrc0d3r's Avatar
    Join Date
    Jun 2011
    Location
    TCP/IP Layer 3
    Posts
    25
    My Mood
    Bored
    Thanks
    0
    Thanked 6 Times in 5 Posts

    Default Re: Background Command Line Processes

    By File Array if you mean that it is an array of File objects then you can use
    file[i].toString();
    file[i].getAbsolutePath();
    file[i].getPath();
    //etc
    methods to represent the file's path/information.

  4. The Following User Says Thank You to Mrc0d3r For This Useful Post:

    KILL3RTACO (October 2nd, 2011)

  5. #4
    Member
    Join Date
    Aug 2011
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Background Command Line Processes

    Quote Originally Posted by Mrc0d3r View Post
    By File Array if you mean that it is an array of File objects then you can use
    file[i].toString();
    file[i].getAbsolutePath();
    file[i].getPath();
    //etc
    methods to represent the file's path/information.
    +thanks this seems to work. on another issue, it seems that when i try to export into a JAR file, and select appropriate project, the manifest file isn't there to be included... and when i run the jar file (i want to be able to run it by regularly opening it as any other file) it says it can not find the class manifest...

  6. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Background Command Line Processes

    To execute the classes in a jar file when "opening" the jar file, the jar file must contain a manifest file with a Main-Class: record that names the starting class to be called.

  7. #6
    Member
    Join Date
    Aug 2011
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Background Command Line Processes

    Yes, but in Eclipse (java editor i use) it usually includes/makes it automatically for you, and it wasnt there. is there a way to make the manifest file from scratch? like, make a text document and rename?

  8. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Background Command Line Processes

    is there a way to make the manifest file from scratch
    yes. I make mine with a simple text editor

  9. #8
    Member
    Join Date
    Aug 2011
    Posts
    32
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Background Command Line Processes

    ok, well i just found out how to make it work. i was rushing it too much and in a view in the wizard to export it there was an option to choose the main class. and i failed to see it.

Similar Threads

  1. Replies: 10
    Last Post: September 16th, 2011, 07:49 PM
  2. jre version in command line
    By major in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 14th, 2011, 06:55 AM
  3. command line arguments
    By rizla in forum Member Introductions
    Replies: 3
    Last Post: December 12th, 2010, 11:14 PM
  4. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM
  5. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM

Tags for this Thread