For passing arguments to the java virtual machine you have to use <jvmarg> not <arg>. <arg> passes arguments to your applications main()-Method.
<target name="run"> <java classname="examples.HelloClient" fork="yes" failonerror="true"> <jvmarg value="-Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory" /> <jvmarg value="-Djava.naming.provider.url=t3://localhost:7001 "/> <classpath> <pathelement path="C:\j2sdk1.4.0_01\lib" /> <pathelement path="c:\jakarta-ant-1.5.1\lib" /> <pathelement location="C:\j2sdkee1.3\lib\j2ee.jar" /> <pathelement path="." /> <pathelement location="D:\bea\weblogic700\server\lib\weblogic.jar" /> <pathelement location=".\deployment\MyHello.jar" /> <classpath> </java> </target> > -----Ursprüngliche Nachricht----- > Von: ZHOU,SHENG (HP-China,ex2) [mailto:[EMAIL PROTECTED]] > Gesendet am: Freitag, 6. Dezember 2002 10:24 > An: Ant Users List > Betreff: RE: a question about pass parameter to java > > Hi, thanks for reply . > > I changed build.xml as followed: > > <target name="run"> > <java > classpath="C:\j2sdk1.4.0_01\lib;c:\jakarta-ant-1.5.1\lib;C:\j2 > sdkee1.3\lib\j > 2ee.jar; > > .;D:\bea\weblogic700\server\lib\weblogic.jar;.\deployment\MyHe > llo.jar" > classname="examples.HelloClient" fork="yes" > failonerror="true"> > <arg > line="-Djava.naming.factory.initial=weblogic.jndi.WLInitialCon > textFactory > -Djava.naming.provider.url=t3://localhost:7001 "/> > > </java> > </target> > > But the output result same as before . > > C:\Temp\Hello>ant run > Buildfile: build.xml > > run: > [java] javax.naming.CommunicationException: Can't find > SerialContextProvide > r > [java] at > com.sun.enterprise.naming.SerialContext.getProvider(SerialCon > text.java:66) > [java] at > com.sun.enterprise.naming.SerialContext.lookup(SerialContext. > java:154) > [java] at > javax.naming.InitialContext.lookup(InitialContext.java:347) > [java] at examples.HelloClient.main(Unknown Source) > [java] Exception in thread "main" > > BUILD FAILED > file:C:/Temp/Hello/build.xml:51: Java returned: 1 > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 06, 2002 5:14 PM > To: 'Ant Users List' > Subject: AW: a question about pass parameter to java > > > There is another way to send parameters to Java. > Try: > > <java > fork="yes" > > classpath="C:\j2sdk1.4.0_01\lib;c:\jakarta-ant-1.5.1\lib;C:\j2 > sdkee1.3\lib\j > 2ee.jar;.;D:\bea\weblogic700\server\lib\weblogic.jar;..\deploy > ment\MyHello.j > ar" > classname="examples.HelloClient" > > <arg > line="-Djava.naming.factory.initial=weblogic.jndi.WLInitialCon > textFactory > -Djava.naming.provider.url=t3://localhost:7001 "/> > </java> > > > Best > Meinolf > > > > -----Ursprüngliche Nachricht----- > Von: ZHOU,SHENG (HP-China,ex2) [mailto:[EMAIL PROTECTED]] > Gesendet am: Freitag, 6. Dezember 2002 10:06 > An: Ant Users List > Betreff: RE: a question about pass parameter to java > > Hi, thanks for reply . > > I have add the weblogic.jar to the classpath . > The classpath as followed: > > classpath=C:\j2sdk1.4.0_01\lib;c:\jakarta-ant-1.5.1\lib;C:\j2s > dkee1.3\lib\j2 > ee.j > ar;.;D:\bea\weblogic700\server\lib\weblogic.jar;..\deployment\ > MyHello.jar > > I found when I input the following command on shell(which > is win2000): > > java > -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory > -Djava.naming.provider.url=t3://localhost:7001 examples.HelloClient > > the output result is OK ! > > but when I altered the input as followed: > > java examples.HelloClient > -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory > -Djava.naming.provider.url=t3://localhost:7001 > > the output result is same as the wrong result which is > outputed by inputing > : ant run . > So I think it's a parameter sending promblem , the parameter > is passed to > shell not java . > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 06, 2002 4:56 PM > To: [EMAIL PROTECTED] > Subject: AW: a question about pass parameter to java > > > I don´t know WLS. Where is the class > weblogic.jndi.WLInitialContextFactory? > Add that JAR to the classpath, too. > > > Jan Matčrne > > > -----Ursprüngliche Nachricht----- > > Von: ZHOU,SHENG (HP-China,ex2) [mailto:[EMAIL PROTECTED]] > > Gesendet am: Freitag, 6. Dezember 2002 09:53 > > An: Ant Users List > > Betreff: RE: a question about pass parameter to java > > > > Hi thanks for the reply. > > > > when I changed the related part in build.xml as followed: > > > > <target name="run"> > > <java classname="examples.HelloClient" fork="yes" > > failonerror="true"> > > <jvmarg > > value="-Djava.naming.factory.initial=weblogic.jndi.WLInitialCo > > ntextFactory"/ > > > > > <jvmarg > > value="-Djava.naming.provider.url=t3://localhost:7001" /> > > <classpath> > > <pathelement path="${classpath};${deploy}/MyHello.jar"/> > > </classpath> > > </java> > > </target> > > > > the run result still wrong as followed : > > > > ant run > > Buildfile: build.xml > > > > run: > > [java] javax.naming.NoInitialContextException: Cannot > instantiate > > class: we > > blogic.jndi.WLInitialContextFactory. Root exception is > > java.lang.ClassNotFoundE > > xception: weblogic.jndi.WLInitialContextFactory > > [java] at > > java.net.URLClassLoader$1.run(URLClassLoader.java:198) > > [java] at > java.security.AccessController.doPrivileged(Native > > Method) > > [java] at > > java.net.URLClassLoader.findClass(URLClassLoader.java:186) > > [java] at > > java.lang.ClassLoader.loadClass(ClassLoader.java:306) > > [java] at > > sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) > > > > [java] at > > java.lang.ClassLoader.loadClass(ClassLoader.java:262) > > [java] at > > java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322) > > > > [java] at java.lang.Class.forName0(Native Method) > > [java] at java.lang.Class.forName(Class.java:207) > > [java] at > > com.sun.naming.internal.VersionHelper12.loadClass(VersionHelp > > er12.java:42) > > [java] at > > javax.naming.spi.NamingManager.getInitialContext(NamingManage > > r.java:649) > > [java] at > > javax.naming.InitialContext.getDefaultInitCtx(InitialContext. > > java:243) > > [java] at > > javax.naming.InitialContext.init(InitialContext.java:219) > > [java] at > > javax.naming.InitialContext.<init>(InitialContext.java:195) > > [java] at examples.HelloClient.main(Unknown Source) > > [java] Exception in thread "main" > > > > BUILD FAILED > > file:C:/Temp/Hello/build.xml:49: Java returned: 1 > > > > Total time: 2 seconds > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Friday, December 06, 2002 4:27 PM > > To: [EMAIL PROTECTED] > > Subject: AW: a question about pass parameter to java > > > > > > java > > -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory > > -Djava.naming.provider.url=t3://localhost:7001 examples.HelloClient > > > > ==> > > > > <java classname="examples.HelloClient"> > > <jvmarg > > value="-Djava.naming.factory.initial=weblogic.jndi.WLInitialCo > > ntextFactory" > > /> > > <jvmarg > value="-Djava.naming.provider.url=t3://localhost:7001" /> > > </java> > > > > > > For more information see the manual. (CoreTask | java) > > > > > > Jan Matčrne > > > > > > > -----Ursprüngliche Nachricht----- > > > Von: ZHOU,SHENG (HP-China,ex2) [mailto:[EMAIL PROTECTED]] > > > Gesendet am: Freitag, 6. Dezember 2002 09:23 > > > An: Ant Users List > > > Betreff: a question about pass parameter to java > > > > > > Hi, guys ! I am a newbie for ant . > > > > > > I meet a problem when I use ant ,pls help me ! > > > If I input command to run java class(which is HelloClient , a > > > very simple > > > program) > > > > > > java -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextF > > > actory -Djava.naming.provider.url=t3://localhost:7001 > > > examples.HelloClient > > > The output is OK as followed: Hello, World! > > > But When I use build.xml the related part is as followed: > > > <target name="run"> > > > <java classname="examples.HelloClient" fork="yes" > > > failonerror="true"> > > > <arg value="t3://localhost:7001"/> > > > <classpath> > > > <pathelement path="${classpath};${deploy}/MyHello.jar"/> > > > </classpath> > > > </java> > > > </target> > > > > > > When I input : ant run > > > > > > the output is as followed: > > > > > > Buildfile: build.xml > > > > > > run: > > > [java] javax.naming.CommunicationException: Can't find > > > SerialContextProvider > > > [java] at > > > com.sun.enterprise.naming.SerialContext.getProvider(SerialCont > > > ext.java:66) > > > [java] at > > > > > > com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:154) > > > [java] at > > > javax.naming.InitialContext.lookup(InitialContext.java:347) > > > [java] at examples.HelloClient.main(Unknown Source) > > > [java] Exception in thread "main" > > > > > > BUILD FAILED > > > file:C:/Temp/Hello/build.xml:49: Java returned: 1 > > > > > > Total time: 8 seconds > > > > > > It look like the parameter is incorrectly pass to shell not > > java.exe . > > > > > > > > > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> >