Best way to spawn java processes

I'm trying to execute several instances of a java class in seperate processes to be distributed on a cluster.
for now (until i get on the cluster on monday) i am assuming my classpath and all of the data files are on an NFS storage accessible from all nodes.
within my for loop, should i just:
               try {
                    Process p = Runtime.getRuntime().exec("java -classpath " + classpathDir + " " + classToRun + commandLineArgs);
               catch (Exception e) {
               }p.s what exceptions should i catch? how do i print an error log file?
the class that this code will call will then execute mpiBLAST... an mpi program that auto-distributes segments of a large database file and queries them. so each process (maybe 20-40) will then execute this mpiBLAST program... is this a good idea to have more than one mpi program running at the same time, maybe on the same data set?
I suppose this forum is not the right place for the last question, but I'd still appreciate any suggestions on the try code. thanks!
C

p.s what exceptions should i catch? Tis in the API:
java.lang.Runtime.exec(java.lang.String)
how do i print an error log file?
java.lang.Throwable.printStackTrace() / printStackTrace(java.io.PrintStream)

Similar Messages

  • Is Using Netbeans the best way to learn Java?

    hi all. this is my first post.
    okay, I am total n00b. But I have been flirting with the idea of learning to code for about 2 years, and I think I need to leanr java, though I hear it is a difficult first language. but i love the platform independence thing. so a question.
    is it a good practice to learn the language with netbeans, or just with a text editor? i am leaning to netbeans but thought i'd ask others.

    Encephalopathic wrote:
    Understand though that if you ask this question to 20 different folk here, you'll get 20 different answers. Also realize that this has been asked 3,428 times here.all sane people will tell you that using Notbeans may not be the worst way (that would be BlueJ) but is far from being the best way (which would be VI).

  • Best Way to Implement Java Onscreen Keyboard Input

    Hello!
    I'm working on an embedded device that will run J2SE, using a touchscreen, but no keyboard. The UI will be in Swing. When the user focuses a text field, I'd like an on-screen keyboard to be displayed.
    My question is as to the best way to have Swing text component receive the key events (?) that this keyboard will generate. The options I saw so far are
    1. Write an input method provider
    2. Use java.awt.Robot
    But I think I might be missing some easier way.
    Thanks for advice, or pointing me to an existing project.
    ~Jesse

    Thanks for the idea! It sounds quite a bit simpler.
    So basically, I'll attach a focus listener to each of my text components, and when one receives focus it will
    1. Display the keyboard on screen
    2. Pass its document and caret to the keyboard class.
    When the user "types" on the keyboard, it will modify the Document and Caret appropriately. I assume all Swing text components listen for document changes - so this should work nicely.
    Best,
    Jesse

  • Best way to debug KDE process crashes

    I've got a relatively fresh install of ARCH with KDE running.  However every time I reboot and log in I immediately get 2 pop-ups stating that KMix and a KDE Deamon closed unexpectedly.  The "executable" for both is listed as kdenitit4.  I'm assuming that is the app that started the failed process?  Checking the PIDs for each in the process list before closing the pop-ups show kmix and kded4 as the actual stopped processes.
    Question then, what is the best way to debug this.  I know there are system logs but I'm really not that familiar with where or what to look for and really want to learn and also fix the crashes :-)   What is the best way to start.  Thanks,
    John.........

    Here is some of the lines around the 2 KCrash errors:
    Known subscriber "AkonadiAgentServer" subscribes again
    void Akonadi::NotificationSource::addClientServiceName(const QString&) Notification source "AkonadiAgentServer" now serving: (":1.48", ":1.47")
    Known subscriber "AkonadiAgentServer" subscribes again
    void Akonadi::NotificationSource::addClientServiceName(const QString&) Notification source "AkonadiAgentServer" now serving: (":1.48", ":1.47", ":1.49")
    Database "akonadi" opened using driver "QMYSQL"
    Database "akonadi" opened using driver "QMYSQL"
    Known subscriber "AkonadiAgentServer" subscribes again
    void Akonadi::NotificationSource::addClientServiceName(const QString&) Notification source "AkonadiAgentServer" now serving: (":1.48", ":1.47", ":1.49", ":1.46")
    plasma-desktop(889)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
    >> KCrash: Attempting to start /usr/bin/kded4 from kdeinit
    knotify(887)/phonon (KDE plugin): QDBusError("org.freedesktop.DBus.Error.NoReply", "Message did not receive a reply (timeout by message bus)")
    korgac(944)/kdecore (K*TimeZone*): KSystemTimeZones: ktimezoned initialize() D-Bus call failed: "The name org.kde.kded was not provided by any .service files"
    knotify(887)/phonon (KDE plugin): QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.kde.kded was not provided by any .service files")
    QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
    kdeinit4: hcontrol.c:764: snd_hctl_handle_event: Assertion `elem' failed.
    QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
    >> KCrash: Application 'kded4' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    [0x2853108] main input error: ES_OUT_RESET_PCR called
    KCrash: Application 'kmix' crashing...
    KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
    Known subscriber "akonadi_maildispatcher_agent" subscribes again
    Known subscriber "akonadi_maildispatcher_agent" subscribes again
    Agent instance created in separate process.
    I marked the original two KCrash's with >> to make them easier to find.  Looking a few lines down from the 2nd one I also see a KCrash for 'kmix' which is also part of the problem.  Don't really see anything else interesting.  Open to ideas.  Thanks,
    John...........

  • Best way to connect java app to multiple databases?

    I'm working on my first commercial application, and I want it to be as flexible as possible, meaning I want it to be able to connect to a wide range of databases, as the customer chooses. I'm wondering what the best way is to accomplish this, I don't really want to have to buy a commercial license for third party ODBC drivers, any one have some good comments on this?

    You have two fundamental options:
    Use an O/R mapping tool like: Hibernate, EJB BMP, JDO, etc.
    Develop your own using JDBCIf you opt for the former, you should ask youself, "What value do i add? Or should I simply use these technologies?" The advantages are that dozens of other developers, going down similar routes, have faced the obstracles you will face and more. The disadvantage is that none of these developers has actually faced your specific problem. This is not to say that the solution does not already exist. The efficacy of this methodology will be how closely the general solution fits with your own (and since many problems have the same challenges, this will often be true).
    If you opt for the latter, you will have both an opportunity and a pitfall. The precise, business issue your current project addresses has many things both in common with other projects and also a handful of unique challenges. The hard part is determining whether this challenge actually differs in some fundamental way, or whether you have discerned some fault or opportunity in your methodology compared to standard (or even cutting-edge) practices.
    In reality, the challenge of "connecting to numerous, heterogenous (and probably vaprous) database systems" has long been addressed. Addressed, but perhaps not solved. If your goal is to develop a class library, for personal or consulting use, or to increase your understanding of the O/R boundary and best practices to obviate it, then my best advice is to read existing literature, and give it your all. There is no right answer here, and building on an existing experience of failure and success is indispensible.
    If your aim is to solve the O/R mapping challenge, or to suppant JDBC BMP, Hibernate or JDO, then my hat is off to you. We are all eagerly awaiting that day. (Sadly, after much effort, it has not yet arrived).
    So, can you connect Java to multiple databases, and even a diverse array of RDBMS vendors? Of course! But what will you do with those conections?
    - Saish

  • Best way to modify Sequential Process Model for report generation.

    I am using the Sequential Process Model in my application and the TestStand Reference Manual, (Figure A-1), clearly shows the following processing sequence:
    ...<part removed>
        Call the Test Sequence
        Display the UUT results
        Generate a Report
        Log Result to a Database
    ...<more removed>
    I want to generate the report BEFORE displaying the results to the operator, or at a minimum, I want to generate the report in parallel with displaying the results to the operator.  Currently, the problem I have is that when the test is done I have some automated scripts that take the data file and do some statistical processing on it, but the way the Sequential Process Model is set up, the test might finish but until the operator acknowledges the PASS/FAIL results display, the resulting file is never created.  It could be overnight, over the weekend, or several days before an operator comes back and says, "Oh that last test finished, I guess I can press the OK button!", but until they do, I get no data.  So I want the report generated no matter what, and right after the test finishes.
    Any ideas as to how that might be best accomplished?
    Thanks a billion -  Ski (noob)

    Ray,
    Is that new in 4.2 that the engine won't call a callback with nothing in it?  I just did it and it seemed to work fine.  I'm using 4.1.1 though.
    Ski,
    Maybe there is a better solution for what you want.  Are you using the SequentialModel?  What version of TS do you use?  Why does the report have to be written before the pass/fail banner displays?  The pass/fail banner gets displayed in the PostUUT callback.  Like Ray said if you just put that in your client sequence you won't see the banners.  However, I'm assuming there is more to this than just that.  I'm assuming you want to see the report because of your external analyzer that is gathering the statistical data.  And then based on that data you want to allow the user other options.  Is this correct? 
    If so then I would override the PostUUT callback and then use a different callback (possible the ProcessCleanup callback) to displaly the banners.  You could even do this without modifying the process model (which I always try to avoid).  Just override both the PostUUT and ProcessCleanup callbacks.  And then put code in the ProcessCleanup to behave like you need.
    Or if you want you can modify the process model and create a new callback lower in the process model.  Then have that new one do the post report analysis.
    Just some thoughts.
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Best way to combine Java Persistence API (JPA)  with Visual Web Pack (VWP)?

    I like the JPA/Hibernate development approach to create the database elements from JAVA classes.
    This way one gets rid of the need to keep JAVA code and the database in sync.
    However I have not yet found a good way on how to use JPA from the netbeans VWP.
    Note that I have found the tutorial on how to use the IDE with hibernate and it works without problems.
    However I think this tutorial does not really implement a good Model/View/Controller approach as it is done in the enterprise pack.
    Here you have a controller session bean that deals with all the persistence logic and that exposes properties through a DataModel to the application.
    There is no need to encapsulate logic in inherited classes of the ObjectListDataProvider.
    Maybe an example makes it more clear:
    If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
    How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
    With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
    But how would you do it with JPA?

    You said:
    "If we stay with the hibernate tutorial that we have "Animals" and "Pavillion" entities.
    How would one efficiently design a "Table" component that shows a list of all Animals and their Pavillions.
    With the VWP approach it is quite clear: you create a RowSet with the inner/left join between Animals and Pavillions.
    But how would you do it with JPA?"
    I have the exact same question. Have you found the answer on how to "join" entities and display them on visual web table component?

  • What is the best way to learn Java??????

    I am trying to learn java for a few weeks now.
    But I am struggling to find out what the possibilities in java are.
    With e.g. Visual Basic you have help topics to guide eyou through the language and all the objects, functions etc you can use.
    Now while learning java I miss the help topics. I do hava all the API documentation, but how will I know which class to use?? I also have the tutorials, but they are more about the syntax of java.
    Can somebody give me some pointers on what the best approach is for learning java. I also would like to know what is a good texteditor to build the applications.
    greetings maclli

    Here's some links that should get you started. I use them a lot:
    API Reference: http://java.sun.com/j2se/1.4.1/docs/api/index.html
    Language Specs: http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html
    Official Tutorial: http://java.sun.com/docs/books/tutorial/index.html
    Sorry I can't recommend any good books, though. The tutorial has a lot of good information in it, and the API reference is indispensable.
    Good luck,
    Jason

  • What's the Best Way to Learn Java for Use in LiveCycle?

    Clearly knowing Java scripting would be a boon for flexibility, but I know nothing of Java. Is there an easy dummies manual for using it with LiveCycle?
    I have been relying alot on FormCalc to get things done so far.
    Thanks.

    A very small note. You may see this as being picky, but I hope it will
    help you find the infomation you seek more accurately.
    You are not using Java. Java is a different language - so Googling for
    Java information will just leave you lost. You are using a language
    called JavaScript, always named in full.
    Now, the really confusing thing is that JavaScript in a browser,
    JavaScript in Acrobat and JavaScript in LiveCycle Designer (again,
    sorry, note the full name: there are many other LiveCycle products)
    are all different.
    A key thing is to have the JavaScript Reference. This is not good for
    learning from but it's like having a dictionary: you can't learn a
    language from it, but you will always need to look things up. This
    forum can help send you in the right direction into the documentation.
    Aandi Inston

  • What is the best way to learn Java? I am a complete spacker?

    Hi,
    Please can someone point me in the right direction on how to learn java properly, I was just browsing the Sun website and came across; [http://uk.sun.com/training/catalog/java/packages_java.html?gclid=CO2-6YrWu5kCFUsI3wodZ1qI5g]
    Who are these packages aimed at? I was looking at the top one; Entry Level; Sun Certified Java Associate.
    Thanks.

    I am a complete spacker.
    Please can someone point me in the right direction on how to learn javaWith an admission like that, what makes you think that anyone would want to "point you in the right direction", so that you might, one day, if things go to plan, be the "spacker" (as you so eloquently put it) sitting next them, asking gumby questions all day, spounging ideas, and doubtless claiming much more than your fair share of the credit, and the donuts.
    Yep, I'm fixated on the donuts. They're very nice ;-)
    Now... what where you saying?
    I was just browsing the Sun website and came across; [the training catalog|http://uk.sun.com/training/catalog/java/packages_java.html?gclid=CO2-6YrWu5kCFUsI3wodZ1qI5g] and was looking at: Entry Level; Sun Certified Java Associate.
    Yep that'd be the one to aim for when you're starting out... Personally, I recommend you give the whole certification thing a miss (at least for now) and just get into the tutorials, and grab some books (there are some really excellent ones) and just write some programs... at least until such time as you feel confident enough in your chosen field of endevour to not even consider intruducing yourself as "Hi, I'm a complete spacker"... I'll bet you're a real hit in job interviews. Good grief!
    Cheers. Keith.
    Edited by: corlettk on 24/03/2009 23:56 ~~ Clearer.

  • What is the best way to run two process in one VI

    Hi all...
    I'm trying to run two process in the same VI at the same time, which do different operations.
    One loop collect data from COM port, the other loop collect data from sound card. And two process should work independently.
    So can I simply put two while loops in the VI?
    The attachments are my VIs. 
    Thank you!!
    Attachments:
    AC_Radar_Receive.vi ‏81 KB
    RadarAudioPlug.vi ‏435 KB

    You haven't said what your long term goal is, but putting two loops in the same VI that are doing different things is a poor design choice. The problem is that it limits your options for reusing or expanding your code. Queues, events and notifiers all work equally well whether the processes are in a single VI or spread across a dozen VIs.
    Mike.. 
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Best way to update java w/ zen

    Hi all: I have been working on a method of pushing out a
    java update via zenworks. However I keep running into
    issues. My method is very simple: either copy the exe down
    to the server or call it off of a server, then start it with
    the /s switch. However this method fails as several java
    dependencies prevent the installer from completing. In the
    past I have use snappshot but that limits you to a specific
    version to version upgrade whereas using the exe/silent
    method does not.
    I am curious how others update java (jre) via zen? Thanks,
    Chris.

    The switch is /qb, not /bn
    >>> On 11/9/2009 at 9:43 AM, in message
    <4AF7E42E.CE15.0032.0@N0_$pam.vrapc.com>,
    Chris<cmosentine@N0_$pam.vrapc.com> wrote:
    > Jason. Thanks for the reply. I did try this method as
    > well
    > but for some reason the msi would fail with a "could not
    > find file..." error. And yes all the files (msi and
    > cab)
    > were in the same directory. I did find a workaround by
    > passing the executable "/bn" which is a switch for the
    > encapsulated msi file. That worked.
    >
    > Chris
    >
    >
    >
    >>>> On 11/9/2009 at 9:17 AM, in message
    > <kwVJm.1394$[email protected]>,
    > Jasonh<[email protected]> wrote:
    >> I download the offline installer, then double click to
    >> begin the
    >> installation. When the "Welcome screen appears, DO NOT
    >> click next. Go to
    >> "C:\Documents and Settings\[username]\Application
    >> Data\Sun\Java\jre1.6.0_XX\. Grab the msi and other
    >> files, copy then to the
    >> server and from there I make my mst. Then create your
    >> distribution job in
    >> zen and you should be close to being done.
    >>
    >> Jasonh
    >>
    >>
    >> "Chris" <cmosentine@N0_$pam.vrapc.com> wrote in message
    >> news:4AF7C8E7.CE15.0032.0@N0_$pam.vrapc.com...
    >>> Hi all: I have been working on a method of pushing out
    >> a
    >>> java update via zenworks. However I keep running into
    >>> issues. My method is very simple: either copy the exe
    >> down
    >>> to the server or call it off of a server, then start it
    >> with
    >>> the /s switch. However this method fails as several
    >> java
    >>> dependencies prevent the installer from completing. In
    >> the
    >>> past I have use snappshot but that limits you to a
    >> specific
    >>> version to version upgrade whereas using the exe/silent
    >>> method does not.
    >>>
    >>> I am curious how others update java (jre) via zen?
    >> Thanks,
    >>> Chris.
    >>>
    >>>

  • Best way to learn Java. Free resources online?

    Hello. I would like to start to learn Java but have no programming background except for Visual Basic and the basics of PHP. I started to learn about a week ago and now have a good understanding of some of the basic concepts, such as the IF, SWITCH, LOOPS, PRINTLN, ect. I am very interested in developing applications for the Blackberry and was wondering where I should start and what I should learn. Must I learn the entire Java programming language to start to develop mobile applications? Are there any free resources on the Sun Java website that would be able to help me learn?
    Thank you
    Edited by: n3xtgen on May 20, 2010 12:27 PM

    n3xtgen wrote:
    Must I learn the entire Java programming language to start to develop mobile applications?Depends on what you mean by "entire Java programming language". You should probably have a solid understanding of the language and concepts before attempting mobile development.
    The Java language itself is the same when developing for mobile devices (except you may be forced to rely on an older version of the language). But debugging/deployment/running your code becomes more complicated as soon as you target mobile devices.
    Therefore I suggest you take some time to learn "normal" Java development. It will definitely pay of in the long run.
    Are there any free resources on the Sun Java website that would be able to help me learn?There are [the tutorials|http://java.sun.com/docs/books/tutorial/]. They are pretty useful.

  • Best way to implement app wide process

    I am working on an application that has a list of art work in an sql report.. I want to be able to add each piece to a collection of items (which is stored in a table), so I added another column to the sql report to store the id of the art work. I am just wondering what is the best way to implement the process to insert the item to the collection of items. Since I want to do this from multiple pages - link from art work sql report; link from the edit page for a particular art work; and on the artists page where there is also an sql report, I thought it may be best to have an application process, to save duplicating the process on multiple pages.. however I don't think there's a way to pass the id of the item to the application process? as I was thinking best to have the application process conditional based on request, and then have the link as a doSubmit().
    So is it best just to have the link redirect to the same page, passing the id of the item, and then having a process that runs before header that inserts the item, then assigning the item to NULL?
    Thanks in advance,
    Trent

    Daniel:
    Thanks for the info. I have found that the IFRAME works nicely for some applications,
    however, some applications I want to re-write the front end to look better in
    the portal rather than screen scrape.
    Thanks for the help
    Ryan
    "Daniel Selman" <[email protected]> wrote:
    Ryan,
    Check out the thread (a few days old) titled "Different ways of creating
    portlets".
    Sincerely,
    Daniel Selman
    "Ryan Richards" <[email protected]> wrote in message
    news:3d2eda12$[email protected]..
    I have a few existing applications that I need to port over to portletsin
    Weblogic
    Portal 4.0. One application is a servlet based web application witha few
    html front-end
    screens. I am trying to determine how to do this in the best way. Ihave
    noticed
    that portlets behave differently inside the portal than do stand-aloneweb
    apps.
    Any help would be appreciated.
    The other web application is the Microsoft Outlook Web Access. (Thisone
    is going
    to be difficult because it is actually an ASP app. I dont know if thisis
    possible
    without building some proxy code between bea and iis.)
    Thanks
    Ryan

  • Best way to work with multiple photograph angles?

    We are going to be taking 360 degree view photography shots of certain objects and placing these objects on to different backgrounds so the shots will look something like this:
    We expect to have about 20 shots of each object and about 5-10 objects per photoshop file. So basically these will be single images all taken at different angles in which we will also be clipping off the background and placing them on transparent layers so that they can be overlayed onto different backgrounds.
    I'm wondering what would be the best way to streamline this process. We need to be able to pick the correct shot at the right angle to fit the perspective of the background, once we do we will only be using that one image and all of the angles will not need to be used.'
    Does anyone have any suggestions? I've considered creating folders for each object and a different layer under each folder for each angle/shot, however I think that may be a bit tidious to find the right angle. I've also considered creating some kind of an animation so I can scroll through the timeline and the images change in order as if the object was actually spinning in a 3D/360 view like this: http://3dbin.com/public/zummarva but im not sure if that will work or if it would make the photoshop file very big. Ideally I would also like to keep the photoshop files as small as possible.
    I'm not sure if it is possible to use photoshops 3D plugin so the images can be rotated as if it were a 3D object?
    Thanks

    Have you looked into using the  Flex Component Kit for Flash?
    http://blog.flexexamples.com/2007/09/02/installing-the-flex-component-kit-for-fl  ash-cs3/
    http://opensource.adobe.com/wiki/display/flexsdk/Flex+Component+Kit+for+Flash
    http://www.webkitchen.be/2008/12/12/video-tutorial-make-flex-components-with-fla  sh-cs4/
    If  you want to use components for Flex 4 using Flash CS4+ you will probably want to  use the latest MXP file here:
    http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/flash-integ  ration/

Maybe you are looking for