ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr_pompeii <dr_pomp...@yahoo.com>
Subject Re: How To: Java Command to Ant
Date Mon, 21 Sep 2009 00:34:48 GMT

Hello supareno

Thanks for the reply, but no woek :-(

This is the Main Class

public class Main {

    public static void main(String[] args) throws IOException {
        ApplicationContext context =
            new ClassPathXmlApplicationContext("beans.xml");

        FileReplicator documentReplicator =
            (FileReplicator) context.getBean("documentReplicator");

        try {
            MBeanServer mbeanServer =
ManagementFactory.getPlatformMBeanServer();
            ObjectName objectName = new
ObjectName("bean:name=documentReplicator");

            ............. a lot of lines  

            mbeanServer.registerMBean(mbean, objectName);
        } catch (JMException e) {
            System.out.println("+++ JMException +++");
        } catch (InvalidTargetObjectTypeException e) {
            System.out.println("+++ InvalidTargetObjectTypeException +++");
        } catch (NoSuchMethodException e) {
            System.out.println("+++ NoSuchMethodException +++");
        }

        System.in.read();
    }
}

Therefore, the original java command
java -classpath D:\TR\...a.jar;D:\TR\b.jar; -Dcom.sun.management.jmxremote
com.jordan.Main	

Is to "feed" the line in the main method  System.in.read();

Some suggestions are welcome

Thanks for your time




supareno wrote:
> 
> dr_pompeii,
> 
> you should try this:
> 
> <target ...>
>   <java ... >
>     [...]
>     <arg value="-Dcom.sun.management.jmxremote" />
>     [...]
>   </java>
> </target>
> (see http://ant.apache.org/manual/CoreTasks/java.html and 
> http://ant.apache.org/manual/using.html#arg)
> 
> i did it tonight on my linux box with a jdk6 and it works well :-)
> 
> hope this help
> 
> supareno
>> Dear Members
>>
>> I have this java comand (related with JMX)
>>
>> java -classpath D:\TR\...a.jar;D:\TR\b.jar;
>> -Dcom.sun.management.jmxremote
>> com.jordan.Main	
>>
>> This work, then I can get a connection from jconsole (PID from Local Tab
>> Pane)
>>
>> The point is that is a long classpath and work for windows, therefore
>> this
>> in Linux is heavy to be changed, 
>> I used to work with ant (I am not an expert), usually with this is enough
>>
>> <target name="run">				 
>>         <java fork="true" classname="com.jordan.Main"
>> classpathref="libraries">
>>             <classpath path="${bindir}"/>          
>>         </java>
>> </target>	 
>>
>> The code work, but I can never get a connection from jconsole because
>> never
>> appear any PID
>>
>> Therefore I need your knowledge, what is misssing in my ant configuration
>>
>> Thanks in advanced
>>   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-To%3A-Java-Command-to-Ant-tp25512317p25530148.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message