How do i let a java process behave like a daemon process

i want to make a java application that will start up and remain running so it can accept client connections and i also want to be able to have some sort of application to stop the daemon process.
How do i go about doing this

Your Java app needs to listen on a socket for an incoming "close" request. The Java app would then should down neatly (maybe by interrupting the main processing thread).
You would then have to code a script which would send the appropriate close sequence to the socket. Look at some of the Java networking/sockets tutorials.

Similar Messages

  • How can i let my java application closes the other opened windows

    how can i let my java application closes the other opened windows: like any other Microsoft Internet Explorer windows ... provided that my java application is not the one i used to open those other windows.... thanks in advance

    you'll have to use JNI to access the windowAPI
    then you need a list of window handles ... I think there was a function called getWindow and in order to close them you use sendMessage .... for details check out msdn (microsoft developer network)
    somwhere I saw a tool called JUtil, which might help you getting started on accessing the win api from java
    regards
    Spieler

  • How do I create a title, that behaves like a button?

    Hi,
    I'm using XML to load data from asp to flash. Here's the XML
    example:
    1. <?xml version="1.0" encoding="iso-8859-1"?>
    2. <news>
    3. <item>
    4. <headline>Flash XML Based News reader out
    today!</headline>
    5. <date>05/09/1986</date>
    6. <message>Today my new xml based flash news reader
    came out, I am so excited!</message>
    7. </item>
    8. <item>
    9. <headline>One day until the Flash XML Based News
    reader is out!</headline>
    10. <date>05/08/1986</date>
    11. <message>Tomorrow my new xml based flash news
    reader comes out, I am so excited!</message>
    12. </item>
    13. <item>
    14. <headline>Two days until the Flash XML Based News
    reader is out!</headline>
    15. <date>05/07/1986</date>
    16. <message>The day after tomorrow my new xml based
    flash news reader comes out, I am so excited!</message>
    17. </item>
    18. </news>
    And here's the ActionScript part:
    1. // Initialize the xml object that our news will be loaded
    into
    2. var news_xml : XML = new XML();
    3. // ignore all whitespaces inside of our xml file
    4. news_xml.ignoreWhite = true;
    5. // when the xml recieves a return from the load() function
    call, execute this function
    6. news_xml.onLoad = function( success : Boolean ) {
    7. // if the xml file was successfully loaded
    8. if ( success ) {
    9. parseNews(this);
    10. }
    11. }
    12. // call the load function on the xml object, passing in
    the url of your xml file
    13. news_xml.load("xmlTutorial.xml");
    14. // this function will take our news xml object and parse
    it
    15. function parseNews( _xml : XML ) : Void {
    16. // first we create an array that holds all the values of
    the item nodes
    17. var items : Array = _xml.firstChild.childNodes;
    18. // now we want to iterate over every item in the items
    array
    19. // and parse the nodes as we see fit
    20. for ( var i : Number = 0 ; i < items.length ; i ++ ) {
    21. // here we set the text of the text field ( news_txt )
    22. // the first thing we add to the textfield is the
    headline then a line break
    23. news_txt.htmlText += "<b>" + items
    .childNodes[0].firstChild +"</b><br>";
    24. // next we add the string date followed by the date value
    in the xml file
    25. news_txt.htmlText += "Date: " +
    items.childNodes[1].firstChild + "<br>";
    26. // now we add the message, then two line breaks, only for
    formatting
    27. news_txt.htmlText += " " + items
    .childNodes[2].firstChild + "<br><br>";
    28. }
    29. }
    So far is everything clear to me. But what I want to do now
    is that after a user clicks on title, next happens:
    the current swf unloads
    the flash sends data to asp (ID of an article and ID of an
    author, which movie to load next).
    How do create a title/button?I know how to make a title to
    behave like a link (just add the
    http://... in the headline tag in XML
    document. But this,..... I just don't know how to do that.
    THX for any help

    2m, you are right. I should tell you about my concept. It's
    all on the paper yet, because this is how I work - first I write
    down everything on paper, study it and the next step in trying to
    make it work on computer.
    I have a main swf, I call it system.swf. System.swf receives
    the info about the swfs, it must be loaded from html tag
    <object><param>. The ID of the movies is send from
    flash to asp and then via <object>back to flash. Does that
    make sense? Is there a better way for that?
    So, the system.swf is loaded for the whole time - let's say
    it on level1. On level 2 are then loaded other swfs.It depends
    which content the user wants to see.
    About the article part:
    first the user sees the list of last articles (title, date
    and short description). When he/she clicks on the title, all the
    action happens:
    flash sends the data which article the user wants to read to
    asp, asp searches in data base for the requested article and
    creates xml, where are title, date and the whole content of the
    article.
    At the same time asp also sends via <object>tag in html
    the id of the swf that must be loaded and the id of the author of
    the article, so the swf, where the pictures of the all authors are,
    will know what picute must load (this is the second swf that is
    loaded on the article part - it's created like a gallery; the
    author of the active article is bigger and if the user wants to
    read the last article of other author, he/she just closes the
    picture and then the images are moving in a slider way and when
    he/she clicks on an image, it get larger and the last artcle of
    this author is loaded).
    And I wonder how can I make this all to happen: when the user
    clicks on a title, all the var action happens?
    If you have better idea how to create this, please, advice.
    THX for the help so far

  • How to make spark datagrid columns to behave like mx datagrid columns

    Hello.
    I have a problem with spark datagrid component. I can't force spark datagrid columns behave like old mx datagrid columns. In mx datagrid columns fills 100% of datagrid regardles of resizing column or datagrid itself (it will not show horizontal scrolling bar). In spark datagrid last column (colC) will never word wrap, event after setting horizontalScrollPolicy=off. I would like to somehow constrain spark columns to behave like mx ones.
    App snippet (try to resize app and columns - especially colC - and you will see what I mean):
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <s:ArrayCollection id="dp">
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
                <s:DataItem colA="some sample data" colB="some sample data" colC="some sample data"/>
            </s:ArrayCollection>
        </fx:Declarations>
        <s:layout>
            <s:HorizontalLayout/>
        </s:layout>
        <s:DataGrid id="grid" width="100%" height="100%" dataProvider="{dp}" variableRowHeight="true" horizontalScrollPolicy="off">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn headerText="Column A" dataField="colA"/>
                    <s:GridColumn headerText="Column B" dataField="colB"/>
                    <s:GridColumn headerText="Column C" dataField="colC"/>
                </s:ArrayList>
            </s:columns>
        </s:DataGrid>
        <mx:DataGrid id="grid2" width="100%" height="100%" dataProvider="{dp}" wordWrap="true" variableRowHeight="true">
            <mx:columns>
                <mx:DataGridColumn headerText="Column A" dataField="colA"/>
                <mx:DataGridColumn headerText="Column B" dataField="colB"/>
                <mx:DataGridColumn headerText="Column C" dataField="colC"/>
            </mx:columns>
        </mx:DataGrid>
    </s:Application>

    the datagrid has sortItems and sortItemsOn methods you can use.

  • How do I get my TV to behave like a monitor?

    I have a MacBook Air 3.2 version. It does not have a thunderbolt display port, just the normal one. I connected the MBA to the computer via the HDMI slot.
    I want the TV to act as a monitor for my computer. In particular, I want it to play video files. That is the reason why I am trying to set up the TV as a display. To play movies so that the movie doesn't take up all the real estate on my computer screen and I can do other things and have other things on my computer screen.
    I am in Korea and am having trouble doing this. I connected the TV and the MBA with the cable. What is the next step. I went to System Prefs and clicked "Detect Display" and nothing happens. I have the display icon in the menu bar at the top of the screen.
    What should I do with the TV? I went into menu and chose connection icon and then HDMI. The screen is blank and says "No signal".

    I think what happened was that I picked the wrong HDMI when I opened Menu on the TV. There were HDMI 1 and HDMI 2 and when I picked HDMI 2 it seemed to start working OK.
    The funny thing was that when I moved the menu bar back to the computer, I could not open system preferences. I think whatever I opened and didn't close on the TV, doesn't open on the computer, such as the video and System Preferences.
    The second time I tried it, I closed System Preferences on the TV and I was able to open System Preferences on the computer.
    The switching of the cursor is slow too. I couldn't find the cursor on the computer and it wasn't on the TV screen either. But after a while the cursor appeared on the screen.
    I went to Sound in System Preferences and could not find how to do this:
    You also need to set your audio out to use the HDMI connection
    Also, I now understand what "Arrangement" does. It is partly for the placement of the mouse/trackpad cursor. If the TV screen is to the right of my laptop, I position the TV screen to the right of the computer screen in Arrangement. So if I want to do something on the TV screen, I move the cursor to the right and off the computer screen. It then appears on the TV screen. Apologies if I am stating the obvious, this is a new discovery to me and I am starting to understand how displays work better.

  • How can I make Safari on iOS behave like/pretend it's Safari on OSX

    I am trying to demo a site that detects that the browser is mobile.  I want Safari on the iPad to display the non-mobile version of the site.  How do I make this happen?

    Try the iCab or Atomic browsers. Or contact the sysop at the site you are trying to demo.

  • How to create a ring/listbox that behaves like a listbox in html?

    Dear Sirs:
    I have an arrays that represents people's names with associated values:
    ID, Name
    2, Sara
    4, Marx
    6, Jackson
    9, Lisa
    ... and so on.
    All I want to do is to populate a ring or listbox (btw, which one is the correct?) that displays only the names and tell me which is the value associated to the selected name by the user.
    (That's pretty much the expected behaviour for those who are familiar with html).
    An extra issue: How can I tell the ring/listbox which name to display as default?
    Thank you so much!
    Best regards,
    Javier Mauricio
    (Using Trial LabView)
    PD: The enclosed VI shows that I have been only able to detect wich element number was selected (not
    the ID).
    Attachments:
    test.vi ‏17 KB

    Hello, Javier!
    I'll do my best to answer your question.
    Your sample VI was close. Since you can detect which element number was selected, the only thing that you need to do to display the value associated with the selected user name is to wire the element number to an Index Array function. Use the element number to select the correct row of the ID column. This gives you the value associated with the selected user name.
    To tell the ring/listbox which name to display as default, you just set the Value property for the control to the value that you want as the default. You do this by creating a property node. Then select the Value property (by default, the Value property is set to read). Right-click the Value property in the property node and sel
    ect Change to Write. Then you can wire your default value to it.
    The attached VI shows how to do what you want to do.
    Hope this helps.
    Mark Ridgley
    Attachments:
    example.vi ‏33 KB

  • How can I make floating options windows behave like probe windows in LV 5.0?

    Hello all,
    I'm trying to use subVI's as small floating windows that appear and disappear on command. These windows provide access to controls that trigger functions in the calling VI.
    I've already achieved this by calling the subVI's (which are set to be front most) continuously in the main loop when I want to see their front panels and then closing them when I don't want to see them using the close function in victl.llb.
    This works, but there are some problems. The title bars of the floating front panels flash continuously when there is more than one panel open and if two panels overlap then the overlapping regions flash. Also, when I operate controls on the calling V
    I (window maximized), the floating panels disapear. I also tried using invoke and property nodes with the same results.
    I realize that this is because only one panel can be in front at any one time, so while calling them in a loop keeps them visible it also makes them flash and disappear behind the calling VI when I click on it.
    Is there any solution to this? Is this addressed in LV 6i?
    What I really need is for those floating windows to act like probe indicators. Is this possible?
    I would greatly appreciate any help.
    thank you,
    Louis

    There's an utility called LVWUTIL32 at http://zone.ni.com/devzone/explprog.nsf/6c16360326​5406328625682a006ed37d/ebf11dd1f0feaef386256679007​2a983/ that has a vi to make a window topmost, with one difference, if you execute it once, the window will be topmost even if you click in the window under it, and it will be so until you revoke this option with another VI. In my system, no flashes were detected.
    Hope this helps

  • How do I make my ActiveX Control behave like a LabVIEW native control?

    When a user drops my ActiveX control onto a Front Panel and then views the Diagram, I would like him to see a terminal outputting a specific property value instead of the reference number. In short, I don't want him to have to go to the extra step of creating a Property Node to access the property value.

    > When a user drops my ActiveX control onto a Front Panel and then views
    > the Diagram, I would like him to see a terminal outputting a specific
    > property value instead of the reference number. In short, I don't want
    > him to have to go to the extra step of creating a Property Node to
    > access the property value.
    You can make it drop a prewired property node when they drop the control.
    It isn't hard, but there are a few steps involved.
    To do this, make a VI that has your control configured the way you want,
    and on the diagram have it wired to a property node with the correct
    selection and direction. You should also make an icon that will show
    up in the palette. Save this VI somewhere like user.lib. Now
    you need to edit the palettes and add this as a Merge VI.
    Open the Controls palette and click on the ... button. If using LV5,
    choose Edit Controls and Functions Palette from the Edit menu.
    Once editing the palettes, make your own palette set and give it a name.
    Now choose a place in the palettes to add the .vi file. Right click and
    Insert and Custom Control(s)... This will bring up a file dialog that
    is filtering for .ctl files. Change the filter to allow all files.
    Select the .vi file that you saved earlier.
    To give this to others, you may want to make this a bit differently.
    You can place the VI and .mnu file into user.lib and a few other places
    and it will automatically be added to the LV palettes.
    Anyway, once the VI is available in the palettes, it will merge the VI
    contents into the VI, exactly as the 3D graph does.
    Greg McKaskle

  • Running Java process in Back ground

    We have a script that starts a Java process in Background. But still if I try to exit from the 'Console', it's not allowing me to do so, and if I forcibly kill the console, it's killing my Java process. My question is, how can I make my java process to run completely in background? Secondly, will the JVM have any references to the console through which it is being called. Please help me.

    Hi Sastry66,
    If your application is going to use stdout/stderr, then there may be a problem. Try to redirect stdout/stderr using shell redirections when starting your java program. You may also want to try using exec java <class-file> to start the process.
    Regards,
    SUN/DTS

  • Scheduled java process; how to do ?

    Hi,
    I have a question:
    1) I want to schedule a java process every night at midnigt. What are the options that i have to achieve this ?
    I know that we can put this java process in a cronjob, but the Linux server does not allow the non-priviledged users to run a cronjob. And we can not get "root" to run this process.
    Please let me know know of any ideas how to achieve the same.
    Thanks again for all your advised in the past too.
    Best Regards, sangita

    hmmm .....are you sure that a non-priviledges user
    can run a crontab on LINUX. I know that this is true
    on SUN UNIX but what i have been told is that you CAN
    NOT run a crontab as a non-proviledged user on
    LINUX.
    Iam not that familiar with LINUX administrationIt's configurable. The admins can allow/deny cron rights to individuals or to everybody.
    Try typing crontab -l or crontab -e and see what happens.
    If you're not allowed, I don't know if the crontab command itself would fail, or if you just won't be allowed to create entries, so crontab -l not giving an error might not necessarily mean you have permission (though I think that it does).
    You can use crontab -e to create entries. Put an entry in for yourself that touches a file 2 minutes from now, and see if it works.

  • How can I let my servlet to process Chinese Character as an input?

    How can I let my servlet to process Chinese Character as an input to my simple database which is an Excel file. I have tried before and all my input values become question marks.
    Please give me some advise, thx!

    input chinese?����������
    that may result from the tomcat or other web server

  • How to create parent and chile process in java

    i'm beginning in java, and i want to ask something, please help me...
    1. i want to ask how to create parent and child process in java???
    example :
    if have one window and explore menu, when i click the explore menu.
    new window come out.
    how if i close the parent window the child window will close too...
    2. what is the method from runtime class to get available memory and Active Threads count

    ONE way to do what you wanted is this.
    class Parent{
    Child c = new Child
    allChildren.add(c);
    //if close
    iterate through list
    (Child)allChildren.get(index).close();
    ArrayList allChildren;
    class Child{
    public void close(){ }
    i dont know if you can get the thread count. but you can
    get the current thread by using System.
    Memory: Runtime.freeMemory() .maxMemory() .totalMemory()
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    Careful though you have to do a calculation to get the
    actual memory because those 3 methods refer to freeMemory
    of the CURRENT heap not the total memory.
    i think its: total - (max - free)

  • How to check actual allocated and used memory for java process in solaris?

    Hi,
    I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
    I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
    So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
    Thank you.

    With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
    With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
    Nick.

  • How does java.exe behave if I only use -Xmsn option?

    Hi,
    if I only set the -Xmsn option and do not set -Xmxn option when I launch my Java application, how does java.exe behave? Does the heap will automatically grow like what Bea's JRockit does when my application requires more memory?
    I use JDK 5.0.
    Thanks for your help!

    If your application needs the space, the JVM will grow the heap up to the
    default value of -Xmx. Note that it will run a garbage collection cycle before
    expanding the heap, and it may take a few or several cycles to expand to
    the -Xmx value. How fast or slow it expands depends somewhat on the
    behavior of your application (how much it allocates and how long the
    objects live).
    The default value of -Xmx depends on the platform; see
    http://java.sun.com/docs/hotspot/gc5.0/ergo5.html.

Maybe you are looking for

  • Adobe Reader X Problem signing online PDF

    This issue has started a couple of weeks ago. Users are running Windows 7 and Adobe Reader X.  When accessing a PDF online users are unable to digitally sign with certificates. When trying to sign it asks them to save the document. If they save the d

  • Can I write XML PDF without Adobe LiveCycle ?

    Hallo:-) My firm have product to create blank /form/, which we save into our XML format. We want to "save as" forms into XML PDF format. But only use XML not PDF into XDP format. I read XML Forms Architecture (XFA)Specification Version 2.4 ... Is the

  • Waste Management Workbench Help

    Hi all, I wonder if any of you can help me with Waste Management Worbench. When accesing WACO02 and I select the Recipe Workbench (RMS), I can only work with spec categories Substances, Recipes and Formulas but not with Waste Codes. The problem then

  • Downloading packages and class files

    Hi Friends I have a query regarding downloading packages . I have a LdapHelper class defined in a package of com.beasys.commerce.bridge.ldap of wls 2.0 version . I want that package to be imported to my wls of 8.1 version . Is this feasible ? . Can i

  • Snow leopard keeps rebooting

    After the recent updrade, snow leopard (10.6.8), Snow leopars keeps rebooting ? Any suggestions as to what might be the cause 0 how to prevent?