Results 1 to 12 of 12
  1. #1
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Smile Run an application through another

    Hi everybody,

    I have two java programs..how can i run the first through the second one.

    Thank you

  2. #2
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    335
    Rep Power
    4

    Default Re: Run an application through another

    Can you elabourate on your requirements. A clear explaination and your code would be useful.

    Regards.

  3. #3
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: Run an application through another

    i have a long java code (program1) named "parser.java"..
    Now i will write another java program (swing),an interface,through what i will clic on a button and run the "parser"

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Run an application through another

    Call the code from the button action?
    (Well, create a SwingWorker that calls it, anyway)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: Run an application through another

    oK,to be more clear
    this is my first java application

    Java Code:
    public class Hello {
    
    	public static void main(String[] args) {
    		System.out.println("hello");
    	}
    	}
    and this is my second java application

    Java Code:
    public class appelerHello {
    
    	public static void main(String[] args) throws IOException{
    		
    		Runtime runTime = Runtime.getRuntime();
    		Process process = runTime.exec("java Hello" );
    	}
    }

    it does'nt work,i want to know how can i correct the second application so that it make the first run

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Run an application through another

    Java Code:
    public class appelerHello {
     
        public static void main(String[] args) throws IOException{
             
            Hello.main(null);
        }
    }
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: Run an application through another

    Quote Originally Posted by PhHein View Post
    Java Code:
    public class appelerHello {
     
        public static void main(String[] args) throws IOException{
             
            Hello.main(null);
        }
    }
    it does'nt work because he don't know the class Hello (it demands to create the class Hello)

  8. #8
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Run an application through another

    Hello has to be on the classpath, no matter how you want to invoke it.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  9. #9
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: Run an application through another

    Quote Originally Posted by PhHein View Post
    Hello has to be on the classpath, no matter how you want to invoke it.
    Rq: Hello and appelerHello are two separated javaProjects

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default Re: Run an application through another

    And?
    That doesn't stop you using one project inside another.
    Currently I have dozens of other projects used by the project I'm currently working on.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    manou2324 is offline Member
    Join Date
    Mar 2013
    Posts
    56
    Rep Power
    0

    Default Re: Run an application through another

    hello has to be on the classpath"
    I didn't understand that

  12. #12
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

Similar Threads

  1. Replies: 3
    Last Post: 12-04-2009, 12:10 PM
  2. Replies: 1
    Last Post: 08-05-2009, 02:43 AM
  3. Replies: 0
    Last Post: 04-22-2009, 01:30 PM
  4. Replies: 0
    Last Post: 02-16-2008, 09:31 PM
  5. Replies: 0
    Last Post: 02-16-2008, 09:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •