nehe in Eclipse

Sorry to drop simple questions again.

I downloaded all nehe java courses from
http://www.tecgraf.puc-rio.br/~ismael/Cursos/Cidade_CG/labs/OpenGL/NeHe%20Java%20ports%20at%20The%20Pumpkin%20Farm.htm

and I’m currently downgrade JOGL from 2.X to 1.1.1a

Nehe is able to be compiled.

However, when porting into Eclipse, it looks that whenever I would like to import what’s in demos.common,
I have some “red crosses” over the files.

For instance,

demos.nehe.lesson06
Renderer.java
has a red cross at line 9, which indicates

“import demos.common.TextureReader;” is buggy.

So, can you please give me a hand on how to avoid all such kinds of red crosses when compiling nehe in Eclipse?

Best Regards
JIA

Do you have the file demos/common/TextureReader.java?

Yes, I checked already.
Definitely yes !!!

Here is the output from bash


jiapei@jiapei-laptop:~/MyPrograms/Eclipse/nehe$ ls src/demos/common/
BitmapLoader.java      GLDisplay.java    LittleEndianDataInputStream.java  TextureReader.java
ExceptionHandler.java  HelpOverlay.java  ResourceRetriever.java
jiapei@jiapei-laptop:~/MyPrograms/Eclipse/nehe$

Seriously have no idea how this happens. Is it possible that is an Eclipse bug?

Cheers
JIA

In the Properties for the project,

  1. Under Resource what is listed for Location?
  2. Under Java Build Path, in the Source tab, what is listed?
  3. If the answers are respectively /home/jiapei/MyPrograms/Eclipse/nehe and NeHe/src (or whatever the project name is), does F3 on the red-underlined import take you to the java file?

Yes,
Resource->Location is /home/jiapei/MyPrograms/Eclipse/nehe and
Java Build Path->Source is nehe/src

F3 brings me to the corresponding Java file !!

I tried to turn off Eclipse and start it again. Still, loads of “red crosses”.

Bugs of Eclipse?

Rgds
JIA

Yep, that’s an Eclipse bug. I find that selecting the project and going Project | Clean twice usually fixes it.

I pressed “F5” many times already !!!
Still, loads of “red crosses” … ooops… ??? :-\

simple delete nehe and readd it back to Eclipse, now, all “red crosses” disappear.
No idea why it is so but it works fine now.

cheers
JIA

F5 is refresh - it re-reads the filesystem. It’s quite frequent (IME, at least) that after F5 you need to Project | Clean, which by default doesn’t seem to have a key binding.

Personally, I avoid using the Java Builder of Eclipse and it solves this problem. You can use ANT or Maven to build your projects. pjt33’s workaround works fine.