Running the Java program as service.

Hi,
I want to create have java program, which runs continously. This would hit check a table in Database for any new records and if there is anything it would post a message to another service. It would keep track of how many messages were posted and how many were completed at any point of time.I should have the ability to stop this service. When a stop sequence is initiated, it should wait till all the messages are processed and shutdown. I am looking for inputs on how to invoke the java program as service and the second part (stopping the service). I dont want to Java wrapper service or commons daemon api. I am on JDK 1.4.2
Thanks in Advance.
Regards,
Arul.

Do you want to write a daemon? I dont think you can do it without some explicit OS support..
Well, lemme know if you find a way

Similar Messages

  • Is it possible to run the java program without main?

    Hi,
    Is it possible to run the java program without main?
    if anybody know please tell me, how it is possible.
    Regards,
    Ramya

    Hi,
    Is it possible to run the java program without main?
    if anybody know please tell me, how it is possible.
    Regards,
    RamyaWhy do you ask? It sounds like an odd question. Your program can be an applet and it doesn't need a main method in that case.
    Kaj

  • I am not able to run the java Program

    Hi All,
    I am not able to run a java program... I am able to complie the program sucessfully when i am trying to run it i am getting a error:
    Exception  in thread "main" java.lang.NoClassFoundError : filename
    i have complie and run my programs frequently but now i am not able run my prevoius examples also ...
    Can u any body help me out...... I have also update the latest version of JRE but still my problem is not sloved.
    Thanks & Regards,
    Ravi

    Make sure you take package structure into account.
    If you have say
    package testing.things;
    public class Test
        public static void main(String[] args)
            System.out.println("World Hello");
    }in file Test.java, you compile it with (assuming your current working directory is at the folder in which the source file is located).
    javac -d . Test.javaand run it with
    java testing.things.TestThe -d . option creates the output at the current directory (with a folder structure matching your package structure).
    #

  • NoClassFoundError exception while running the java program

    Hi,
    I am getting the following exception while running a java program CSTToGMTToSQL.java
    Exception in thread "main" java.lang.NoClassDefFoundError: CSTToGMTToSQL
    However, the class file is getting created for this program in the same directory where the program is residing.
    Any idea on this ?
    Regards
    Ramesh

    I know that in the past there was an issue with running a particular version of the SDK on a particular version of windows. The resulant error was a ClassNotFoundException. I am not sure about the versions involved.

  • Am not able to run the java program - pls help

    1. I installed java in the below path
         c:\program files\java\jdk1.5.0
         c:\program files\java\jre1.5.0
    I set the path in
         User variable i. variable name: path
              ii. variable value: c:\program files\java\jdk1.5.0\bin
    when I compile it in command prompt-applying javac ? it performed successfully-shows
    options like ?g create all debug info, -g : new Generate no debug info etc.,
    But am not able to run the file. It shows error msg.
    2. I specified the same name for file name & class name.
    3. Java <class name>
         Exception in thread ?main?java.lang.NoclassDeffoundError: <class name>
    4. Java ?cp <class name>
         Unrecognized option: -cp.<classname>
         Could not create the Java Virtual Machine
    5. Java ?classpath . <classname>
         Exception in thread ?main?.java.lang.unsupported classversionError: <classname>
         <unsupported major.minor version 49.0
              at java.lang.classloader.defineclass0<native method>
              at java.lang.classloader.defineclass<unknown source>
                   --and many listed below?
    6. Java ?classpath c:\program files\java\jdk1.5.0\bin <class name>
         Exception in thread ?main?java.lang.NoclassDeffoundError: <class name>
    7. I re-installed the java, but still the problem continuing.
    pls help... its very urgent

    Is the java class you compiled/calling in the default package? If it is not, you will have to call it by the fully qualified name.
    e.g.
    package com.mycompany.myproject;
    public class MyClass {
        public static void main(String[] args) { }
    }This would be called as "Java com.mycompany.myproject.MyClass" and must contain a main method with signature as above.
    You would have to call this from folder where the compiled classes are located. If using package, you would call from directory at level of top most package so com folder in this example as Java will look at each package name in qualified name and try to traverse directories with those same names to get to .class file matching class name specified. To avoid this, your newly compiled .class files must also be in your classpath.
    Hopefully that helps.
    --Kevin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Not able to run the Java Program from jre for the ARM processor

    Hi ,
    I am try to run the jre1.4.2 for the arm core (linux 2.6kernel) which i downloaded from the sun site.
    I am created the class file from the J2SE1.4 development kit. I created the simple HelloWorld Program and complied with J2Se then i copied that class file into my IMX board which has ARM core.
    When i run the commnd java HelloWorld i am getting this error
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjve
    Please give me some suggestion to solve this porblem
    Thanks in Advance
    Narendra

    I JRE i have download from the sun site . But when i am trying to run the simple helloWorld program in that it is giving the below error.
    error:
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so because /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so: symbol __divdf3, version GCC_3.0 not defined in file libgcc_s.so.1 with link time reference.
    Can anybody help me in this how to solve this problem . I also searched in the forum but did not get any answer on that problem
    Thanks in advance.
    Narendra

  • How to run the java program from another directory?

    Hi
    Assumption:
    data.java is in a package suncertify.db and place in a directory c:/code/suncertify/db/ directory
    data.class file: is in c:/code/suncertify/db/ directory
    current directory: c:/
    How can execute the data.class directly in c:/ directory without changing directory to c:/code/ ?
    Thanks in advance,
    Adrian

    Yes. You can use the -classpath and -sourcepath options to specify where to look for source files, and the -d option to specify where to generate the class files. Look up the usage of those options in the javac documentation:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html

  • Error message when try to run copied java program

    Hi Java Guru,
    Can somebody help me with this issue ?
    I was copy my java source from java_ulangan2 to java_ulangan20, when i tried to run the java program, i get an error message.
    Below is the error message:
    05/01/2010 1:02:42 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [003]Deployment aborted
    Settings
    SDM host : wfmdev
    SDM port : 50018
    URL to deploy : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Result
    => deployment aborted : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Aborted: development component 'Java_ulangan20'/'local'/'LOKAL'/'0.2010.01.05.13.02.32'/'0':Caught exception during application deployment from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Cannot deploy application local/Java_ulangan20.. Reason: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?; nested exception is:      com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine? (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    I really appreciate any kind of help.
    Thanks,
    JGN

    Hi John.
    In past i have faced same problem for the same task. Take help of the Basis team provide tham .ear file name and ask then to un-deploy the file from the server cluster.
    After this deploy your application again.
    Hope this may help you.....:)
    Deepak!!!

  • How to invoke the .bat(batch file ) from the java program

    i want to run some commands when i run one java program.
    I wrote those dos commands on the batch file and i want to include the bat file in the java program so that i can execute the bat file when i run the java program.
    tell me the way that i can run my bat file inside the java program.

    i tried this :
    a .bat file named test.bat, with this code : copy test.bat test2.bat
    a java class, Test.class, in the same directory
    public class Test {
         public static void main(String[] args) {
              try {           
                   Runtime rt = Runtime.getRuntime();
                   Process proc = rt.exec("cmd /c test.bat");
                   proc.waitFor();
                   int exitVal = proc.exitValue();
                   System.out.println("Process exitValue: " + exitVal);
              catch (Throwable t) {
                   t.printStackTrace();
    }

  • How can i run my java program in background process?

    hi all,
    i am working on desktop monitoring so when i start my program on client machine that is visible to all but i want this program client not visible to all instead of this can be run in background process . so, nobody can see that.
    so, how i can do this ?
    pls pls help me
    thanks in advanced to helper
    regards
    maulik & ritesh

    this will run the java program in the background.It'll just use the Windows Java Console instead of the command-line console. It has nothing to do with running as a background process.
    Edit: though this might be exactly what the OP wants: not "background process" but "no DOS console".

  • Running a java program in a directory other than the current directory

    How do I run a java program that's located in a directory other than the current directory?
    There is a file Test.java in /dir1/subdir1. If my current directory is anywhere other than that directory, say /dir2/subdir2, I can compile Test.java by using:
    javac -classpath /dir1/subdir1 /dir1/subdir1/Test.java
    But when I try to run it with:
    java -classpath /dir1/subdir1 /dir1/subdir1/Test
    I get a java.lang.NoClassDefFoundError: \dir1\subdir1\Test
    Any thoughts?

    You need to specify just the name of the class you want to run. So java -classpath /dir1/subdir1 Test

  • Is it possible to run a java program without using the command prompt?

    Hi,
    I was wondering whether it is possible to run a Java program (not an applet) without using a command line in the command prompt?
    Basically I want to run a program that will be continually running in the background and hence I don't want to have a command prompt screen loaded up as well - I just want the program to be running in the task bar.
    I know how to run the program in the task bar - but I still need to launch the program from the command prompt - is there anyway I can get a program running without having to start it from the command prompt?
    Cheers

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

  • I start running a java program and when i switch users the sound doesnt work

    When I start running a java program or leave a game running and i switch users the sound doesnt work. I have been searching around the web and nobody seems to have an answer. This just recently started to happen. Please if anyone has any ideas that would be much appreciated and the problem is my computer its almost brand new. And my computer is completely up to date.

    Sony Mobile team has a separate community which can be found here.
    If my post answers your question, please click on "Accept as Solution"

  • Could anyone tell me what is the minium requirement to run a java program.

    I am new to java. Could anyone tell me what is the minium requirement to run a java program. Thanks in advance.

    Lara1983 wrote:
    Could anybody give me a direct answer? I think the minium requirement to run a java program is JVM and Java API. Is this right?What does Google tell you?
    BTW in order to get a direct answer, one must ask a direct unambiguous question. Are you asking for the minimum software or hardware requirements to run an application developed in Java or to develop an application in Java. What environment? Details are important and again Google is an interactive search engine, try it!
    Mel

  • How can i run the java bean sample program download from OTN

    hello to all
    i have a p[roblem. i have downloaded the sample progam from oracle web site which is a java code that connect with the oracle and shows a form. how can i run the from.
    can any body help me pleaSEEE
    thanks
    kamran ahmed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi Darryl.Burke
    So your telling, we cannot run our Java Program when system shutdowns...In my application, when user has schedule for next days and he shutdown his PC. On the next day when System Started i should able to get back my schedule on the Specified time(I'm TimerTask class in Java)... How can i achieve this using Java? can u tell me clearly..

Maybe you are looking for

  • Unable to load bluetooth device driver to xfer files

    On W500 and T61P attempt to connect a Samsung SGH T809 phone using bluetooth. Device is seen at both PC and phone using bluetooth. Win 7 OS. When it connects it loads the Modem, and other device drivers but fails to load one of the peripheral device

  • Linking between portlets

    Can anyone describe how to create a link in one portlet that updates the data in another portlet on the same page.

  • 8.1 EE can't find page and appends the welcome-file name to the url

    I have a problem where you enter a url that points to a static file in the xxxEar-WebModule_war directory. That is the "docroot" directory for the application. Somewhere along the line the welcome-file (index.html) is appended to the url. For example

  • Switching between Monitors

    Hi, in addition to my previous topic I have one more question. When using the second monitor the primary display of the MacBook is still active (synchronization turned off!). Applications appear only on the second monitor but I oven loose my mouse be

  • Process.destroy does�nt work

    Hello! I have created a process the following way: Process process = Runtime.getRuntime().exec(cmd); It is intended to run as a background task while i�m doing other stuff. When the other things are taken care of I want to stop/kill the process and u