Kill/stop hung thread to generate an exception

In production certain requests cause the thread executing them to hang. We are unable to reproduce that problem outside of production. One thought I had was to call stop on the thread executing that request which should cause a ThreadDeath which should be logged by our application so I could hopefully find the source of the problem. I made a way to call stop on a Thread and that seems to cause the Thread to die on my machine but not production. Any suggestions on that tactic or on a better tactic to use?

See http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20599112.html for the resolution.

Similar Messages

  • Create Infinite number of Threads w/unique names, how do I kill/stop one?

    I am new to Java, so please excuse my code if it is not moving and profound :0)
    I'm just glad it 'works'!! no, really!!
    Problem:
    I use the below piece of code to create 100's of
    timers(threads)..all with different names and different
    sleep values.
    I need to add the ability to 'kill'/'stop' a specific timer.
    How do I reference it?
    How do I write the code so I 'kill'/'stop' the right one?
    Can I do it based on the timers name?
    I am aware that I need to add
    while (condition) {
    in the run method....I'm just a little
    confused about how I change the
    condition for a specific thread.
    My java code:
    1. create a thread (I issue it a name and a 'sleep' time)
    2. when the thread wakes up, it:
    (a) makes a call to the database and executes a
    database procedure (the timer name is passed
    in as a variable to the database procedure)
    Any help is appreciated!
    ------1. BEGIN-----Create a new Thread----------------------------------------------
    public void StartThread (String thisTimerName, int thisInterval) {
    new SimpleThread(thisTimerName, thisInterval).start();
    -------1. END----------------------------------------------------------------------------------
    -------2. BEGIN-----Code that creates and starts the new Thread---------------
    public SimpleThread(String str, int newInterval ) {
    super(str);
    Interval = newInterval;
    public void run() {
    try {       
    sleep(Interval);
    catch (InterruptedException e) {
    TimerName = getName();
    insertIntoTimers_Expired(TimerName); //this method makes a connection
    //to the db, and calls a database
    //procedure passing in the timers name
    --------2. END ------------------------------------------------------------------------------

    warnerja-
    first, thanks for a reply!!
    Q:
    how would I correlate the timer I want to 'kill/stop' with it's assigned 'object reference'?
    Say, for example, I create 4 timers:
    LindasTimer, 2000
    JimsTimer, 43000
    SallysTimer, 8000
    JimsTimer, 75000
    Now, a little while later, I decide I want to 'kill/stop' JimsTimer(75000) before it expires/wakes up from sleep.
    Thanks!

  • How to stop/kill/interrupt a thread stuck on reflection method invoke

    Hi all,
    I have a thread that loads some class using reflection and invokes a method in it.
    I want to be able to stop that thread if needed by the user.
    For some reason, interrupt on that thread doesn't do anything - thread is still inside the invoke call.
    Is there any way to stop it?

    The only really safe way to have isolated code is to a seperate process you can kill.
    I wouldn't suggest using Thread.stop unless you have to, but that may be the case here. Stopping the thread this way might be worse than just discarding the Thread and moving on. (depending on what it is doing) i.e. another option is to ignore the thread and hope it doesn't matter. ;)
    However, before you do that I suggest you call Thread.getStackTrace() and log it. This can be useful in diagnosing WHY your thread needed to be kill and possibly give you a chance to fix it next time.

  • Thread question - unknown method exception!?!

    I am using the following code:
    public void killAnimal(Animal a) //Animal extend Thread
    a.stop();
    a.destroy(); //unknown method exception at this line!
    Basically a thread sends another thread into this method (to kill the Animal/thread when it eats it), but i get an unknown method expection and both threads stop updating
    Any advice

    i have recompiled it. And .destroy() is a built
    method within Thread class is it not?
    And my class EXTENDS Thread so it automaticaly has
    s access to the methods present in the Thread class
    right?. And the fact it compiles and runs means the
    method is detected. Its only when it gets to that
    point that it outputs the exception.Yes but that really wasn't clear from your post. And the name of the class("Animal") is misleading as well.
    The Thread.destroy() method specifically throws the NoSuchMethodError.
    It probably does that because there is no other appropriate unchecked error, although UnsupportedOperationException might be more appropriate.
    >
    Do i need to use .destroy()? Would using .stop() be
    efficient enough? or would that thread still be
    suckin up memory and other system resources?Until the run() method exits the thread exists. How you stop it other than that does not have any impact.

  • How to stop the thread?

    Hi,
    How to stop the thread in java. This is my program.
    import java.net.InetAddress;
    public class ThreadPing extends Thread {
         ThreadPing(String pingIP)
              super(pingIP);
              start();
         public void run()
              try
              String pingIP = Thread.currentThread().getName();
              InetAddress inet = InetAddress.getByName(pingIP);
              Boolean get=inet.isReachable(1500);          
              if(get==true)
                   System.out.println(inet.getHostName());               
              }catch(Exception e)
         public static void main(String args[])
              for(int i=1;i<=100;i++)
                   String pingIP = "192.168.1."+i;
                   ThreadPing tp = new ThreadPing(pingIP);
    Thanks in advance.

    The simplest way to stop all the thread is to make all thread daemons and exit the program when you want them to stop.

  • Common Language Runtime Debugging Services Application has generated an exception that could not be handled

    Our custom got an error when startup our .NET windows form application.
    XXXXX.exe - Common Language Runtime Debugging Services
    Application has generated an exception that could not be handled
    Process id=0x654(1620), Thread id = 0x5b0 (1456)
    Click OK to terminate the application
    Click CANCEL to debug the application
    If they click on "CANCEL" then following error message appears:
    Registered JIT debugger is not available. An attempt to launch a JIT
    debugger with the following command resulted in an error code of 0x2(2)
    Please check the computer settings
    cordbg.exe !a0x654
    Click on Retry to have the process wait while attaching a debugger
    manually.
    Click on Cancel to abort the JIT debug request
    We can not duplicate this problem in our development environment and test environment. So, we ask them to uninstall application, .NET Framework 1.1 and resinstall .NET Framework 1.1 and application. They still got same error. We further ask them to install .NET Framework SDK 1.1. They got some detail error message.
    [thread 0x840] Thread created.
    Unable to determine existence of prolog, if any
    [thread 0x188] Thread created.
    [thread 0xba8] Thread created.
    [thread 0x840] Unhandled exception generated: <0x00c0344c> <System.IO.FileNotFoundException>
     _fileName=<null>
     _fusionLog=<null>
     _className=<null>
     _exceptionMethod=<null>
     _exceptionMethodString=<null>
     _message=<0x00c04cc8> "The specified module could not be found."
     _innserException=<null>
     _helpURL=<null>
     _stackTrace=<0x00c04d2c> array with dims=[156]
     _stackTraceString=<null>
     _remoteStackTraceString=<null>
     _remoteStackIndex=0x00000000
     _HResult=0x8007007e
     _source=<null>
     _xptrs=0x00000000
     _xcode=0xe0434fd
    Thread 0x840 R 0x00000000: <unknown>
    <cordbg>
    Looks like the problem is casued by missing component. But we don't know which component missing and how to find it. Is there anybody can give us some clue what we need to check next and what tool we can use to detect missing component.
    Thanks!!!!

    I tried Dependency Walker in our development environment, looks like it's useless for .NE T Window Form application, the result I got is like bellow,
    XXXXX.EXE
        MSCOREE.DLL
            KERNEL32.DLL
            USER32.DLL
            ADVAPI32.DLL
            SHLWAPI.DLL
            URLMON.DLL
            VERSION.DLL
    I know we used some other DLL like Mirosoft Office Object Library, but MSCOREE.DLL (.NET Runtime Engine) covered them. Any other idea? Thanks!!!!

  • Stopping a Thread in Infinite Loop

    I've read several articles on how to stop Threads, and all of them point to using Thread.interrupt(). The problem right now is what happens when the thread is in an infinite loop. For example:
    class A implements Runnable
        public void run()
            while(!Thread.currentThread().isInterrupted())
                  while(true);
    //in other class's main method:
    Thread a = new Thread(new A());
    a.start();
    a.interrupt();The a.interrupt() call only sets the isInterrupted flag in Thread, but it does not terminate the thread as a.stop() would. However, stop() throws a ThreadDeath exception that I would not want to have to deal with. Is there any way to stop this infinite loop thread safely?
    Thanks in advance!

    No need to get snitty. You certainly did not make clear that you are not a newbie at programming. Plenty of newbies who barely have a grasp of the language fundamentals post thread questions here. I thought I did address the question at hand. It seems I misunderstood what you were asking.
    The only way to safely stop that inner loop is like so: while (...) {
       while (!done) {
    }where done is volatile, or all access to it is sychronized on the same lock (meaning you'd sync the !done check above as well).
    If you can't do that, and it's stuck at while (true) and you can't modify the body of the inner loop to check done, then you're SOL.
    (I suppose it's conceivable that 1.6 or 6.0 or whatever it's called will introduce some new safe way to stop that thread, but I haven't heard anything about it.)

  • Killing a Swing thread

    Hello,
    How can I kill a Swing thread? For example the program below would never exit. Sure you can type System.exit(0) which would exit anything, but what are the other solutions?
    I tried putting chooser = null;
    System.gc();in the end of main() but this won&#8217;t work.
    To formulate my question better - how would I kill a thread I do not have complete command of (i.e. I can&#8217;t do usual do/while thread stopping)?
    Big thanks in advance.
    public class SwingLiveTest{
        public static void main(String[] args) {
            JFileChooser chooser = new JFileChooser();
            if (chooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) return;
            File file = chooser.getSelectedFile();
            System.out.println(file);
            /*chooser = null;
            System.gc(); */

    You can't kill any Thread like this, at least not those where there is no method to call.
    It is possible to cause a Thread to stop, call the stop method, however this is not the recommended approach for very good reasons (Read the JavaDocs for java.lang.Thread.stop() method to see why.
    It should be possible, once you have obtained a reference to the Thread you wish to stop, to call interrupt() on that Thread.
    This is not guaranteed to work because you are dependent on the implementation of the Thread class you are manipulating or the Runnable that the Thread instance is currently running.
    There may be classes in the com.sun packages which can aid you with this problem, this is where Sun usually sticks undocumented implementation however these packages are not officially supported and there is no guarantee that classes you use in one VM are available in another, in particular when the VM you are using is not a Sun VM.

  • Application has generated an exception that could not be handled

    my add on works fine on some PC's but on one particular one keeps crushing giving
    Application has generated an exception that could not be handled
    Process id =0x147c(5244), thread id=0x1478 (5240)
    or
    "Incorrect Connection string for Add on"  messages
    After browsing net I found solution to my problem therefore I have decided to post it here, so those who will hit it could find the answer.
    If you get this error, you will need to adjust the .NET security with 'Microsoft .NET Framework Wizards' . As simple as that.
    enjoy
    P.S. I wasted 5 days re-installing software

    Hey Dleksiy,
    Could you tell me how did you(i am expecting steps followed) adjust the .NET security using .net framework wizard my customer is facing the same error message "incorrect connection string for add-on"..
    Thanks in advance
    Regards...

  • FM CS_BOM_EXPLOSION generates an exception NO_SUITABLE_BOM_FOUND

    Hello
    I execute FM CS_BOM_EXPLOSION (get components of material BOM) within my FM. For one of the materials this FM generates an exception NO_SUITABLE_BOM_FOUND (BOM has marked for deletion).
    Execution of FM (code2) stops.
    How to enable to execution of the FM?
    code1
    CALL CS_BOM_EXPLOSION
    code2
    Thanks

    Try this..
    exceptions
       alt_not_found               = 1
       call_invalid                = 2
       missing_authorization       = 3
       no_bom_found                = 4
       no_plant_data               = 5
       no_suitable_bom_found       = 6
       object_not_found            = 7
       conversion_error            = 8
       error_message               = 99 "<<< this helps to capture such exceptions
       OTHERS                      = 9
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  • Stopping a Thread Correctly

    Instead of using myThread.stop()
    I should do somthing like this ... correct?
    //In my Thread Dispatcher Class
    private boolean shouldStop = false;
    private Thread myThread;
    public static void setStopThread(boolean b){
    shouldStop = b;
    public boolean stopThread(){
      return shouldStop;
    public void nullifyThread(){
    myThread = null;
    //In my Thread Class
    public void run(){
    while(!myThreadDispatcherInstance.stopThread()){
      //do some Thread Work
    }//end while
    }//end run method
    myThreadDispatcherInstance.nullifyThread();Will the above code handle everything (aside for the setup and initialization part) to override the depreciation of the Thread.stop() method? Or am I missing somthing?
    oh yea also anywhere I'd need to stop the thread i'd put
    ThreadDispatcherClass.setStopThread(true);

    Looks about right, except that you need to declare setStopThead and stopThread synchronized, in order to force writing to and reading from main memory.
    NullifyThread is almost certainly pointless and unneeded.
    stopThread is a rather poor name. It sounds like it's taking an action, rather than returning a value. shouldStop() or idDone() or something would be better.
    Finally regarding "In my Thread class": Rather than extending Thread, you should implement Runnable. You're not really specializing a Thread's behavior, you're just implementing a unit of work for a thread to run.

  • Stopping a thread from running

    Hai
         I am new to java. It would be helpful for me if someone helps me out in doing this.
         Actually in my program ,I should
    i. Find out whether a particular file exists in the given directory or not.
    ii. If the file doesn't exist, my program should wait for certain timeframe and check for the same file again.
    iii. If the program cannot find the required file within the timeout specified, my application should exit.
         I have done (i) and (ii) using threads. But in the case of (iii), I came to know that stop() method is depricated.
         I am providing my code for a better understanding. Could you please let me know, what would be the best way to stop the thread from running after the timeout is reached in my program?
    Thanx in advance
    import java.io.File;
    public class Fileexists implements Runnable
    static Thread t;
    public static void main(String[] args)
         System.out.println("creation of object");     
         FileExists test = new FileExists();
         t = new Thread(test);
         t.start();
    // run method
    public void run()
         File f = new File("searchfile.txt");
         boolean b = f.exists();
    System.out.println();
    if(b == false)
    System.out.println("Required file doesnot exists");
    try
         t.sleep(20000);
    catch (InterruptedException e)
         // TODO Auto-generated catch block
         e.printStackTrace();
              t.run();
    else
    System.out.println("Required file found");
    } // end of run()
    } // end of FileExists class

    Actually your use of threads is a difference which makes no difference. The JVM starts an initial thread and runs your main(), at the end of which you start a thread and return. So you've just replaced one thread with another. There's no parallel processing.
    The t.run() at the end of your run() method won't work. A particular Thread object can only run once. It will give you an IllegalStateException.
    I can't see how multi-threading will help you with this task at all, all you need is a simple loop with a Thread.sleep in it.
    If you really want to use a separate thread or Timer to implement a timeout (as an exercise) then use Thread.interrupt() to wind up a thread. The looping thread should test with Thread.interrupted() in it's loop condition, if it's in sleep() when interrupted an InterruptedException will be thrown which you should catch and allow to break the loop and let the thread terminate.
    So your loop structure looks like:
    try {
    while(!Thread.interrupted()) {
        ...  do your test
        Thread.sleep(.....);
      System.out.println("Thread terminated by detecting interrupted");
      } catch(InterruptedException ex)  {
         System.out.println("Thread interrupted from sleep");
    You can get the Thread for the main thread simply by storing Thread.currentThread() in a Thread reference.
    I'd suggest using a java.util.Timer to launch your time-out and leave the loop on the main thread started by the JVM.

  • Stopping a Thread (no control on run method)

    Hi,
    How can we stop a Thread like in the following scenario. If we are in the aMethod() and the stopped variable is set to true by some other thread now how can we return from this run method and stop executing the aMethod(). Any tips are helpful.
    public void run()
    if (stopped)
    return;
    someOtherClass.aMethod();
    Thanks

    I miss the scenario here, where a thread is blocked inside a call to some operating system resource (such as accept() or read() or write()).
    In this case an InterruptedException travels like pacman up the stack, until it's caught, and I think that it should be a scenario in all cases, because it can apply to the blocking call (where it applies already), the predictable loop (try { while() { } } catch (InterruptedException ie) { }), and the one-off algorithm, even though in the latter case, if it's extremely important that we know exactly what we were doing when we were interrupted, it's difficult to avoid either a) many try-catch-blocks, or b) a very good way of examining the stack at the moment of interruption.
    This is, in fact, so important, that I would like to urge Sun to change the API for java.lang.Runnable into
    public interface Runnable {
      public abstract void run() throws InterruptedException;
    }Because, in this way, any thread will always have an endpoint. If you choose to rethrow the exception you still mess up the JVM, of course, like it was, causing it to exit. But at least you must provide yourself with the opportunity to let threads not end, or always die softly.

  • How to stop a thread in java 5 for a real-time system??

    Hi,
    In Java 5, thread.stop is deprecated. We need to modify some variable to indicate that the target thread should stop running. "The target thread should check this variable regularly........"
    We are currently developing a simple real-time operating system using the basic features of java. It is running on top of SunSPOT (JAVA5). My question is I need to stop a thread in a scheduler loop of a real-time operating system. We cannot check it regularly. Otherwise it is not a real-time operating system.Is there anyway else to do this?
    Thanks,
    Qing

    That's rather hard to answer. You say you are writing in Java, but you're writing an OS. BUt what's executing the Java - you need a VM of some form. Is that a real-time or non-real-time VM? How it does things ultimately controls how effectively you can do what you are trying to do.
    The simple answer is that Thread.stop() is deprecated and that it will not stop a thread in all situations anyway - eg trying to acquire a monitor lock. But all Thread.stop does is make an exception pending on the thread, and as the thread executes it polls to see if there is an exception pending. When this happens depends on the VM: it might be after every bytecode; it might be when the thread transitions states (eg thread-in-java, thread-in-vm, thread-in-native) - it all depends. But it is polling - just the same as checking that variable - it's just implicit in the VM rather than explicitly in your code.**
    The RTSJ adds a new form of asynchronous termination requests through the AsynchronouslyInterruptedException (AIE). But it only affects code that explicitly declares that it expects AIE to occur, and there are also deferred sections where the AIE will remain pending. Writing code that can handle AIE is very difficult because the normal Java rules are "bent" and finally blocks do not get executed inside AIE-enabled code.
    So as I said this is very hard to answer, it really depends what exactly you are running on and what you are trying to achieve.
    ** Note: some people used bytecode rewriting tools to add this kind of polling as a post-processing step. Perhaps that is something you might be able to do too.
    David Holmes

  • Moving initializations to a method generates nullpointer exceptions

    Hi,
    I'm trying to tidy up some code in a class that extends JMenuBar, but I keep getting NullPointerExceptions. Honestly, I have no idea why the compiler doesn't recognized the objects I have just initialized.
    See this:
    (a couple more questions added in comments)
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.util.ArrayList;
    import javax.swing.*;
    public class MyMenuBar extends JMenuBar implements ActionListener
         private JMenuItem exitItem, newGameItem, stopGameItem;
         private JRadioButton shopping, selling, basic, keyboard;
         private JMenu editMenu, playingModeMenu;
         public MyMenuBar(MyFrame myFrame)
              // is there any way I can pass a mnemonic to a method in order to cut a few lines here too?     
              JMenu fileMenu = new JMenu("File");
              fileMenu.setMnemonic(KeyEvent.VK_F);
              this.add(fileMenu);
              editMenu = new JMenu("Edit");
              editMenu.setMnemonic(KeyEvent.VK_E);
              this.add(editMenu);        
              JMenu helpMenu = new JMenu("Help");
              helpMenu.setMnemonic(KeyEvent.VK_H);
              this.add(helpMenu);
              //First Menu
              // can I pass accelerators as well? How?
              this.addJMenuItem(newGameItem, "Start new game", true, fileMenu);
                    //  below is where the exception is launched
              newGameItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));     
              this.addJMenuItem(stopGameItem, "Stop game", false, fileMenu);
              stopGameItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK));          
              //Second Menu
              playingModeMenu = new JMenu("Playing mode");
              ButtonGroup playingModeGroup = new ButtonGroup();
              this.addRadioButton(shopping, "shopping", true, playingModeGroup, playingModeMenu);
              this.addRadioButton(selling,"selling", false, playingModeGroup, playingModeMenu);
              editMenu.add(playingModeMenu);
              JMenu interactionModeMenu = new JMenu("Interaction mode");
              ButtonGroup interactionModeGroup = new ButtonGroup();
              this.addRadioButton(basic,"Basic", true, interactionModeGroup, interactionModeMenu);
              this.addRadioButton(keyboard,"Keyboard", false, interactionModeGroup, interactionModeMenu);
              editMenu.add(interactionModeMenu);                         
         private void addRadioButton(JRadioButton radioButton, String text, boolean isSelected, ButtonGroup group, JMenu menu)
              radioButton = new JRadioButton(text);
              if (isSelected)
                   radioButton.setSelected(true);
              group.add(radioButton);
              radioButton.addActionListener(this);
              menu.add(radioButton);
         private void addJMenuItem(JMenuItem item, String text, boolean isEnabled, JMenu menu)
              System.out.println(text);
              item = new JMenuItem(text);
              item.setEnabled(isEnabled);
              item.addActionListener(this);
              menu.add(item);
              System.out.println(text);
         public void actionPerformed(ActionEvent e1)
    }Thanks!

    These declarations have not been instantiated and so are all null:
        private JMenuItem exitItem, newGameItem, stopGameItem;
        private JRadioButton shopping, selling, basic, keyboard;When you send the reference to a method it shows up as null. Trying to reference
    a variable whose value is null generates the exception. Either instantiate the
    reference before sending it or try one of the two other approaches shown below.
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import java.util.ArrayList;
    import javax.swing.*;
    public class MyMenuBarRx extends JMenuBar implements ActionListener
        private JMenuItem exitItem, newGameItem, stopGameItem;
    //    private JRadioButton shopping, selling, basic, keyboard;
        private JMenu editMenu, playingModeMenu;
        public MyMenuBarRx()
            // is there any way I can pass a mnemonic to a method
            // in order to cut a few lines here too?     
            JMenu fileMenu = new JMenu("File");
            fileMenu.setMnemonic(KeyEvent.VK_F);
            this.add(fileMenu);
            editMenu = new JMenu("Edit");
            editMenu.setMnemonic(KeyEvent.VK_E);
            this.add(editMenu);        
            JMenu helpMenu = new JMenu("Help");
            helpMenu.setMnemonic(KeyEvent.VK_H);
            this.add(helpMenu);
            //First Menu
            // can I pass accelerators as well? How?
            newGameItem = addJMenuItem("Start new game", true, fileMenu);
            //  below is where the exception is launched
            newGameItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
                                            ActionEvent.CTRL_MASK));     
            stopGameItem = addJMenuItem("Stop game", false, fileMenu);
            stopGameItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W,
                                            ActionEvent.CTRL_MASK));          
            //Second Menu
            playingModeMenu = new JMenu("Playing mode");
            ButtonGroup playingModeGroup = new ButtonGroup();
            this.addRadioButton("shopping", true, playingModeGroup,
                                 playingModeMenu);
            this.addRadioButton("selling", false, playingModeGroup,
                                playingModeMenu);
            editMenu.add(playingModeMenu);
            JMenu interactionModeMenu = new JMenu("Interaction mode");
            ButtonGroup interactionModeGroup = new ButtonGroup();
            this.addRadioButton("Basic", true, interactionModeGroup,
                                 interactionModeMenu);
            this.addRadioButton("Keyboard", false, interactionModeGroup,
                                 interactionModeMenu);
            editMenu.add(interactionModeMenu);                         
        private void addRadioButton(String text, boolean isSelected,
                                    ButtonGroup group, JMenu menu)
            JRadioButton radioButton = new JRadioButton(text);
            if (isSelected)
                radioButton.setSelected(true);
            group.add(radioButton);
            radioButton.addActionListener(this);
            menu.add(radioButton);
        private JMenuItem addJMenuItem(String text, boolean isEnabled, JMenu menu)
            System.out.println(text);
            JMenuItem item = new JMenuItem(text);
            item.setEnabled(isEnabled);
            item.addActionListener(this);
            menu.add(item);
            System.out.println(text);
            return item;
        public void actionPerformed(ActionEvent e1)
        public static void main(String[] args)
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setJMenuBar(new MyMenuBarRx());
            f.setSize(200,200);
            f.setLocation(200,200);
            f.setVisible(true);
    }

Maybe you are looking for

  • Payment Terms

    Hi, Can anyone explain me how to change the payment terms of the PO. What is the configuration path. what is the impact in changing the payment terms from one to the other . Where in the PO we can see this. Thanks in advance.

  • G5 Quad Pro Tools HD 7 System Crashes on Launch of Logic Pro 7.  WHY?

    Updated to Logic Pro 7.1.1 Program gets to Launching DAE on the startup screen and then unexpectedly quits. G5 Quad   Mac OS X (10.4.8)   Pro Tools installed G5 Quad   Mac OS X (10.4.8)   Pro Tools installed

  • How to view instagram download in itunes

    how to view instagram download in itunes

  • Dashboard prompts in multiple lines

    Hi experts i have more than 6 prompts on my report and i want them to show in two lines rather than on one line as it is giving horizontal scroll bar, i have tried looking into portalbanner.css but not of much use... can you help me how to do that...

  • Creative Cloud Lightroom recognition

    I was using Lightroom 5.7. 2 days ago I bought CC plan and downloaded Lightroom CC and Photoshop CC. Unfortunately although I can see in Lightroom preferences that it recognise me as "subscribed" still program opens in "Trial Mode" or asking Licence