|
|
Re: plugins installed but class not found [message #207383 is a reply to message #207375] |
Wed, 23 January 2008 21:16 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
John J Barton wrote:
> Chriss wrote:
>> I am a developer that is new to the eclipse IDE (version 3.3.1) and
>> have downloaded some tutorials to learn more about struts and
>> eclipse. I am receiving the following error:
>> The project was not built since its build path is incomplete. Cannot
>> find the class file for javax.servlet.http.HttpServletRequest. Fix the
>> build path then try building this project
>> and:
>> The project was not built since its build path is incomplete. Cannot
>> find the class file for junit.framework.TestCase. Fix the build path
>> then try building this project
>> The plugins are installed (with the WTP 2.0.1) and are displayed in
>> the list of plugins through the Help>About Elcipse option.
>> I have tried opening the project using the -clean parameter as well as
>> cleaning the project before and after the eclipse restart.
>> Am I missing something in the configuration of the build path? My jre
>> and jdk are installed, and the jre system library seems to be fine. I
>> have set the compiler compliance level to 6.0 and the project facets
>> to 6.0. (I had another problem with that, but figured it out.)
>> Why is it not finding the classes when I try to build?
>>
>> Thank you,
>> Chriss
>>
> Plugins are about the development environment and your errors are about
> your own project. To fix the errors you need to adjust your project, not
> the plugin list.
>
> Unfortunately since the dawn of java the class path has been a headache
> and dev tools just make it worse.
>
> Try PackageExplorer->(your
> project)->RightClick->BuildPath->ConfigureBuildPath.
>
> In the libraries tab you should see servlet-api.jar or something like.
> Else you have a lot of buttons on the right side you can push and look
> for the libraries.
>
> John.
Since you have a faceted project, or possibly a Dynamic Web Project,
open the Properties dialog for the project and select the Targeted
Runtime page. It's the target runtime that should provide the
HttpServletRequest class, so I would assume no target runtime is
checked. If there is an appropriate target runtime listed, check that
one. If none are listed, click New and create a Basic - J2EE Preview
target runtime and use that if you don't what to create one for a more
specific server. The J2EE Preview runtime would let you use the Dynamic
Web Module facet up to version 2.4. This is the typical approach for
getting HttpServletRequest on the class path, though this and John's
approach both fix the build problem. It also has the advantage of not
creating a warning in the Problems view that would suggest including the
jar in what is published for the module (i.e. include it in
WEB-INF/lib), which doing so would be a big mistake.
Cheers,
Larry
|
|
|
|
Re: plugins installed but class not found [message #207431 is a reply to message #207391] |
Thu, 24 January 2008 13:47 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
Chriss wrote:
> Thanks to both of you.
> I have tried to add the JAR files using the build path configuration
> numerous times from adding external jars to creating my own classpath
> variables and nothing has seems to work. I added the targeted runtime
> and that seems to have fixed the javax problem, and I apparently had
> only tried to add the javax and not the JUnit to the build path
> configuration. They are both working now.
> Just a newby question, what does adding the target runtime do?
> Thank you very much for the help.
> Chriss
A faceted project is assumed to contain a module that is destined to run
on a server. That server is expected to supply runtime classes related
to that server. For example, a servlet container, such as Tomcat, is
expected to supply the javax.servlet.* classes, among others.
Specifying the target runtime is just a simpler and less error prone way
to add the server's runtime classes to the build path of the project.
Classes not supplied by the server should be added to the project's
module. To do so, you can use the J2EE Module Dependencies page or Java
Build Path page. If you add a dependency using the Java Build Path
Libraries tab, check the Problems view. You will likely see a warning
that the dependency currently isn't published. This means it is used
for compiling but won't be available in the module at runtime. You can
use the Quick Fix for the problem item to have the dependency published
so it will be available at runtime.
Cheers,
Larry
|
|
|
Re: plugins installed but class not found [message #207566 is a reply to message #207431] |
Mon, 28 January 2008 14:49 |
Rob Frost Messages: 64 Registered: July 2009 |
Member |
|
|
Note: Classpath entries can be selected for publish/export via either the
Quick Fix or via the J2EE Module Dependencies page (once added to the build
path, they show up for selection in this dialog as well).
As of 3.0 M4, the J2EE Module Dependencies UI is shown for utility projects
that are only referenced by a dynamic web project (before this, the Quick
Fix was the only way to manage these dependencies); the Quick Fix also
includes an option now to selectively suppress the "XXX will not be exported
or published" warning.
See http://wiki.eclipse.org/ClasspathEntriesPublishExportSupport for
details.
"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:fna4ts$orm$1@build.eclipse.org...
> Chriss wrote:
>> Thanks to both of you.
>> I have tried to add the JAR files using the build path configuration
>> numerous times from adding external jars to creating my own classpath
>> variables and nothing has seems to work. I added the targeted runtime
>> and that seems to have fixed the javax problem, and I apparently had only
>> tried to add the javax and not the JUnit to the build path configuration.
>> They are both working now.
>> Just a newby question, what does adding the target runtime do?
>> Thank you very much for the help.
>> Chriss
>
> A faceted project is assumed to contain a module that is destined to run
> on a server. That server is expected to supply runtime classes related to
> that server. For example, a servlet container, such as Tomcat, is
> expected to supply the javax.servlet.* classes, among others. Specifying
> the target runtime is just a simpler and less error prone way to add the
> server's runtime classes to the build path of the project.
>
> Classes not supplied by the server should be added to the project's
> module. To do so, you can use the J2EE Module Dependencies page or Java
> Build Path page. If you add a dependency using the Java Build Path
> Libraries tab, check the Problems view. You will likely see a warning
> that the dependency currently isn't published. This means it is used for
> compiling but won't be available in the module at runtime. You can use
> the Quick Fix for the problem item to have the dependency published so it
> will be available at runtime.
>
> Cheers,
> Larry
|
|
|
Powered by
FUDForum. Page generated in 0.05079 seconds