We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › problems adding a new library
Page Index Toggle Pages: 1
problems adding a new library (Read 3431 times)
problems adding a new library
Apr 29th, 2005, 12:26pm
 
hi,
i have some questions about creating a library for processing.
we have developed a simple interface to java3d. it enables users
to build a whole scenegraph with only some lines of code without
deep knowledge of scenegraphs.

the interface is in an alpha stage now and works fine in processing
via a jar in the scetchbook code-folder. now we're trying to make  
it compatible with the new processing library structure.

i read the basic instructions how libraries are working with processing.
as in the instructions described i set up a folder as follows:

pj3d ->
   library ->
   pj3d.jar
   export.txt
   
Then, i placed the folder in the processing 'libraries' folder.
until this point everything works fine. i can add the library
via the "import library" menu. i tried a little sample with the
interface to see how it works in processing version 0.085.
but after pressing the run button processing is knocked out and
i get this error message:

java.lang.NoClassDefFoundError: Pj3d
  at Temporary_7409_7547.setup(Temporary_7409_7547.java:7)
  at processing.core.PApplet.display(PApplet.java:100
  at processing.core.PGraphics.requestDisplay(PGraphics.java:362)
  at processing.core.PApplet.run(PApplet.java:916)
  at java.lang.Thread.run(Thread.java:534)

i dont know why or what the error is throwing. in the basic library
example i see in the constructor of the class the following:

parent.registerDispose(this);

i guess that this method is just registering the dispose. or is it necessary
for processing to register the library in some way?
im wondering that the interface is working fine as a jar in the scetchbook  
code-folder.

for help, thanks in advance

daniel0
Re: problems adding a new library
Reply #1 - Apr 29th, 2005, 3:52pm
 
what's the code that you're using to call your library? i'd need to see what your program looked like.

also, if you're using java3d, you'll need to include those classes as part of the library too, right?
Re: problems adding a new library
Reply #2 - Apr 30th, 2005, 2:18pm
 
hi,

i checked the package of the interface and find a error in the
structure of the package. and i forgot to add the java3d libraries
to the structure, thanks fry.
now i get a prober import statement that looks like:

import m05.Pj3d.*;

and the code to make a reference to pj3d looks like:

void setup()
{
 Pj3d p = new Pj3d(this, 640, 480);
}

processing doesnt crash anymore, but i got a error while compiling:

Semantic Error: The file "Pj3d.class" was found in directory
".../libraries/Pj3d/library/Pj3d.jar/" specified in the CLASSPATH.
However, that class file specifies the type "Pj3d".

.../.processing/build/Temporary_2447_256.java:7:16:7:19: Semantic
Error: Type "Pj3d" was not found.

i take as reference for the structure of the library the sonia library.
the folder structure now of the library looks like:

libraries ->
     Pj3d ->
           library ->
           Pj3d.jar
           export.txt
           the whole j3d stuff
           
the stucture of the Pj3d.jar looks like:

Pj3d.jar
     m05 ->
           Pj3d->
           class files
     META-INF ->
     MANIFEST
     
and the export.txt looks like:

# don't actually export anything.. this is only to link against
# inside of the p5 environment
applet=Pj3d.jar

# for an application, export to prevent from breaking
application=Pj3d.jar,j3dcore.jar,j3dutils.jar,Loader3DS.jar,
vecmath.jar,libJ3D.so,libJ3DUtils.so

i guess theres a little failure in the structure, but i dont know
where .

for help, thanks in advance

daniel05

Re: problems adding a new library
Reply #3 - Apr 30th, 2005, 7:00pm
 
is your jar file set up correctly? is there a folder called 'm05' at the base level, with a folder called Pj3d inside, and then with Pj3d.class inside that? (open the .jar file with a .zip viewer like winzip.. or on the mac, just type unzip -l Pj3d.zip on the terminal).

your Pj3d class, does its .java file read this at the beginning?
package m05.Pj3d;

are you using capitals properly? fwiw, packages shouldn't have caps, only classes:
package m05.pj3d;
would be more correct. but that's not gonna break it, unless you're not being consistent about the caps.

is the .class file somewhere in the library folder too? it should only be in the .jar.

and finally, just to be sure, is pj3d actually a jar file?
Re: problems adding a new library
Reply #4 - May 1st, 2005, 8:53pm
 
hi,

thanks for youre help fry!! all works fine now. i got some bad mistakes
in my thinking about how the packages in p5 works.

also im not so skilled make packages in java...

now we have to make some testings with the new version of p5 and our
package. i hope we can send you soon a version of our package for
discussion.

daniel05

Page Index Toggle Pages: 1