Results 1 to 3 of 3
  1. #1
    sri22 is offline Member
    Join Date
    Feb 2016
    Posts
    1
    Rep Power
    0

    Question Accessing Java methods from ANT build

    Hi All,

    I am having a Java Package with below Class
    Start - This Class has 2 methods
    ->FindPort() - Check for available port
    ->StartPort() - Start the port

    Stop - This Class has one method. output of FindPort will be used in this method
    ->StopPort() - Stop the port

    I need to write a ANT build, which will first call Start Class and then do some job and at end call Stop Class. Stop Class need to use same port as in StartClass

    How can I use the output of FindPort in the Stop Class?

    Please let me know if you need any other information.
    Appreciate your help.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Accessing Java methods from ANT build

    Why not dump the second class and add method StopPort() to the first class; the first class should have a private variable 'int port' that stores the found port number and your StopPort() method could use that variable ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    6

    Default Re: Accessing Java methods from ANT build

    I agree with josAH that the architecture as such makes no sense. If the assignment forces you to establish 2 classes you should encapsulate the port property.

Similar Threads

  1. Accessing Object methods
    By binary_matter in forum New To Java
    Replies: 2
    Last Post: 02-13-2013, 01:38 PM
  2. Accessing methods in a different class
    By syle_q in forum New To Java
    Replies: 6
    Last Post: 03-30-2011, 08:39 PM
  3. Accessing int's, String's by methods.
    By Cyloc in forum New To Java
    Replies: 2
    Last Post: 12-14-2010, 02:25 AM
  4. Accessing GUI object methods
    By km0r3 in forum AWT / Swing
    Replies: 5
    Last Post: 10-06-2010, 02:39 AM
  5. Replies: 3
    Last Post: 10-12-2008, 03:49 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
  •