Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

ant task for running two java classes in different jvms

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anyone help me on how to run two main classes with two different jvms by using ant tasks,here contraint is one java program must start after another java program started.

example:
class Server{
public static void main(String args[]){
System.out.println("server ready");
//Service is exposed here and waiting for client request to serve
-----

}

}

class Client{
public static void main(String args[]){
System.out.println("cient started for requesting server");
//logic for calling the server to get service response
-----

}

}




//main logic here
class Service{
public String myService(String inputData){

//business logic here
String strOutputData="sucess";
return strOutputData;


}
}








In the above example code through ant build scripts
1.i need to start the server in one jvm with service enabled
2.i need to start the client in another jvm and call the server to process service


Thanks in advance

Regards
Suresh

 
Sheriff
Posts: 22509
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our Ant forum.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the <java> task with "fork" set to true. Also set "spawn" to true for the server.

By the way, it is much easier to read posts containing source code when you use the "code" tag.
 
suresh reddy reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thank you for reply, i tried by enabining in server startup ant task by using fork and spawn enabled but in my case after server startup in command prompt in windows it is waiting there only to serve client request ,so client jvm not at all starting there ,any idea please


Regards
Suresh
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post the Ant task that starts both server and client (be sure to use code tags when you do so).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic