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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]