Author: mladen.turk(a)jboss.com
Date: 2007-10-23 08:10:18 -0400 (Tue, 23 Oct 2007)
New Revision: 1143
Modified:
trunk/utils/windows/native/service/build.xml
trunk/utils/windows/native/service/classes/org/jboss/windows/Service.java
Log:
Remove dependency on run.jar by using reflection
Modified: trunk/utils/windows/native/service/build.xml
===================================================================
--- trunk/utils/windows/native/service/build.xml 2007-10-22 09:31:59 UTC (rev 1142)
+++ trunk/utils/windows/native/service/build.xml 2007-10-23 12:10:18 UTC (rev 1143)
@@ -12,8 +12,8 @@
<!-- Initialization properties -->
<property name="name" value="JBoss Service Helper"/>
<property name="title" value="JBoss Service Helper
Library"/>
- <property name="version" value="1.0.0"/>
- <property name="version.number" value="100"/>
+ <property name="version" value="1.0.1"/>
+ <property name="version.number" value="101"/>
<property name="project" value="jbosssch"/>
<property name="build.dir" value="./dist"/>
<property name="build.src" value="${build.dir}/src"/>
@@ -42,7 +42,6 @@
<!-- Build classpath -->
<path id="classpath">
<pathelement location="${build.dest}/classes"/>
- <pathelement location="./lib/run.jar"/>
</path>
<!-- Test classpath -->
@@ -89,7 +88,7 @@
packagenames="org.jboss.*"
windowtitle="${title} (Version ${version})"
doctitle="<h2>${title}</h2>"
- bottom="Copyright 2006 Red Hat, Inc.<!--
+ bottom="Copyright 2007 Red Hat, Inc.<!--
JBoss, the OpenSource J2EE webOS
Distributable under LGPL license.
Modified: trunk/utils/windows/native/service/classes/org/jboss/windows/Service.java
===================================================================
--- trunk/utils/windows/native/service/classes/org/jboss/windows/Service.java 2007-10-22
09:31:59 UTC (rev 1142)
+++ trunk/utils/windows/native/service/classes/org/jboss/windows/Service.java 2007-10-23
12:10:18 UTC (rev 1143)
@@ -25,6 +25,7 @@
*/
package org.jboss.windows;
+import java.lang.reflect.*;
/**
* Windows sservice helper class.
@@ -33,20 +34,33 @@
{
/**
* This is where the magic begins.
- *
- * <P>Starts up inside of a "jboss" thread group to allow better
- * identification of JBoss threads.
- *
* @param args The command line arguments.
*/
- public static void main(final String[] args) throws Exception
+ public static void main(final String[] args)
+ throws Exception
{
try {
SignalHelper.initialize(null);
}
- catch(Exception e) {
- // Ignore all initialize exceptions
+ catch(Exception x) {
+ // Ignore all native initialization exceptions
}
- org.jboss.Main.main(args);
+ try {
+ Class mainClass = Class.forName(args[0]);
+ Object mainObject = mainClass.newInstance();
+
+ Class paramTypes[] = new Class[1];
+ paramTypes[0] = Class.forName("[Ljava.lang.String;");
+ Object argList[] = new Object[1];
+ String[] cmdArgs = new String[args.length - 1];
+ for (int i = 0; i < cmdArgs.length; i++)
+ cmdArgs[i] = args[i + 1];
+ argList[0] = cmdArgs;
+ Method mainMethod = mainClass.getMethod("main", paramTypes);
+ mainMethod.invoke(mainObject, argList);
+ }
+ catch (Throwable e) {
+ System.err.println(e);
+ }
}
}