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: Executing Commands read from File

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Executing Commands read from File

    Say I read the following line in from a text file:
    arrayRecords[y].getPlotNo()

    How would I execute it as a java command?


  2. #2
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: Executing Commands read from File

    Hello.
    What do you mean by java command?
    You mean you are invoking getPlotNo() method on the object arrayRecords[y]?

    If you want to do that then your task shall be more easier if you change the file. Just store the entry as y, getPlotNo.
    Read this line and break into an integer and string. The number refers to index of object and the string refers to the method to be invoked.
    Using reflection API you can invoke the method on that particular object.

    Thanks,
    Syed.

Similar Threads

  1. Replies: 1
    Last Post: April 15th, 2013, 06:41 AM
  2. Executing a file
    By usama8800 in forum Java Theory & Questions
    Replies: 5
    Last Post: February 22nd, 2013, 03:00 PM
  3. Read input, read file, find match, and output... URGENT HELP!
    By MooseHead in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 3rd, 2012, 11:01 AM
  4. Executing commands throws an InterruptedException even with waitFor()
    By LilaH in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 20th, 2011, 03:57 AM
  5. Executing Linux Commands with Java GUI
    By linuxrockers in forum AWT / Java Swing
    Replies: 2
    Last Post: February 15th, 2010, 10:57 PM

Tags for this Thread