This week's book giveaway is in the Reactive Progamming forum. We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line! See this thread for details.
I am using Eclipse IDE. I have created a new Web Project and created a Servlet. I also created a new Java Project and created a class(LogUtility.java) in it. I want to refer this Java Class from my Servlet. So I refered my Java Project in "Java Build Path" in my Web Project.
Now I imported the Java class in my Java Project to the Servlet and invoked a method in the java class from my Servlet.The Servlet class compiles fine. No error. But when choose to run the servlet, it is throwing the error:
I know that this error will be displayed if JVM is unable to find out the class in the class path. But I dont know how to resolve this error. I have tried creating the Jar file of that entire java project and adding the Jar file in web project's build path. But the result is the same.
Can anybody clear me why this error is occuring? How to resolve the NoClassDefFoundError while refering a Java Project from a Web Project
Why you create a java project, inorder to use the utility (or whatever) classes in your web project. Can't you do the same thing by including utility classes in separate package within your web project? [ November 27, 2008: Message edited by: Vijitha Kumara ]
Why you create a java project, inorder to use the utility (or whatever) classes in your web project. Can't you do the same thing by including utility classes in separate package within your web project?
I want to reuse the java class present in a java project(Assume this class is being used in java project as well). If I move the java class to this web project, I may end up in duplicating the utility class in all the web projects(think in a real life project scenario). Any body have ideas? [ November 27, 2008: Message edited by: Thirugnanam Saravanan ]
Thanks for your suggestion. I resolved the problem by giving the reference to the java project in J2EE module Dependencies section in the Web Project's properties window. Now everything is working fine without even setting the class's jar file in build path.
SCJP 5.0(98%), SCWCD 5.0 (100%), OCA
He's my best friend. Not yours. Mine. You can have this tiny ad: