I would like to know how to convert a file array to a string array so it can be displayed on a JList.
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.
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.
Not sure what a file array is? Can you explain?how to convert a file array to a string array
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.
By File Array if you mean that it is an array of File objects then you can use
methods to represent the file's path/information.file[i].toString(); file[i].getAbsolutePath(); file[i].getPath(); //etc
KILL3RTACO (October 2nd, 2011)
+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...
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.
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?
yes. I make mine with a simple text editoris there a way to make the manifest file from scratch
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.