How to run multiple java files concurrently using command line?

Hi,
I have to write a script to run multiple java files and c files concurrently. Say, A and C are java files and B is another binary executable file, I have to make sure they are run in the order A-B-C, then I was trying to run by using
java A & ./B & java C
But it turned out that B could run before A started... Is there any way that I can ensure that A runs before B, and B runs before C by using the command line?
Thanks a lot.

GKY wrote:
Sorry, I didn't make my question clear enough...
A has to give some output files that B needs to get started,Then B can start at any time--even before A--and just wait for those files to be written. For instance, A could write to a temp file, then rename it to the real name. However, if there are multiple files, and they all have to exist, even this won't necessarily work. There are other approaches that will though.
although writing the output takes very short time,Depends on when the OS decides to give A CPU time, what else is going on on that disk controller and/or network, etc.
B could still run before A finishes the writing, As it can if you sleep for 1, or 10, or 1,000,000 seconds before starting B.
if B can't find the info it wants, it fails to move on. That's why I need to make sure A starts before B.No, you need to make sure A's data is there before B tries to use that data.
Edited by: jverd on Jul 29, 2008 1:06 PM

Similar Messages

  • How to run a Java program without the command line.

    Is there anyway to create a Java program that runs like most programs do in Windows ,by double clicking on their icons?
    Thanks,
    Vance

    http://www.ej-technologies.com/products/exe4j/overview.html
    Looks kinda cool. Most java-2-exe programs are usually way too expensive and wont work with GUIs and require other dlls/libraries...

  • How to run form in the background from command line

    please can anybody tell me to
    how to run form in the background from command line
    vishal

    Ummm....Oracle Forms is a foreground runtime kind of thing. What you want is a database procedure (or an OS utility - it depends on what sort of processing you want to do in the background).
    Cheers, APC

  • How to run standalone java file from weblogic server on Solaris

    Hi,
    We have a requirement to run a java file at a scheduled time in a day using cron scheduler on our linux server.
    We need to fetch data from the database & perform some business logic in this standalone JAVA file.
    Our application has an EAR which is deployed on Weblogic 10.3 server & in our application, we are utilizing the datasource created in that domain.
    Now, we have created a standealone Java file & used exisitng datasource (without Hibernate) of the domain with the help of below forums,
    Use DataSource of weblogic in a standalone Java file
    able to achieve the same.
    I've bundled this JAVA in application WAR & depoyed on the same domain where datasource is created.
    Now, how can I execute this file from anywhere on the server using weblogic classpath.
    Please help on the same in implementation.
    Thanks,
    Uttam

    If the Java application must be stand-alone you must not deploy it on WebLogic, then WebLogic will manage its lifecycle.
    In this case you can use the CommonJ API and use the timermanager if it must run on a certain time. More information
    of how to do this can be found here: http://middlewaremagic.com/weblogic/?p=5569
    If you keep the Java application stand-only and want to use a cron job you can follow the example presented here: http://middlewaremagic.com/weblogic/?p=7065
    Note that the example runs a WLST script, but you can follow the same steps to run your Java application.

  • How to run any java file...

    i want to run .java file..
    suppose i have some classes then i want to run those classes by providing just the name of the class..
    my program should run any .class file by just selecting the name of the class..

    rajeev-usendi wrote:
    it can be any .class file..
    it can have a main method() or init()...
    basically i want to execute that .class file and dynamically i want to access its variables which has been defined public..Why don't you just "execute" these class files within the program itself and keep the class files within the same project/jar file? Call the methods dynamically to access it's variables.
    I think could run any .java file by implementing it as Runnable and starting them as threads from the main program. I'm not sure how you'd get it to the poitn where you could .start() it though.

  • How can I create a NetBoot image using command line tools?

    Is it possible to create a NetBoot image entirely using command line tools?
    (That is, without using the SystemImageUtility)
    If so, are there reasonable instructions posted somewhere?
    I don't believe I can use SystemImageUtility with my current setup,
    but I would be happy to hear how I could:
    I have a set of Xserve clusternodes but without optical drives or video cards.
    One node acts as the head, running DHCP, DNS, OpenDirectory, Xgrid.
    They are wired to a gigabit switch.
    I have a PowerBook connected on the subnet which has ServerAdmin Tools installed.
    I don't think when I run SystemImageUtility on my PowerBook that I can successfully image one of the clusternodes disks over the network.
    I have tried to start one node in target(Firewire) mode, connect it via Firewire
    to the head node, and run hdiutil from the head node to make a complete disk image of the clusternode's drive.
    But a NetBoot image requires the whole nbi file, right?
    Could I then use copy this disk image to my PowerBook and use SystemImageUtility on my PowerBook to create a NetBoot image from it?
    I really have tried to read the PDFs, but I found the section on System Imaging in the Command Line Reference rather unhelpful.
    Thanks for anyones help.
    dmaus
      Mac OS X (10.4.4)  

    To create a NetBoot image, you could just put the cluster node in target mode and attach it to your PowerBook. Then use SIU to create the NetBoot image.
    If you're trying to create a backup image of the disk, use hdiutil, or put in in target mode and create the image with Disk Utility.

  • How to Load an app to iPad using command line

    Hello,
    I am trying to build an iOS app and load it to an iPad where I want to run an automated test on it from command line.  I do not wish to use Fruitstrap or any other third party tool/code as I only want to use native apple code.
    xcodebuild -verbose -project iOS_Calc.xcodeproj -configuration Release -sdk iphoneos6.1 -arch armv7 -target iOS_Calc clean build
    xcrun -sdk "iphoneos" PackageApplication -v "$project_dir/build/Calc.app" -o "$project_dir/build/Calc.ipa" --sign "$provisioning_profile" --embed "$project_dir/$mobileprovision"
    Above is the script I have so far to build the app, but I dont know how to load it to an iPad via command line. Does anyone know how to load the .app to iPad device?

    I'm also interested. Not only load but also run.

  • How to open url in acrobat reader using command line

    Hi,
    I need to open file from url using command line, but I'm still getting some error (wrong filename).
    I've tried for example this command:
    AcroRd32.exe http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf
    Can anyone help me and tell me what's wrong?

    You can't use a URL as parameter for AcroRd32.exe.

  • Running multiple java apps simultaneously, using different versions of jre.

    I have a situation where I have 3 or 4 applications (and one applet) that were built over time, each with a different version of the jdk (ranging from 1.2.2.005 to 1.3.2). I need to know of a way (and it must exist) to run each of these applications on the same machine, and at runtime, have each application (or applet) run with its respective version of the jre. Certainly, one could change some source code and make all programs compatible with a particular jre, but that doesn't solve my problem if a new app is built with a new version of the jdk down the road. Currently, each runs fine by themselves, but if I try to run them together as different processes, some won't do anything because the default jre may not be what it needs. Would the Java Plug-in software have a role to play in this? Is there a way to specify (link) which application should use which jre?
    P.S. These applications (right now) don't have to interact or interface in any way. I just need to have them all running as separate processes on the same machine and be able to jump from one to the other.

    Write a batch file that sets the environment properly and restores it afterwards, here is a sample batch file we use which switches to IBM's JRE to run an app:
    OLDPATH=$PATH
    PATH=$PATH:"/usr/local/java/IBMJava2-13/jre/bin"
    OLDCP=$CLASSPATH
    CLASSPATH="/usr/local/java/IBMJava2-13/jre/lib/rt.jar:."
    OLDHOME=$JAVA_HOME
    JAVA_HOME="/usr/local/java/IBMJava2-13/jre"
    # put the command to execute your program here
    java -jar app.jar
    PATH=$OLDPATH
    CLASSPATH=$CLASSPATH
    JAVA_HOME=$JAVA_HOME
    This is for Linux, but it should be possible to write one for Windows too.

  • Problem with running a java program from the command line

    I have this code:
    package pkg;
    import jxl.*;
    import java.io.File;
    public class TestClass {
         public static void main(String[] args) {
              try{
                   Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
                   Sheet sheet = book.getSheet(0);
                   String s=sheet.getCell(4, 2).getContents();
                   System.out.println(s);     
              }catch (Exception e){System.err.println(e);}
    }I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
    Then I tried to run it from the command line and I did it like this:
    D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
    Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
    Caused by: java.lang.ClassNotFoundException: pkg.TestClass
    ...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
    So, my question is: How to run this code from the command line?
    I have no idea what went wrong.
    Can someone help me, please?

    The current directory is not implied in the classpath.
    D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
    D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars...

  • Help required - running a Java program from the command line

    Hi,
    I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
    When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
    Both the application jar file and the external jar file are in my root directory (C:\).
    My command line call is as follows:
    java -cp c:MyExternalLib.jar -jar MyApp.jar
    Any help greatly appreciated.
    Thanks,
    Walter

    hi,
    set classpath=%classpath%;c:\myjar.jar;
    here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
    java mypgm
    this will solve ur problem
    regards,
    Ganesh

  • Soft-restart of Java node by  using command line utility

    Hello,
    Could anyone advise whether there is a way to soft-restart the java node by using a command line utility (if there is one)?
    I would like to script to run in unix.
    Kind regards,
    Murad.

    Thank you for all your reply.
    Does Jcmon issue soft-restart?
    We have problem with Veritas Cluster. When there failover occurs, Java nodes appears to be online when we check from SMICM, but in fact it looses connection to the central instance. We have to issue a soft-restart for each java node to create connection again. It is a known bug and this only can be fixed by using replicated enqueue server. This only available in SP, which we can not apply right now. What I want to do is to create a script to automate the soft-restart which will be run just after failover.
    Thanks,
    Murad

  • How to upde userid to uid=0 using command line?

    Hi all,
    I made a new user "sysadmin" by typing at root command line:
    # useradd sysadmin (all default profile values)
    What is the command (line) to update its UID to "0"?
    Thanks you very much in advance.
    Ms KK

    In general, having multiple accounts with the same UID is a bad idea. To have
    multiple "root" accounts is very, very bad idea.
    If you need an ordinary mortal user to be able to execute privileged commands,
    set up the sudo(1) facility. This will let you grant permission with a fine
    level of control about exactly which program or command is being used. As a
    bonus, you will get an audit trail of who did what as whom.
    The great thing about sudo(1) is that you can grant root privilege without
    having to give out root's password.
    Now, assume you make duplicate "root" accounts. You get offered a better job
    and leave. The new sysadmin will need careful briefing before doing anything.
    This will create a major maintainability issue long term.
    If you want another root user for disaster recovery or losing the password,
    there are better alternatives such as:
    -- Reboot the system using rescue mode from the installation disks.
    -- Boot into single-user mode by interrupting the GRUB install sequence and appending "s" to the kernel command line.
    -- Boot into an interactive shell by appending the "init=/bin/bash" clause using the same technique.
    These are some of the known, common, best practice methods of handling this
    situation. A custom solution here could be quite dangerous and hard to maintain
    in the long run.
    Please don't.

  • How to run Discoverer 10g report from unix command line

    Hello Experts,
    I am aware that discoverer report can run through command line using "dis51usr.exe /connect username/passward@connection_string /opendb "DISCOVERER.<<report name>> /export xls"".
    Can we run discoverer 10g report (stored in database) from server location / unix command line? Is there any command?
    Please assist. Thank you.

    Hi Tamir,
    Can you please mention from where we have to execute/run these commands? After setting enviornmental variable, are these commands run from any location or we have to go to particular server location and then execute (ex. from directory BI or else).
    Thank you.

  • Can I combine two pdf files by using command lines?

    Hi
    I always need to combine two pdf files into one in my regular work
    Currently, I open one of them, press ctrl+shift+I,
    find another file and double click it.
    It works but not so efficient since I need to do
    this procedure many times everyday
    So I'm looking for a better solution
    Something like command lines,
    for example:
    acrobat.exe "combine" "doc1.pdf" "doc2.pdf"
    Does acrobat have these functions or not?
    Thx &
    Best Regards

    File > Combine

Maybe you are looking for

  • ICal Server Shared Calendars "403" Error

    Greetings, We are currently running a 10.7.4 Server with 10.7.4 clients. The problem is with the calendar system's sharing funtion. Some users will consistantly receive an error message "403" Stating that the user does not have permission to edit the

  • Full time Labview Computer Systems Engineer – London, UK

    BPP-TECH are seeking engineers to carry out the development and testing of software for instrumentation packages used in the international offshore oil and gas industry. The software uses National Instrument's Labview as a base and it is the intent t

  • Opening files directly from CC in CS6?

    Hi, Is there a way to login to your cloud account and open the files directly in CS6 without always having to download them? Dropbox has software that allows you to do this. Sean Udal

  • Conditionally Hide Regions based on :APP_USER

    Hey Guys, I have a pretty straight-forward question. I'm trying to hide a region unless the user = "ADMIN_JOHN" OR "ADMIN_TOM". Can someone please tell me: 1.) the condition type, 2.) what to write into expression 1 (and possibly expression 2). I've

  • ERROR IN DISPLAYING WEB AGENT SAMPLES

    I am running olap web agent 9.2.1 on Application server 10g (101202) , at first using olap web agent 9.2.1 patch 2 and database 10g 10.2.0.1 I had no problems accessing the web agent samples, then after upgrades to olap web agent 9.2.1 patch 4 and Pa