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

Thread: Small help needed

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Small help needed

    I am a beginner. I need to know how we can use the output of one java program in another java program.

    both the programs are in the same package.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,301
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: Small help needed

    Do you mean by running it as an external process? See Runtime.exec and
    When Runtime.exec() won't - JavaWorld

    If you just want to use its classes, add the jar to the classpath

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Small help needed

    thanks for the reply. Hope I am not bothering u. I'll show u a part of my code. plz help me out.

    Package aaa;
    It has two java classes.
    1) class a(a.java)
    2) class b(b.java)

    The output of class a is a String s;
    I want to use this String s in class b.java

    Can u help me write the code.?

    Thanks in advance.

  4. #4
    Member
    Join Date
    Mar 2011
    Location
    Earth!
    Posts
    77
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Small help needed

    One thing you could do is to make the constructor of class b accept class a. That way all you have to do is to ask class a for the string when you want it (basically just call a method that returns the string). Hope I have understood your post right, lol.

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Small help needed

    lemme check and get back to u.. thanks for the reply..

Similar Threads

  1. WatchService - small code for monitoring folders
    By zincc in forum What's Wrong With My Code?
    Replies: 5
    Last Post: March 8th, 2011, 09:19 AM
  2. keylistener small problem
    By matecno in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 14th, 2010, 07:51 PM
  3. Small Project
    By 3XiLED in forum Paid Java Projects
    Replies: 7
    Last Post: March 1st, 2010, 07:35 AM
  4. small problem ... I need help
    By Ashar in forum Loops & Control Statements
    Replies: 4
    Last Post: December 4th, 2009, 10:26 AM
  5. Small Project Ideas
    By Freaky Chris in forum Project Collaboration
    Replies: 20
    Last Post: August 12th, 2009, 12:49 PM