Java Servlet Project And Android Library Project In Eclipse - Noclassdeffounderror
Solution 1:
Solved !
- remove the dependency from DataServlet's java build path
go to theClean the MonitoringModel projectMonitoringModel
project and remove the library attribute, run it as an Android app remake it into a library (from here)- grab the monitoringmodel.jar from bin/ and drop it into the
DataServlet/WEB-INF/lib
- refresh and run on server
- done !
Will try and improve on this hack (linking to an external jar did not seem to work btw) - any better ideas will be accepted as an answer - however closing this for now.
EDIT : apparently step 3. can be substituted by creating a hard link from DataServlet/WEB-INF/lib/monitoringmodel.jar
to monitoringmodel.jar - still testing this as some action sequences break the link methinks. Symbolic links do not seem to work though - reported this as a bug
EDIT2 : the steps below seem to work too - but I leave the manual procedure as it definitely works
- remove the dependency from DataServlet's java build path
Hard link the monitoringmodel.jar from bin/ and to the
DataServlet/WEB-INF/lib
. I used shell link extension but this :mklink /H c:\path\to\WebContent\WEB-INF\lib\monitoringmodel.jar c:\path\to\bin\monitoringmodel.jar
should also work
Now everytime you make a change in monitoring model the jar is updated. You only have to refresh the servlet project (will be redeployed on server on its own by default)
Clarification : of course the servlet project is not meant to use android.*
classes - this was not my issue - my issue was to have the model code in one place and this place had to be an android library
Solution 2:
First of all - I believe Java Web Project will not work with any of Android specific classes due to many reasons.
If your MonitoringModel contains some Java code that you want to share between Android and Web application you can extract it to separate Java project and use a Link Source
option in Properties->Build Path
to link it to both projects.
Post a Comment for "Java Servlet Project And Android Library Project In Eclipse - Noclassdeffounderror"