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 2 of 2

Thread: Automate files input

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Automate files input

    Overview: I am creating automated assignment marking system, in which the goal is: suppose there are 100 students' assignments in a directory and if I start my program it should check all of the assignment.java one by one and generate a report based on that.

    Clearer explanation of the question:
    At the moment, I have got assignment.java of 1 student and my Testing.java (which creates an object of the class in assignment.java and generates a report based on the output of assignment.java). So, till now what I am able to achieve is: Inside the Test project (which contains Testing.java), I import assignment.java; run the Testing.java and generate the report. When it comes to second student, I remove previous assignment.java import new assignment2.java(second student); run the Testing.java, which uses the students program and generates the report.

    What I want to achieve is, In my Testing.java instead of importing assignments one by one and marking them, I want to automate it. i.e. In my Testing.java, if I specify the path of the directory in which all assignments are placed, my system should automatically overwrite (import new assignment removing the older) assignment.java and generate a report based on that.

    Any help would be greatly appreciated.

    Thank you.


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Location
    Wales, Bangor & England, Warwickshire
    Posts
    820
    My Mood
    Cynical
    Thanks
    7
    Thanked 104 Times in 90 Posts

    Default Re: Automate files input

    Files[] fileList =  new File(".").listFiles();
     
    for(File f:fileList){
         // Process file
    }

    Chris
    chris[at]javaprogrammingforums[dot]com

    Prifysgol Bangor University, North Wales

Similar Threads

  1. Creating Methods for Input/Output Files
    By PapaGL0VE in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: November 17th, 2010, 09:07 AM
  2. need help on jar files
    By kaka09 in forum AWT / Java Swing
    Replies: 2
    Last Post: July 13th, 2010, 09:30 AM
  3. [SOLVED] allow a new input, dicarding the last mismatch input without terminating the program
    By voltaire in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 9th, 2010, 04:44 AM
  4. exe files
    By subhvi in forum Java Theory & Questions
    Replies: 17
    Last Post: September 3rd, 2009, 09:43 AM