开发者

Why does a non-forked ANT Java task not see some required classes?

开发者 https://www.devze.com 2023-04-04 23:30 出处:网络
I am experiencing this problem where if I start my server application as a forked Java task , it works fine (but annoyingly grabs the System.in()input)but when I try to run the Java task as unforked (

I am experiencing this problem where if I start my server application as a forked Java task , it works fine (but annoyingly grabs the System.in() input) but when I try to run the Java task as unforked (in order to retain the system input), it cant find some of the classes ( specifically a javax ssl package).

Is this an issue where I need to include a task argument like includeJavaRuntime="true" or something? This erro开发者_高级运维r suggests to me that the classloader is different when non-forked.


Yes, it's a classloader problem. Most likely the jar you need is missing from the system classpath.

It's actually safer to always run Java processes in a separate thread, using a classpath you provide and specify for them.

<path id="classpath.id">
        <fileset ...
</path>

<java fork="true" classpathref="classpath.id" ....
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号