Creating Threads : New thread doesn't run( )

Hello !
Can anyone please check the error in this code. It does not start the new thread.
God bless you.
NADEEM.
// Create a second thread
class NewThread implements Runnable {
  Thread t ;
  NewThread() {
  try {
   t = new Thread(this.t , "New Thread");           // Create a new, second thread.
   System.out.println("Child Thread : " + t);
   t.start();                                        // start the thread.
   }catch (IllegalThreadStateException e) {
     System.out.println("Exception : " + e);
  //Entry point for the second thread.
  public void run() {
   try {
    for(int i = 5; i > 0; i--) {
    System.out.println("Child Thread  : " + i);
    Thread.sleep(500);
   }catch (InterruptedException e) {
     System.out.println("Child Thread interrupted ");
   System.out.println("Exiting Child Thread... ");
class CreatingThread {
public static void main(String args[]) {
   new NewThread();    // Create a new Thread
   try {
    for(int i = 5; i > 0; i--) {
     System.out.println("Main Thread : " + i);
     Thread.sleep(1000);
   } catch (InterruptedException e) {
     System.out.println("Main Thread interrupted ");
   System.out.println("Exiting main thread ");

are you sure Nadeem...i compiled and ran the below code and it works as you designed it...what errors do u get when u try to compile?...
class NewThread implements Runnable {
  Thread t ;
  NewThread() {
  try {
   t = new Thread(this , "New Thread");           // Create a new, second thread.
   System.out.println("Child Thread : " + t);
   t.start();                                        // start the thread.
   }catch (IllegalThreadStateException e) {
     System.out.println("Exception : " + e);
  //Entry point for the second thread.
  public void run() {
   try {
    for(int i = 5; i > 0; i--) {
    System.out.println("Child Thread  : " + i);
    Thread.sleep(500);
   }catch (InterruptedException e) {
     System.out.println("Child Thread interrupted ");
   System.out.println("Exiting Child Thread... ");
class CreatingThread {
public static void main(String args[]) {
   new NewThread();    // Create a new Thread
   try {
    for(int i = 5; i > 0; i--) {
     System.out.println("Main Thread : " + i);
     Thread.sleep(1000);
   } catch (InterruptedException e) {
     System.out.println("Main Thread interrupted ");
   System.out.println("Exiting main thread ");
}

Similar Messages

  • How can I create a new thread to run PulseOutput.VI

    Hi:
      I use NI-94729(cDAQ system) to generate pluse and want to output  pulse continuously and to check the pulse is 500Hz.
      In TestStand, the steps as follow:
      1: Call PulseOuput.vi to generate 500Hz pulse, VI use Finite Mode to generate pulse.
      2: Verify the pulse is 500Hz.
     Howerver, after the first step finishes, the pulse output stops, te 2nd step is failed. If a Continuous Mode is used in PulseOuput.vi to generate pluse, the 1st step can't finish.
    Thanks a lot!

    Hello MotionBoy,
    There are two ways to go about creating a new thread to run a step.  The first is to create a new sequence, into which you put the LabVIEW step you want to run and any other steps that may go along with it.  Then use a sequence call step to call this newly created sequence.  Set the Execution Options of the Sequence call step to 'Use New Thread.'  This will allow you to run a set of steps in a new thread, not just a VI.  The second method, which is only available for a LabVIEW VI, is to use the “Run VI Asynchronously” step.  This can be accessed if you right-click within your sequence and select Insert Step » LabVIEW Utility » Run VI Asynchronously.  This step will allow you to call a VI and have it automatically open in a new thread.  You can further customize this step by opening the configuration menu in the Step Settings.
    To address the current behavior of your steps I would like to know if the modules in steps 1 & 2 pass data between them or it would be desirable for them to do so?  If so you are going to need a more complex synchronization structure such as TestStand/LabVIEW queues. There is a simple example you may want to look at in the TestStand examples, under the Synchronization folder that demonstrates how to use queues. Otherwise the above solution should be all you need.
    John B.
    Applications Engineer
    National Instruments

  • Executor vs Thread for creating a new thread

    Hello,
    It's a little question :
    which is the best or most preferable way to create a new Thread?
    Thread t = new Thread(this);
    t.start();or using the Executor class ?
    Executor.execute(Runnable r)
    new Thread(r)).start();Thanks in advance!

    Hi Kolarius,
    If you only have one thread to run, the first solution is sufficient as long as you need the runnable executed by the thread being the caller of the thread itself.
    In the second example, you start a new thread apart from the caller. You can have the same result without using an executor.

  • Limited subject characters count when creating a new thread in Portal 7.3 forums

    Hello,
    i was wondering if and how you can change the max. characters for the subject when creating a new thread in Portal 7.3 forums.
    It seems like the character count is limited to 75 characters for subjects.
    I didn't find any suitable property, in the forums admin console, for that issue.
    Thanks

    Hi Andrzej,
    Have faced a similar issue in EP 7.01. It was due to the missing Super Admin access - Save was clocking & timing out.
    Upgraded the Admin permissions and this issue was resolved.
    Hope this helps.

  • Does JDialog setVisible create a new threaD?

    I am having a problem with my program and it seems that it may be because my call to JDialog setVisible is creating a new thread. In my program I have a JDialog which is a creation wizard that puts some specific files in the specified directory. After this is done I try and zip up the contents and bundle the zip file with some other files. My problem is that if I don't place a dialog after my call JDialog setVisible() then not all the right files will be in the newly created zip. It seems to me this is likely happening because the call to setVisible is creating a new thread and operation is continuing before the wizard is done placing all the right files in the directory. Does this make sense? Does setVisible create its own thread?

    In the future Swing related questions should be posted in the Swing forum.
    No a new thread is not created. setVisible() displays the dialog. If the dialog is modal then statements after the setVisibile are not executed until the dialog is closed. If the dialog is not modal, then the statements execute right away.

  • How to create a new thread in display function -----Java OpenGL

    use netbean 6.1 to do this work.
    public void display(GLAutoDrawable drawable) {
          GL  gl = drawable.getGL();
          //I want to create a new thread here to draw an object
          Thread dt = new Thread(new DrawThread(gl,2),"Thread0");    //create a thread,DrawThread is a class I define
          //but it failed when compiling
          //are there any other ways or how to improve my method?
    }I want to do like this because I do not like to block the main thread when it is drawing an object

    Well, the autocode in your application is maintained by your autocode module, any attempt at changing it will result in having it reset back to the original autocode--that's one of the gotcha's about using autocode.
    Since it looks like you may not have the skills to do what you are asking and relying on the autocoder, you should probably start here:
    [Java Tutorial|http://java.sun.com/docs/books/tutorial/]
    And stay there until you are comfortable coding for yourself.

  • Cannot reply to forum post without being registered; but can't register without creating a new thread

    I wished to reply to a forum post with new information that will be of relevance to anyone searching for a solution to a particular problem. I did not have a support account with Mozilla. I found that the site would not allow a reply from an unregistered person. Fair enough, but it gives you no way to create an account then reply to the post. The only way you can create an account is by creating a new thread - which is what I am doing now! Crazy or what? It then took about 10 minutes thrashing about on the site to find out how to create an account. Frustrating or what? Thank goodness Firefox itself is built to much higher standards.

    Suggested fix for an admin to apply:
    Replace the text that appears at the bottom of a thread while signed out - "You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet."
    ...with one that reads "You must log in to your account to reply to posts. Please [https://support.mozilla.org/get-involved sign up to contribute], or start a new question, if you do not have an account yet."
    This little seeming catch-22 gave me a chuckle, but I'm glad this thread was already here so that I didn't have to waste space. Someone needs to fix this soon though, lest it put more people off contributing.

  • Group messaging creating a new thread with no one listed in the To: field

    Recently I have had issues with group text where I send a message to an exiting group text thread in the messaging app, and when someone responds from that thread Messages creates a new thread with no apparent sender or anyone listed in the To: field of that message.  Has anyone had or scene this issue?  So far the only solution I have found is to delete both the new thread and the old thread and start the group over again, losing all the group text history from the original thread.   

    Texts are a carrier function
    Are all your group members on iMessage?

  • How to create a new thread/TimerTask in oc4j 10.1.2

    Hi,
    I want to create a TimerTask / Thread in oc4j 10.1.2 so its ejb2.0 no Timer Beans.
    I know its not good to create my own custom TimerTask/Threads inside a container, so i looked and i saw that oc4j 10.1.2 has the notion of "2.9.2 Thread Pool Settings" however this refers only to:
    cite:
    +"The worker thread pool contains worker threads used in processing RMI , HTTP and AJP requests, as well as MDB listener threads. These are process-intensive and use database resources. "+
    but i dont do any rmi/http/ajp/mdb i just want a simple java TimerTask or a Thread.
    Can anyone assist me how to achieve this creating of timerTask / threads with oc4j 10.1.2 ejb2.0?
    Thanks

    Hi
    Since the error points to the unavailability of the driver class,can you double check your library claspath entries again.
    I just tried a DB2 connection using the following properties and the connection went through fine:
    Driver class name: com.oracle.ias.jdbc.db2.DB2Driver
    URL: jdbc:merant:db2://<host_name>:50000;DatabaseName=SAMPLE
    Thanks
    Prasanth

  • Aperture on the new Imac doesn't run !!!!

    I just got my new intel Imac, gess what Aperture doesn't run on it !! After installation i got following message :
    Your computer does not meet the minimum hardware requirements for Aperture.
    What do you need more to run it ???
    Cazn anyone help me ??

    Are you saying the installer won't work on an Intel system? The notice on the update says it will be available via software update. For this to work, I have to install it first before it can be updated.
    Aperture is a free update to UB when they are
    available
    even if you try a Manual install it WILL NOT WORK
    it is NOT compiled for the intel processor and
    Rosetta only emulates for simple programs
    IT WILL NOT WORK
    wait untill the new update is out feb/march ish
    DAVE

  • I can't create a new mailbox, doesn't show up

    When I create a new mailbox, it does not show up in the left column of mail boxes.  I read in another email on the same topic that the newly created mailboxes (I created or tried to create five or six of them that all never showed up), that they are "hidden" and that I should hover over "on my mac" and a menu will ask me to unhide mail boxes.  But I do not see the phrase "on my mac" anywhere on my mailbox list.  How do I create a mailbox, or where are the ones that I did create and are not visible?  Thanks.

    I did not find any evidence of the mailboxes on the google site.  Also, I'm new to google mail, but though I couldn't find a way to create an actual mail box in mail, there were "labels" and under the menu of all the different categories they were all checked to "show on imap."    This google account is set up on my mac mail, as I guess you might be able to see that and I do receive my employers mail from google right to my mac.  This iMac is actually my second older one that sits in my kitchen for entertainment and downstairs access, so I don't care a whole lot that I can't resolve this, though I still would like to figure it out if possible, where the created mailboxes are going that is......I just went up to my main mac (new 27").  "On My Mac" shows and when you hover over it you can "hide" it.  This doesn't seem to happen on my downstairs mac with the problem.  I can't make "on my mac" appear when I move my cursor over the mail box menu.  Because this is a secondary computer, I could very well at some wipe out the entire mail and start over, though I'm not sure how to do that being that mail application may not be easy to get back if I delete the entire app? since it's an onboard app that comes with the os?????  Just thinking out loud about what I don't know!

  • Creating a new solution doesn't work

    Hi
    I installed  SolMan 40 / Maxdb / Server 2003 and  I am using IE6
    All fine, no problems.
    after some configuration task (TA: SPRO) I want to create a new solution
    within TA dswp || solution_manager
    Button "Create" and Cancel" are visible
    I entered "Name of the solution" and "language" and press button "Create"
    <b>AND</b> nothing happened !!!
    Even when I press "cancel"
    What I am doing wrong ? any hints ?
    Thanks for help in advance
    Andreas

    Note 1008717 worked for me as well.  Thanks for the help.
    Rex L. Farris

  • My new Dell doesn't run Flash

    I have a Dell XP8500 64 bit running 
    Operating system Windows 7 Professional with Service Pack 1
    Internet Explorer 10, update version RTM(KB2718695)
    My 32 bit Flash Player version  11.6.602.180 does not operate. I simply get a message to install Flash.
    I have no interest in using Chrome.

    Try
    http://forums.adobe.com/thread/885448
    http://forums.adobe.com/thread/867968

  • SAP Fiori Error - Create Sales Order app doesn't run after Google Chrome updates

    Hi,
    I have a problem with the create sales order app (ui5_sd_so_cr).
    Everything works fine until Google Chrome browser updates to version 34.0.1847.116 m .
    The create sales order application has an error when i try to checkout the cart.
    This error is in the SalesOrderCreatePriceAndAvailabilityCheck.controller.js and SalesOrderCartDetails.js in this function:
    l.oSOCartModel.refreshSecurityToken(function (a, b) {
            l.oSOCartModel.create("/SalesOrders", m, null, function (c, d) {
                com.sap.kelley.salesordercreate.utils.ModelUtils.updateCartModelFromSimulationResponse(d);
                oSObusyIndicator.close();
            }, function (g) {
                oSObusyIndicator.close();
                var d = g.response.body;
                var f = jQuery.parseXML(d);
                var e = f.getElementsByTagName("message")[0].childNodes[0].nodeValue;
                var c = new sap.m.Dialog({
                    title: sap.ca.common.uilib.message.AlertMessageBoxType.ERROR.title,
                    content: [new sap.m.Label({
                        text: e
                    leftButton: new sap.m.Button({
                        text: l.oBundle.getProperty("XBUT_OK"),
                        tap: function () {
                            if (j) {
                                l._onNavigateBack();
                            c.close();
                c.addStyleClass("sapSOC-SingleButtonDialog");
                c.open();
        }, function (a) {
            oSObusyIndicator.close();
            var b = new sap.m.Dialog({
                title: sap.ca.common.uilib.message.AlertMessageBoxType.ERROR.title,
                content: [new sap.m.Label({
                    text: sap.ui.getCore()
                        .getModel("i18n")
                        .getProperty("ERROR_REFRESH_SECURITY_TOKEN")
                leftButton: new sap.m.Button({
                    text: l.oBundle.getProperty("XBUT_OK"),
                    tap: function () {
                        if (j) {
                            l._onNavigateBack();
                        b.close();
            b.addStyleClass("sapSOC-SingleButtonDialog");
            b.open();
        }, false);
    The error is in the line 07. Cannot read property 'body' of undefined
    Variable g is undefined.
    I tested the application with other browsers (IE, Firefox, Safari) and everything works perfectly. Only Chrome has this kind of problem.
    UISRA
    UISRA017
    100
    0002
    SAPK-10002INUISRA017
    HTML5 Create Order
    System
    SAP_BASIS
    731
    0007
    SAPKB73107
    SAP Basis Component
    GW_CORE
    200
    0006
    SAPK-20006INGWCORE
    SAP GW CORE 200
    IW_BEP
    200
    0007
    SAPK-20007INIWBEP
    Backend Event Provider
    UI5 version 1.16.4
    It 'happened to someone else?
    How can I fix the problem?
    Thank you for your help.
    Regards,
    Nicola

    Few things you can try,
    Upgrade your UI5 library version. Latest is 1.18
    Implement release notes :
    1948368 - Fiori Create Sales Order Wave 1 Common Library Fixes
    1947789 - Fiori Create Sales Order Wave 1 Fixes
    Check if these can be applied or go with UI library update.
    1939288 - Hotfix 1.16.5 for UI AddOn SP06 SC: UI2_SRVC
    Regards,
    Tejas

  • New Thread not Creating a new Process

    When I create a thread and start it, it doesn't make a new process (as in a process that one can see in the Windows Task Manager) . I have another program that does make another process, and I did the exact same code, but this program isn't working right. My class implements Runnable, and I invoke the run method. Can anybody help?
    public void go(String str){          
       Thread thread = new Thread(this,"thread");
       thread.start();
    public void run(){
       new GUI();
    }

    A thread will not create a new process. Actually the
    thread is part of process,. ie.. your JVM process. So
    you can't see each thread in the task manager. All
    the threads will be managed under the JVM processThe only way I can think of to have windows see a second thread would be to call Runtime.getRuntime().exec(command); where command is running java on a program.

Maybe you are looking for

  • Make CP4 run without Adobe Flash Player?

    Howdy, I am unable to open CP4 because my IE8 can't seem to install FP (see previous kave2009 winge re: FP). Is there a way to get CP4 to run w/out Adobe FP? I have original installation CD for CP4. Should I uninstall CP4 and FP and try again using t

  • Does anyone know how to add time using TIME function?

    Hi, I just switched from Excel (lol) and found an error in a key calculation i use. Does anyone know how to automatically add hours to a time? i.e. i have to convert Pacific Time to other U.S. Time Zones so in the past I used this formula in Excel (=

  • Sendaing Email?

    Any suggestion on following: I have a File-XI(BPM)-File. I need to send an email after FTP Thanks

  • Import GP transport package

    Hi, I am trying to import the GP .sda file which was successfully imported during the first import. Somehow the files got corrupted. so i deleted the GP folder from design time .. undeployed and deployed again via SDM but when i try to release the GP

  • Looping through an array

    i need to complete for loop in the method below so that all the elements in the amounts array passed in as a parameter are added up and the total returned: +private double getTotalAmount(double amounts) {+ double total = 0; +for (