Running a java program in the background

I'm designing a network remote control system in java.
I was wondering does anyone know if it is possible to run an application at the log in screen in windows 2000. There is no GUI and no command prompt.
paddy

If you mean can you run it as a windows 2000 service so the user doesn't see it yes you can.
I recommend the following Java Service wrapper program:
http://www.eworksmart.com/JNT/
It's quite simple to set up and will start when the user logs in (so long as the service is set to start automatically).
Hope that helps,
Seigers.

Similar Messages

  • How to run a server program in the background on Linux or Windows?

    I just finished writing a Java network application with multiple clients and one server.
    However, I am not sure how I can run the server (SomeServer.class) in the background on Windows. Also when I am running it on Linux, I don't want it to terminate when I logout of the Linux shell.
    To run the server on Linux, should I use a command like this?
    nohup java -cp . SomeServer.class > output.txt &
    Or is there another command, or perhaps some code that I can add to the program so that it would run in the background automatically and/or continues even when I logout of the Linux shell??
    Sometimes, I also like to run the program on a Windows XP machine for testing purpose. How can I do it so that it runs in the background without openning a Console/Command Prompt window??
    (redirecting the standard output to a file)
    And is there an easy way to create a EXE file that runs the program with the default JRE in windows?

    On many UNIX systems there's a utility called detach which will launch the following command in such a manner that killing the shell will not kill the process. On systems that lack this command, I'd find an open source implementation and install it.

  • Running a Java app in the background on Windows

    I have a Java application that runs constantly on a users computer. (Checking for files to download from a server) I want to have this application run in the background instead of putting a short cut on the Windows task bar. Can anyone direct me to a code sample, tutorial or even just let me know if this is even possible using Java.
    Thanks in advance for your help,
    Jeff Morgan
    http://www.drugtalk.org

    If you create a console app and place it in a executable jar file, the program will run invisably, even if you have println statements. This is cos the jar file does not launch a console window, so no output will be displayed.
    Hope that is what you wanted

  • Encountering exceptions when running a java program in the db

    hi,
    when running the following following program in oracle11g, AIX (5300-07)
    DROP JAVA SOURCE DIRLIST;
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED DIRLIST as import java.io.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.SimpleDateFormat;
    public class DirList
    public static void getList(String directory)
    throws SQLException
    File path = new File( directory );
    String[] list = path.list();
    String element;
    for(int i = 0; i < list.length; i++)
    element = list;
    String fpath=directory+"/"+list[i];
    File f = new File(fpath);
    long len;
    Date date;
    String ftype;
    String sqldate;
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:S");
    if (f.isFile()) {
    len = f.length();
    date = new Date(f.lastModified());
    sqldate = df.format(date) ;
    ftype = "F";
    else {
    len = 0;
    sqldate = null;
    ftype = "D";
    #sql { INSERT INTO DIR_LIST (FILENAME, filelength, filetype, filemodified)
    VALUES (:element, :len, :ftype, to_timestamp(:sqldate,'YYYY-MM-DD HH24:MI:SS:FF3'))
    we are encountering the following issues..
    SQL> sho error JAVA SOURCE DIRLIST
    Errors for JAVA SOURCE DIRLIST:
    LINE/COL ERROR
    0/0 An exception has occurred in the compiler (1.5.0_10). Please
    file a bug at the Java Developer Connection
    (http://java.sun.com/webapps/bugreport) after checking the Bug
    Parade for duplicates. Include your program and the following
    diagnostic in your report. Thank you.
    0/0 java.lang.NullPointerException
    0/0 at
    com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:4
    80)
    LINE/COL ERROR
    0/0 at
    oracle.aurora.jdkcompiler.JdkDriver.compile(JdkDriver.java:570)
    0/0 at oracle.aurora.rdbms.Compiler.compile(Compiler.java:322)
    0/0 at oracle.aurora.rdbms.Compiler.access$000(Compiler.java:57)
    0/0 at oracle.aurora.rdbms.Compiler$1.run(Compiler.java:324)
    0/0 at java.security.AccessController.doPrivileged(Native Method)
    0/0 at oracle.aurora.rdbms.Compiler.doCompile(Compiler.java:651)
    In trace files there are another set of exceptions that are getting generated when this program is running as shown below
    joez_compile_method: failed compiling method oracle/aurora/sqljdecl/SqljDecl.jj_
    scan_token with oracle/aurora/zephyr/util/JITCompileException:class java.lang.Ar
    rayIndexOutOfBoundsException:null
    oracle.aurora.zephyr.util.JITCompileException: class java.lang.ArrayIndexOutOfBo
    undsException:null
    at oracle.aurora.zephyr.util.Debug.assert_(Debug.java:67)
    at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:197)
    at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:71)
    at oracle.aurora.vm.OracleRuntime.jitOneMethod(Native Method)
    at oracle.aurora.vm.OracleRuntime.jitSomeMethods(OracleRuntime.java:758)
    Caused by: java.lang.ArrayIndexOutOfBoundsException
    at java.util.Vector.addElement(Vector.java:582)
    at java.util.Stack.push(Stack.java:44)
    at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.push(ByteCodeToMIR.java:4
    03)
    at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.pushRef(ByteCodeToMIR.jav
    a:406)
    at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateBasicBlock(ByteC
    odeToMIR.java:1822)
    at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateMethod(ByteCodeT
    oMIR.java:824)
    at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateMethod(ByteCodeT
    oMIR.java:4633)
    at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:125)
    ... 3 more
    We been trying for couple of weeks to figure out the issue.
    Has anyone encountered this issue or having solution in rectifying this please share with us..
    Thanks

    If you mean can you run it as a windows 2000 service so the user doesn't see it yes you can.
    I recommend the following Java Service wrapper program:
    http://www.eworksmart.com/JNT/
    It's quite simple to set up and will start when the user logs in (so long as the service is set to start automatically).
    Hope that helps,
    Seigers.

  • Help required - running a Java program from the command line

    Hi,
    I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
    When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
    Both the application jar file and the external jar file are in my root directory (C:\).
    My command line call is as follows:
    java -cp c:MyExternalLib.jar -jar MyApp.jar
    Any help greatly appreciated.
    Thanks,
    Walter

    hi,
    set classpath=%classpath%;c:\myjar.jar;
    here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
    java mypgm
    this will solve ur problem
    regards,
    Ganesh

  • Running a Java application on the background

    How can I run an applet on the background ? (UNIX and Windows)
    Thanks!!

    Running "in the background" is not really relvent on Windows as CMD[1] does not have this functionallty (that I know of) and you normally execute appliucations in the GUI, unless you are talking about making it a service, running when the user logs off (nohup in UNIX, Windows Services in windows), if thats what you are after, NT JAVA +Service in google.
    [1] If you use a diffrent shell, such as Cygwin you can get this functionallity under Windows.

  • How to run a Java program without the command line.

    Is there anyway to create a Java program that runs like most programs do in Windows ,by double clicking on their icons?
    Thanks,
    Vance

    http://www.ej-technologies.com/products/exe4j/overview.html
    Looks kinda cool. Most java-2-exe programs are usually way too expensive and wont work with GUIs and require other dlls/libraries...

  • Running a Java program without the JRE...

    Hi there,
    I was wondering whether it is possible to run my java applications on a system that does not have the JRE installed?
    Is there a way to compile the java bytecode into an executable - let's say for windows.
    Thank you

    See:
    http://www.bearcave.com/software/java/comp_java.html
    Yair.

  • How to run a java program in the JVM of an already running program?

    As far as I know about JVM, each time we run a program a separate instance of JVM is created where the program runs. Correct me if I am wrong.
    Is there any way for another program to execute itself in the same JVM?
    Currently I am working on JFCUnit which is a tool used to automate swing applications. I am trying to automate JConsole.
    If I open "JConsole.exe" through a program and then try to get the handles using JFCUnit, things are not working.
    If I use JConsole.jar in JDK/lib and create a new instance of JConsole and then try to get the handles using JFCUnit, I am able to proceed with automation.
    But here comes the problem :-
    The application which needs to be automated through JConsole requires it to be started with few arguments, which is as follows:
    %JDK_HOME%\bin\jconsole -J-Djava.class.path=%CLASSPATH% -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=true -J-Djmx.remote.protocol.provider.pkgs=oracle.oc4j.admin.jmx.remote "service:jmx:rmi://localhost:23791"So this problem can be solved in two ways,
    Either
    1. JFCunit could be made to recognize the JConsole.exe which would be running is a different JVM.
    OR
    2. JConsole.jar to be used in a way so that it takes the required arguments, hereby an instance of JConsole would be created that too in the same JVM as that of the program.
    I am more interested in the first solution as it would definitely be helpful in other projects as well.
    Please let me know if any other solution is possible.
    Any kinda solution is appreciated :)
    Thanks in advance.

    Give a look at Terracota.
    http://www.terracottatech.com/

  • Problem with running a java program from the command line

    I have this code:
    package pkg;
    import jxl.*;
    import java.io.File;
    public class TestClass {
         public static void main(String[] args) {
              try{
                   Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
                   Sheet sheet = book.getSheet(0);
                   String s=sheet.getCell(4, 2).getContents();
                   System.out.println(s);     
              }catch (Exception e){System.err.println(e);}
    }I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
    Then I tried to run it from the command line and I did it like this:
    D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
    Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
    Caused by: java.lang.ClassNotFoundException: pkg.TestClass
    ...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
    So, my question is: How to run this code from the command line?
    I have no idea what went wrong.
    Can someone help me, please?

    The current directory is not implied in the classpath.
    D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
    D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars...

  • 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".

  • 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).

  • 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

  • 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"

  • Running program in the background

    Hi everybody!
    I need to run  program in the background.
    So I need only to change the sy-batch status to 'X'?

    HI,
    if your program is runninn in the Background then the System field SY-BATCH will become 'X' otherwise it will have space ......
    it will not execute the job in the background if you put SY-BATCH = 'X'
    you need to use: Job_open , Job_submit and job_close function modules
    example:
    *Submit report as job(i.e. in background) 
    data: jobname like tbtcjob-jobname value
                                 ' TRANSFER TRANSLATION'.
    data: jobcount like tbtcjob-jobcount,
          host like msxxlist-host.
    data: begin of starttime.
            include structure tbtcstrt.
    data: end of starttime.
    data: starttimeimmediate like btch0000-char1.
    Job open
      call function 'JOB_OPEN'
           exporting
                delanfrep        = ' '
                jobgroup         = ' '
                jobname          = jobname
                sdlstrtdt        = sy-datum
                sdlstrttm        = sy-uzeit
           importing
                jobcount         = jobcount
           exceptions
                cant_create_job  = 01
                invalid_job_data = 02
                jobname_missing  = 03.
      if sy-subrc ne 0.
                                           "error processing
      endif.
    Insert process into job
    SUBMIT zreport and return
                    with p_param1 = 'value'
                    with p_param2 = 'value'
                    user sy-uname
                    via job jobname
                    number jobcount.
      if sy-subrc > 0.
                                           "error processing
      endif.
    Close job
      starttime-sdlstrtdt = sy-datum + 1.
      starttime-sdlstrttm = '220000'.
      call function 'JOB_CLOSE'
           exporting
                event_id             = starttime-eventid
                event_param          = starttime-eventparm
                event_periodic       = starttime-periodic
                jobcount             = jobcount
                jobname              = jobname
                laststrtdt           = starttime-laststrtdt
                laststrttm           = starttime-laststrttm
                prddays              = 1
                prdhours             = 0
                prdmins              = 0
                prdmonths            = 0
                prdweeks             = 0
                sdlstrtdt            = starttime-sdlstrtdt
                sdlstrttm            = starttime-sdlstrttm
                strtimmed            = starttimeimmediate
                targetsystem         = host
           exceptions
                cant_start_immediate = 01
                invalid_startdate    = 02
                jobname_missing      = 03
                job_close_failed     = 04
                job_nosteps          = 05
                job_notex            = 06
                lock_failed          = 07
                others               = 99.
      if sy-subrc eq 0.
                                           "error processing
      endif.
    Thanks
    Sudheer

Maybe you are looking for