[eclipse] Errors with import or package

F

Franz Mayer

Hi,

I have a odd problem with eclipse 3.0.1 for Win.

When I import some of my package or class, eclipse recommened the
packages & classes in my project. But when I save the project (or
java-file) eclipse shows a lot of errors, because it doesn't find the
package or class. (See code-cutout below)

But my ant-script compiles the source without any message. And the
JSP- and Java-Code runs without problems.

Thanks in advance.
greez Franz


---Code---
package wgims;
[... more imports (nor messages or errors) ...]
import wgims.tools.EnvEntries; // ERROR: The import
wgims.tools.EnvEntries cannot be resolved
---Code---
 
C

Collin VanDyck

Franz said:
Hi,

I have a odd problem with eclipse 3.0.1 for Win.

When I import some of my package or class, eclipse recommened the
packages & classes in my project. But when I save the project (or
java-file) eclipse shows a lot of errors, because it doesn't find the
package or class. (See code-cutout below)

But my ant-script compiles the source without any message. And the
JSP- and Java-Code runs without problems.

Thanks in advance.
greez Franz

Franz,

Go into your project properties (make sure it's a Java project), and go
to the Java Build Path category and then click on the Libraries tab.

There, you should add in any jars that are included with your project
(Add Jars...) as well as any jars that might be referenced once your
project is deployed (Add external Jars...)

Also, if you are having general package recommendation errors with
Eclipse, make sure that your source folders are set correctly.

As an example, in my Java project, I have a src/java directory that
contains all of my java source. Under project properties -> Java Build
Path -> Source (tab), I added the folder src/java. That resolves a lot
of package related errors that Eclipse will report when it thinks that
your project root is the base for your Java source files.

Hope that helps
Collin
 
F

Franz Mayer

Hi Collin,

Collin said:
Franz,

Go into your project properties (make sure it's a Java project), and go
to the Java Build Path category and then click on the Libraries tab.

There, you should add in any jars that are included with your project
(Add Jars...) as well as any jars that might be referenced once your
project is deployed (Add external Jars...)
for a while it fixed the problem - but probably it was just an accident ;-)
Also, if you are having general package recommendation errors with
Eclipse, make sure that your source folders are set correctly.
I don't get it. What does the source folders mean? (window-pref
java>build path)

I have my java classes and my eclipse-project files in eclipse/workspace/
In "Source folder name" is the value src
In "output folder name" is the value bin
As an example, in my Java project, I have a src/java directory that
contains all of my java source. Under project properties -> Java Build
Path -> Source (tab), I added the folder src/java. That resolves a lot
of package related errors that Eclipse will report when it thinks that
your project root is the base for your Java source files.
I added under project-properties java build path>Source edit included.
There added the folder with all my source (wgims). But it refreshed only
and after a short while the errors occured again.

One (maybe) interesting error I forgot to note:

In some classes eclipse say (the error has no location line):
A class file was not written. The project may be inconsistent, if so try
refreshing this project and building it

Thanks in advance.
greez Franz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top