The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by astrodavid]

Hi All:

Just wanted to give the readers of this book one possible way to install the
book's sample code into the Eclipse IDE. There are other ways, of course,
and, of course, these instructions may be trivial to some, but I thought I'd
post these instructions, just the same. Note that I haven't gone through all
the examples yet, so there may be some additional work involved to get all of
it to run.

AstroDavid

1. Just unzip the zip file into the Eclipse workspace.
I named my project j3duiBook and unzipped it to
c:eclipseworkspacej3duiBook


2. Move up all of the lib files one level, so that their 'natural' package
order is evident. For example, lib/j3dui/utils/blocks/Blocks.java 's package
is actually j3dui.utils.blocks, and the 'lib' portion should be ignored.

In other words, go to your windows explorer, select the j3dui directory, move
it up a directory, then delete the now empty lib directory.

3. Add a package designation to all the example classes. For example, to
get examples/InputSensors.java to run, add

package examples.InputSensors;

to the first line of the file.

Explanation: Eclipse only allows one "default" package, so to get all the
examples to run, you must divide them into different packages.

Note: You should use Eclipse's built-in debug and run commands now, and can
delete the .bat files.

4. Within "Blocks.java" (j3dui/utils/blocks/Blocks.java), change as
follows:

/** Resource catalog dir relative to example dirs. */
public static final String RESOURCE_DIR =
"resources/";
// "../../resources/";

(Change the String -- commenting out the ../../resources)
Explanation: Eclipse runs programs from the highest level directory in your
project (on my machine it is c:eclipseworkspacej3duiBook), rather than
down relative to the class being run.

5. Modify examples/FancyApp/FancyPallette.java as follows:

addIcons(palette, Blocks.buildResourcePath(
"../lib/j3dui/utils/objects"));

to

addIcons(palette, Blocks.buildResourcePath(
"../j3dui/utils/objects"));

(Deleting the /lib)
Explanation: Since you've moved up the source (and deleted the lib part of it)
you need to change all the references.

Hope this helps!