Have you ever seen java.lang.NoClassDefFoundError: sun.reflect.SerializationConstructorAccessorImpl while running from your application via Ant target.???. ever wondered how come this error when you run an application, but never conflicted while compiling with current set of jar files??..
You must have speculated reasons like
- Java version might be a problem , Hey jdk_14XX is not right lets switch to jdk_13..
- May be my ant version is not rite or conflicting with jdk version.
The main reason is Ant and its Virtual machine. whenever we write
Solution
All you have to add fork="true" (some ppl do it "yes" option too..feel free to experiment:)), to your Ant
From above tweak we say use another VM . which means it kicks in class execution in another VM.
tasks will look something like this
><javac srcdir="${src_dir}" fork="true" destdir="${deploy_dir}"><classpath refid="class.path"></javac><java classname="" fork="true"><classpath refid="class.path"></java>
No comments:
Post a Comment