You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here sb (Stringbuilder) indicates the jars read from WEB-INF/lib directory separated by a colon.
The code works in the following scenarios :
1. If the above compilation code is kept in a standalone class file & the relevant libraries are set in the classpath, the compilation from a bash script was successful.
2. I printed the jar files i.e. I printed sb value separately & took a copy of it. I manually ran javac -classpath <sourceCode.java> in the terminal. The compilation was successful.
The code is not working in the following scenarios :
a. When the above code snippet is added as a stand alone program in IDE(Eclipse), I faced NoClassDefFound error for the interface which the sourceCode was implementing.
b. In Tomcat, the relevant jar is present in contextName/WEB-INF/lib/ and in addition to that the jar is added in -useOptions classpath. Even then, I am facing NoClassDefFound error for the the interface the sourceCode was implementing.
Note : There are no duplicate copies of the jar or multiple versions of the jar present in the lib directory or the classpath value.
The text was updated successfully, but these errors were encountered:
In a tomcat server, at run time, I am reading java class files and compiling them dynamically using InMemoryJavaCompiler.
Code Sample -
Here sb (Stringbuilder) indicates the jars read from WEB-INF/lib directory separated by a colon.
The code works in the following scenarios :
1. If the above compilation code is kept in a standalone class file & the relevant libraries are set in the classpath, the compilation from a bash script was successful.
2. I printed the jar files i.e. I printed sb value separately & took a copy of it. I manually ran javac -classpath <sourceCode.java> in the terminal. The compilation was successful.
The code is not working in the following scenarios :
a. When the above code snippet is added as a stand alone program in IDE(Eclipse), I faced NoClassDefFound error for the interface which the sourceCode was implementing.
b. In Tomcat, the relevant jar is present in contextName/WEB-INF/lib/ and in addition to that the jar is added in -useOptions classpath. Even then, I am facing NoClassDefFound error for the the interface the sourceCode was implementing.
Note : There are no duplicate copies of the jar or multiple versions of the jar present in the lib directory or the classpath value.
The text was updated successfully, but these errors were encountered: