The Java application as "Service" of Windows NT feature stops with log-off
operation.
This might be well-known issue, but some reason makes me update this issue again.(details, please see the comment.)
1. Reproduce
1) Compile the attached sample code
This program will output the date once 10 seconds to "SigTest.out" file.
2) Install the "Service Installer"
As to the "Service Installer", please see the URL,
http://www.kcmultimedia.com/javaserv
3) Install the above Java application of 1) with "Service Installer"
4) Set the "service" property
- Open the [Control Panel]-[service]
- Select the installed java application("sigtest")
- Click the "Startup Button", set the "StartUp Type" to "Manual"
and set the checkbox to "Allow Service to Interact with Desktop"
5) Click the "Start Button"
-> You can see the MS-DOS window show up.
6) Please see the contents of "SigTest.out" file.
7) Log off from the NT system
8) Log in again
-> Please check whether the date information output to "SigTest.out"
or not.
You will not see the date information updated.
2. Configration
- MPU : Pentium IV 1.4[GHz]
- Memory : 384 [MHz]
- OS : Windows NT (SP5, Japanese)
- JDK : Merlin and JDk1.3.1_02
H:\>java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
H:\sigtest>java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
3. Sample Code
import java.io.* ;
import java.util.* ;
public class SigTest {
public static void main ( String args[] ){
try {
while ( true ) {
Date current = new Date () ; /* current date */
PrintWriter fout
= new PrintWriter( new FileWriter("SigTest.out", true), true );
/* out put file to monitor thread */
fout.println( current.toString() ) ;
// System.out.println( current.toString() ) ;
fout.close() ;
Thread.sleep(10000) ;
}
} catch ( Exception excp) {
System.out.println( excp.toString() ) ;
}
}
}
4. Note
This does not happen with JDK1.2.2_008
H:\sigtest>java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2_008, native threads, symcjit)
2002-02-18
===============================================================================