How can I kill a OS process

How can I get a handle to a OS process in my java application and then use that handle to kill the process.
Note..that i want handle to a process which has not been started from my java application .

It usually helps when you tell your OS whenever you need information about such an OS-specific issue. On Unix/Linux, you could just use one of Runtime's exec() methods and parse its output to obtain the process ID you are looking for.

Similar Messages

  • How Can I Kill Excel.exe Process After finish my Execution of SSIS Package in Sqlserver2008r2

    Hi !,
          am new for c# and SSIS Package Creation , I am Trying to Read Excel file, and load the value into Sqlserver using SSIS package . My Problem is , After Execution of SSIS package Still Running EXCEL.exe Process in my server. i need to
    kill that process . I post my Code Exactly where am release my excel file object , please guide me where am going to wrong?
    Server Configuration
    OS:windows7
    SqlServer :2008r2
    Framework:3.5
    please give me some suggestion to correct my error .
    Here is My Code:
                Microsoft.Office.Interop.Excel.Application xlApp;
                Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
                Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
                var missing = System.Reflection.Missing.Value;
                xlApp = new Microsoft.Office.Interop.Excel.Application();
                xlWorkBook = xlApp.Workbooks.Open(filename, false, true, missing, missing, missing, true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, '\t', false, false, 0, false, true, 0);
                xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
                Microsoft.Office.Interop.Excel.Range xlRange = xlWorkSheet.UsedRange;
                Array myValues = (Array)xlRange.Cells.Value2;
    int vertical = myValues.GetLength(0);
                int horizontal = myValues.GetLength(1);
                System.Data.DataTable dt = new System.Data.DataTable();
                bool isNameRead = false;
                // get header information
                for (int i = 1; i <= horizontal; i++)
                    string cellValue1 = "";
                    object cellObj = myValues.GetValue(1, i);
                    if (cellObj != null)
                        cellValue1 = myValues.GetValue(1, i).ToString();
                        if (cellValue1 == "Name")
                            if (!isNameRead)
                                dt.Columns.Add(new DataColumn(cellValue1));
                                isNameRead = true;
                            else
                                dt.Columns.Add(new DataColumn(cellValue1 + 1));
                                isNameRead = false;
                        else
                            dt.Columns.Add(new DataColumn(cellValue1));
                // Get the row information
                for (int a = 2; a <= vertical; a++)
                    //string cellrowvalue = "";
                    string isemt = "";
                    object[] poop = new object[horizontal];
                    for (int b = 1; b <= horizontal; b++)
                        isemt =(string) myValues.GetValue(a, b);
                        if (isemt != null)
                            poop[b - 1] = myValues.GetValue(a, b);
                    DataRow row = dt.NewRow();
                    row.ItemArray = poop;
                    dt.Rows.Add(row);
    xlWorkBook.Close(true, missing, missing);
                xlApp.Quit();
                releaseObject(xlWorkSheet);
                releaseObject(xlWorkBook);
                releaseObject(xlApp);
                return dt;
    releaseObject
    private void releaseObject(object obj)
                try
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    obj = null;
                catch (Exception ex)
                    obj = null;
                    MessageBox.Show("Unable to release the Object " + ex.ToString());
                finally
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
    Thanks
    Parthasarathi Purushothaman

    Why are you programmatically opening an Excel sheet in C# instead of using the DataFlow task with an Excel input?
    Since your task is programmatically starting Excel via "new Microsoft.Office.Interop.Excel.Application();", it is your responsibility to stop it.
    Please see "Quit":
    http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.quit(v=office.15).aspx

  • I just created a slideshow dvd in imovie, and when I hit finalize it said that it would take 7 hours to finalize.  I've only had my macbook pro for 6 months, and this is the first imovie I've done...is this normal?  If not how can I speed up this process?

    I just created a slideshow dvd in imovie, and when I hit finalize it said that it would take 7 hours to finalize.  I've only had my macbook pro for 6 months, and this is the first imovie I've done...is this normal?  If not how can I speed up this process?  Thanks in advance for all of your help!

    Hi
    Time needed can depend on several things.
    • less than 5 GB free space on Start-up (Mac OS) hard disk = Redicolous long times AND a DVD that most probably will not work OK
    Medicine - I never go under 25GB free space
    • Use of strange file formats into iDVD - can force it to de-code first then re-encode - this can take long long times
    I use
    Video - StreamingDV as from miniDV tape Cameras - or QuickTime Movies Converted to StreamingDV
    Audio - .aiff 16-bit 48 kHz - (no .mp3, .wma etc)
    • Use of old Mac - My G4 600MHz took about 24 hour per hour movie. my dG5 - about 2 hours per hour (I use Pro Quality encoding)
    • Pro Quality encoding - takes about x2 to process a movie
    Yours Bengt W

  • I click a link but it doesn't open. Instead I get a popup saying "Open the link in a new window," "Open link in a new tab," etc. How can I kill this popup or whatever it is forever?

    I click a link but it doesn’t open. Instead I get a popup saying “Open the link in a new window,” “Open link in a new tab,” etc. How can I kill this popup or whatever it is forever?

    That happens if the server sends the file as text/plain.
    You can see this if you open "Tools > Page Info > General": Content-Type: text/plain
    Files send this way will always open in a tab.
    *https://developer.mozilla.org/Tools/Web_Console

  • How can I stop the extracting process ?

    How can I stop an extracting process it's taking hours and I can't wait much longer, the pause and cross symbols won't work. I think I tried to save it to the wrong place.

    See if using the system task management is able to shut it down.
    PC - Task Manager: (CTRL-ALT-Delete) http://support.microsoft.com/kb/323527
    Mac - Activity Monitor: http://osxdaily.com/2010/08/15/mac-task-manager/
    You can also try shutting down the machine.

  • Every app install results in the "waiting" mode on my home screen.   How can I complete the install process?

    Every attempted app installation results in the "waiting" mode icon on my home screen.   How can I complete the install process?   What am I missing?

    Hi,
    1) Forget downloading the application from the device, and instead download it through iTunes and sync to transfer the application to your iPhone / iPad.
    2) Other way is: Go to Application Settings> Store and tap above the Apple ID to sign out. Restart your iPhone / iPad, go back to Settings> Store and sign. Tap the icon that was waiting to update the application.

  • How can i kill the Adobe Reader session right away?

    Hello
    I have developed an interactive form, my_form. And we launch / render this my_form in (ERP / SAP) application's portal IE browser, well.
    Say, user opened this form, worked on it, submitted (we have our own submit button) and closed the window by clicking the top right corner's X button, but user is seeing stll the red Reader icon on the bottom bar, even thought the user is closed the window completely
    If user try to close this reader red reader icon explicitly, user is getting the other exception popup as Runtime error as described here http://forums.adobe.com/thread/391738
    Hence, am thinking to KILL the reader session right away the moment user closes the window, pls. let me know,
    1) How can i KILL the reader session via JavaScript, is it possible?
    2) if so, what the JS code i need to put and
    3) in which event pls.?
    Thank you

    In to my original posting, am attaching these pics
    On my desktop it looks like below,
    1) Even though user is closing the window but still the reader icon is lying on the bottom
    2) Once user double cliks the above red icon, user is getting below popup
    Thank you

  • How can i view the Streams process through 10g OEM

    I have successfully configured OEM on Oracle 10.1.0.3
    My question is:
    How can i view the Streams processes and queues so that i could monitor its functionality.
    In 9i Java Console OEM I was able to monitor Streams using the <Distributed> tab but I don't find any such option in 10g. Please help.
    Thanks in Advance.
    Regards,
    Raj

    There's a message on the Database Administration page of EM10g.
    "TIP      Use the Enterprise Manager 10g Java Console to manage Streams, Advanced Replication, Advanced Queues, XML Database, Spatial and Workspace."
    At present there is no way through the EM10g Web Interface, and I understand the Java version which comes with 10g doesn't contain any 10g new features.
    So I am still using OEM 9.2 in addition to EM10g
    Thanks,
    Alan...

  • How can i kill a job in BW

    Hi,
    Any budy please help me that how can i kill a background job in BW
    Cheers,
    KGB

    hi u can kill job in SM 37 also.
    also u can cancel in SM50.also use tis link
    How to stop scheduled job in bw.
    Hope it solves your query
    Thanks,
    pathak
    Edited by: npathak on Aug 2, 2010 9:09 PM

  • How can I kill database connections

    I would like to know how can I kill all the database connexion at the end of an application. I'm using acces
    thx

    use con.close() in a finally statement after your catch blocks that tests whether con equals null. If con != null, then con.close();
    example:
    finally {
              //close the database connection.
              try {
                      if (con != null) con.close();
              catch (SQLException e) {
    }

  • HT4796 I'm in the process of migrating my info from a Windows pc to my mac, however the information transfer has started more that an hour ago, but the progress bar moved 2 mm? how can I spead up this process

    I'm in the process of migrating my date from a WindowsPc to a mac, however the transfer has started more than an hour ago and the progress bar has moved 2 mm on the first catogory only.  How can I spead up this process

    Hanlie wrote:
    I'm in the process of migrating my date from a WindowsPc to a mac, however the transfer has started more than an hour ago and the progress bar has moved 2 mm on the first catogory only.  How can I spead up this process
    Are you using WiFi? if you are this will take a long time, switching to a wired connection will go much faster but as you have started I would not change now.

  • How can I interupt the download process and close iPhoto

    how can I interupt the download process and close iPhoto

    If you really want to quit, force quit (command+q).

  • How can we stop the Collapse process in process chain.

    hi
    guys
             How can we stop the Collapse process in process chain.if any one know's plz tell me
    your regards
    suresh

    Hi,
    All the above post duly suggest a the methods we usually follow to cancel a collapse request i.e sm37 ---> Cancel without core,but these solution only applies if we are running collapse as a seperate variant in the process chain, in case its running as a part of change run the all above process will lead to the locking of the target.
    In that case if you could "lock the target" even before the collapse ran will result in the "Stopping of the collapse on the target automatically" .
    As far as figuring out the exat job of the collapse, you can directly get the job details in the "display message' , context menu option of the "Collapse variant" in the chain, clicking on the batch monitor and then clicking on the job to get its detail,then going to the specific "Application server " via SM51 and cacelling the job.
    Do check wearther the target is unlocked or not in sm12 if not then choose the object in se03 and select "Unlock".
    Hope it will serve yoour purpose
    Thax & Regards
    Vaibhave Sharma

  • I have an iPod Touch 4g with 4.1 software, but it takes forever to update the software, how can I speed up the process?

    I have an iPod Touch 4g with 4.1 software, but it takes forever to update the software, how can I speed up the process?

    Nothing you can do. Presently the Apple servers are overloaded because of iOS 6.

  • How can I stop the install process?

    How can I stop the install process? It tells me my disk is damaged and to restart and repair, but when I restart it tries to install again....it's a never ending cycle. I'd rather keep the system I have than continue this mess.

    Hello Serau1s,
    It sounds like you are installing Mavericks, and are being prompted to restart and repair your hard drive, but when the computer restarts it goes back to the installation process. The following article should help you get that disk repaired by getting you to the recovery partition, named:
    Disk Utility 12.x: Repair a disk
    http://support.apple.com/kb/PH5836
    Print this help page so you can refer to it later. (You don’t have access to Disk Utility Help when you restart up your computer in the next step.)In the Disk Utility Help window, choose Print from the Action pop-up menu (looks like a gear).
    Choose Apple menu > Restart. Hold down the Command (⌘) and R keys as your computer restarts.When you see a white screen with an Apple logo in the middle, you can release the keys.
    Click Disk Utility, and then click Continue.
    In the list at the left, select the item you want to repair. (Be sure to select an item that’s indented to the right in the list, not an item at the far left.)
    Click First Aid.
    If Disk Utility tells you the disk is about to fail, back it up and replace it. You can’t repair it.
    Click Repair Disk.If Disk Utility reports that the disk appears to be OK or has been repaired, you’re done. Otherwise, you may need to do one of the following steps.
    If Disk Utility reports “overlapped extent allocation” errors, two or more files occupy the same space on your disk, and at least one of them is likely to be corrupted. Check each file in the list of affected files. If you can replace a file or recreate it, delete it. If it contains information you need, open it and examine its data to make sure it hasn’t been corrupted. (Most of the files in the list have aliases in a DamagedFiles folder at the top level of your disk.)
    If Disk Utility can’t repair your disk or it reports “The underlying task reported failure,” try to repair the disk or partition again. If that doesn’t work, back up as much of your data as possible, reformat the disk, reinstall Mac OS X, and then restore your backed-up data.If you continue to have problems with your disk, it may be physically damaged and need to be replaced.
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

Maybe you are looking for

  • Using Windows without OSX

    Hi, Is it possible to remove OSX Mavericks and keep Windows 8? I barely used OSX Mavericks when I got Windows 8. Do I have to use a program like Minitool Partition Wizard or do I have to do it myself? Thanks!

  • Help me to transalate this C++ into java

    levelorder(root)   q = empty queue   q.enqueue(root)   while not q.empty do     node := q.dequeue()     visit(node)     if node.left ≠ null       q.enqueue(node.left)     if node.right ≠ null       q.enqueue(node.right)and how would I put all the val

  • Restricted access to nodes in SOLAR01

    Hi I have setup restricted access to the nodes in SOLAR01 (details shared below in the for "information area") - now I need to enter the team members who are allowed to update documentation in each business process & step. It seems that access to a h

  • Any suggestions for editing Music Videos with Multiclip?

    Hi there. I have been reading about the new multiclip feature in FCPHD5. Sounds as if it would be perfect for editing a performance music video with multiple run throughs. In fact it almost seems too good to be true. I was writing to ask if anyone ha

  • AHHH! "move to" command

    hi, been back to mac for a few years now but i still miss my "right click - move to (folder)" command from winxp. did a search for "finder move menu item" and found the solution...for osx 10.5.8. Thus the "AHHH!" in the title. Abracode is available b