This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass arguments from one program t o other  RSS feed

 
sunil ingalagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to pass two strings from one program to other..
when i calll the other program with null parameter as pgm2.main(null), its working fine, please somebody tell me how do i pass arguments to other program...


Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the "programs" you're talking about - Java classes in the same JVM? Java applications running in different JVMs? Native applications?
 
sunil ingalagi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
two programs running on different JVMs both the programs have main functions. i have created two frames and i have made a call to second program in jButtonActionPerformed block as pgm2.main(null) on clicking this button the other frame opens but when i pass some arguments in place of null it is not working please help me im still java beginner
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pgm2.main(...)" invokes a method in an object in the same JVM. It can't be used to communicate with a different JVM.

The best way to communicate between JVMs are often sockets. Other methods are possible, but it depends on the circumstances whether they're feasible in your case.
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually interprocess communication is done through sockets, files, shared memory, pipes and other similar methods.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!