You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Dmitry M. Kononov" <dm...@gmail.com> on 2006/07/27 13:31:46 UTC
[classlib][tools] Should launcher pass the required jars to JVM's class path automatically?
Hi,
I've developed a tool (it's a replacement of javah for Harmony) that
depends on BCEL. I've found a way how it can be integrated into the
current build system, so it compiles successfully. The compiled
classes are placed into the deploy\jdk\lib\tools.jar. bcel-5.0.jar is
copied into the deploy\jdk\lib directory. So the build works and
results look as expected.
I do the following to run the tool (whose name is ijh at the moment).
1.copy deploy\jdk\jre\bin\java.exe to deploy\jdk\jre\bin\ijh.exe
2.copy deploy\jdk\lib\tools.jar into deploy\jdk\jre\bin\
3.copy deploy\jdk\lib\bcel-5.0.jar into deploy\jdk\jre\bin\
4.run ijh.exe
And see the usage info of the tool. This means that the launcher finds
appropriate classes of tools.jar successfully. Cool.
But if I run ijh.exe with a class as an argument (bcel's classes are
required in this case) as follows:
ijh.exe Test01
JVM can't find bcel's classes. So it looks like I have to provide the
correct class path which includes bcel-5.0.jar. Ok.
To do so I run the tool in this way:
ijh.exe -J-cp bcel-5.0.jar;. Test01
This works. But the problem is that it's a bad approach to pass all
the required jars in a command line.
It would be better if the launcher adds bcel-5.0.jar to the class path
for the ijh tool in some automatic manner.
Could you please explain me what is the correct way to solve this problem?
Thanks.
--
Dmitry M. Kononov
Intel Managed Runtime Division
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][tools] Should launcher pass the required jars to JVM's class path automatically?
Posted by "Dmitry M. Kononov" <dm...@gmail.com>.
Hi,
On 7/27/06, Tim Ellison <t....@gmail.com> wrote:
> We were discussing our options recently. The javac tool loads the
> compiler JAR itself explicitly [1] (rather than relying on it being on
> the classpath), but we also discussed simply putting all the jars found
> in jdk/lib on the classpath when a tool is being invoked. I think that
> the latter is a reasonable solution, so it requires some changes to the
> launcher to construct the classpath as well as allowing it to be run
> from the jdk/bin dir.
Great. I like the latter mentioned solution! :)
Thanks a lot.
--
Dmitry M. Kononov
Intel Managed Runtime Division
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org
Re: [classlib][tools] Should launcher pass the required jars to JVM's
class path automatically?
Posted by Tim Ellison <t....@gmail.com>.
Dmitry M. Kononov wrote:
> Hi,
>
> I've developed a tool (it's a replacement of javah for Harmony) that
> depends on BCEL. I've found a way how it can be integrated into the
> current build system, so it compiles successfully. The compiled
> classes are placed into the deploy\jdk\lib\tools.jar. bcel-5.0.jar is
> copied into the deploy\jdk\lib directory. So the build works and
> results look as expected.
>
> I do the following to run the tool (whose name is ijh at the moment).
>
> 1.copy deploy\jdk\jre\bin\java.exe to deploy\jdk\jre\bin\ijh.exe
> 2.copy deploy\jdk\lib\tools.jar into deploy\jdk\jre\bin\
> 3.copy deploy\jdk\lib\bcel-5.0.jar into deploy\jdk\jre\bin\
> 4.run ijh.exe
>
> And see the usage info of the tool. This means that the launcher finds
> appropriate classes of tools.jar successfully. Cool.
>
Great.
> But if I run ijh.exe with a class as an argument (bcel's classes are
> required in this case) as follows:
>
> ijh.exe Test01
>
> JVM can't find bcel's classes. So it looks like I have to provide the
> correct class path which includes bcel-5.0.jar. Ok.
> To do so I run the tool in this way:
>
> ijh.exe -J-cp bcel-5.0.jar;. Test01
>
> This works. But the problem is that it's a bad approach to pass all
> the required jars in a command line.
> It would be better if the launcher adds bcel-5.0.jar to the class path
> for the ijh tool in some automatic manner.
>
> Could you please explain me what is the correct way to solve this
> problem?
We were discussing our options recently. The javac tool loads the
compiler JAR itself explicitly [1] (rather than relying on it being on
the classpath), but we also discussed simply putting all the jars found
in jdk/lib on the classpath when a tool is being invoked. I think that
the latter is a reasonable solution, so it requires some changes to the
launcher to construct the classpath as well as allowing it to be run
from the jdk/bin dir.
[1]
http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/javac/Compiler.java?view=markup
Regards,
Tim
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org