File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Is there possible of synchronize Execuation of Java program file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is there possible of synchronize Execuation of Java program file" Watch "Is there possible of synchronize Execuation of Java program file" New topic
Author

Is there possible of synchronize Execuation of Java program file

Parshuram Walunjkar
Ranch Hand

Joined: Jan 02, 2002
Posts: 31
Hi friend's,
I want to synchronize the execution of java program main method. I means if I running the Hello. java from one console and I want don't want to run that program from another console.
Is this possible in java?
Regards from
Parshuram Walunjkar
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The problem with that is that they are running from separate processes in their own JVMs.
I would guess that you could create some persistant flag in a database or file and have the main method check that flag as it's first step. If it is not set - then set it (making sure that you write it back out to the file) and continue running. When complete you would need to unset the flag.
If it is already set just exit gracefully.


"JavaRanch, where the deer and the Certified play" - David O'Meara
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
You could have the program open a socket (or start an RMI server) when it starts. New processes can check for previosly running servers and perhaps even send some commands (i.e. if it's a file editor, there could be a way to open a file in a pre-existing process).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there possible of synchronize Execuation of Java program file
 
Similar Threads
Linux script to call a java program
getting the compiled date
Communicating with a process thru a browzer
logging into linux machine through java
How to run bat file from Java program