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.
IndexProgramming Questions & HelpOther Libraries › can't load libraries after upgrading to 1.0.7 !
Page Index Toggle Pages: 1
can't load libraries after upgrading to 1.0.7 ! (Read 3686 times)
can't load libraries after upgrading to 1.0.7 !
Oct 10th, 2009, 2:35pm
 
hello,

since upgrading to 1.0.7, processing stopped recognizing any external libraries i'm importing.  Cry

i'm trying to place libraries inside username/documents/Processing
or in /libraries/ inside the sketch folder, or even inside the Processing software package itself, though nothing helps.

i'm on OSX 10.5.8
with Java 1.5.0_20

any ideas what's going on?

Re: can't load libraries after upgrading to 1.0.7 !
Reply #1 - Oct 12th, 2009, 1:27am
 
Use 1.0.6? 1.0.7 was made for Snow Leopard and Java 1.6, I understand it is problematic on other versions.
Re: can't load libraries after upgrading to 1.0.7 !
Reply #2 - Oct 12th, 2009, 6:53am
 
i just switched back to 1.0.6 and the problem remains! this is extremely annoying. Processing just ignores the libraries i'm importing, no matter where i place them. (sketches folder, inside the processing package, etc).

when i go to Sketch -> Import Library, i can see all the additional libraries i'm trying to use, however, it seems like Processing is not fully aware of them.

for example, when i try to run this sketch, which uses the Traer Physics library, i'm getting an error saying:
The function advanceTime(float) does not exist.

please help!


Code:
import traer.physics.*;

ParticleSystem physics;
Particle[] particles;

void setup()
{
 size( 400, 400 );
 smooth();
 fill( 0 );
 frameRate( 24 );
 ellipseMode( CENTER );
 physics = new ParticleSystem( 2.0, 0.05 );
 particles = new Particle[10];      
 particles[0] = physics.makeParticle( 1.0, width/2, height/2, 0 );
 particles[0].makeFixed();
 for ( int i = 1; i < particles.length; ++i )
 {
   particles[i] = physics.makeParticle( 1.0, width/2, height/2+i, 0 );
   physics.makeSpring( particles[i-1],  particles[i], 2.0, 0.1, 0.01 );
 }
 
 particles[particles.length-1].setMass( 5.0 );
}

void draw()
{
 physics.advanceTime( 1.0 );
 if ( mousePressed )
 {
   particles[particles.length-1].moveTo( mouseX, mouseY, 0 );
   particles[particles.length-1].velocity().clear();
 }
   
 background( 255 );
 
 beginShape();

 for ( int i = 0; i < particles.length; ++i )
 {
   curveVertex( particles[i].position().x(), particles[i].position().y() );
 }
 curveVertex( particles[particles.length-1].position().x(), particles[particles.length-1].position().y() );
 endShape();

}

void mouseReleased()
{
 particles[particles.length-1].setVelocity( (mouseX - pmouseX), (mouseY - pmouseY), 0 );
}




Re: can't load libraries after upgrading to 1.0.7 !
Reply #3 - Oct 12th, 2009, 6:57am
 
this

http://www.cs.princeton.edu/~traer/physics/

says

"void tick()
void tick( float t )
advance the simulation by some time t, or by the default 1.0. You'll want to call this in draw(). You probably want to keep this the same at all times unless you want speed up or slow things down."
Re: can't load libraries after upgrading to 1.0.7 !
Reply #4 - Oct 12th, 2009, 8:59am
 
Yes, as koogy points out, advanceTime() isn't in the list of known methods for the latest version of traer.physics. Perhaps the sketch you show is using an older version?
If you see the libraries in the Import Library menu, it is likely they are seen by Processing.
Re: can't load libraries after upgrading to 1.0.7 !
Reply #5 - Oct 12th, 2009, 10:01am
 
okay, here's a better example. even the standard opengl libraries are not recognized. i'm getting this error when attempting to run the sketch below:

Exception in thread "Animation Thread" java.lang.RuntimeException: You need to use "Import Library" to add processing.opengl.PGraphicsOpenGL to your sketch.
     at processing.core.PApplet.makeGraphics(PApplet.java:1193)
     at processing.core.PApplet.size(PApplet.java:999)
     at processing.core.PApplet.size(PApplet.java:959)
     at ribcoil1.setup(ribcoil1.java:41)
     at processing.core.PApplet.handleDraw(PApplet.java:1403)
     at processing.core.PApplet.run(PApplet.java:1328)
     at java.lang.Thread.run(Thread.java:613)



Code:


import processing.opengl.*;

cubGira CS;

float fase;
float rot;
int amp, MAXamp, alf;


float x,y;
float inercia =.125;
float deltaX;
float deltaY;
boolean eixos;



void setup() {
 size(640, 480,OPENGL);
 
 background(0);
 mouseX+=280;
 mouseY+=290;
 CS = new cubGira();
 frameRate(25);
 fase=0.0;
 MAXamp=100;
 amp=5;
 alf=100;

}

void draw(){
  background(0);
 deltaX=(pmouseX/2-x);
 deltaY=(pmouseY/2-y);
 deltaX*=inercia;
 deltaY*=inercia;
 x+=deltaX;
 y+=deltaY;

 if(eixos){
 
   stroke(255,400,0);
   //X
   line(0,0,0,8000,0,0);
   stroke(0,255,0);
   //Y
   line(0,0,0,0,8000,0);
   stroke(110,20,255);
   //Z
   line(0,0,0,0,0,8000);
 }

 stroke(80+y,80+y,30);
 rot=x/y+1 ;
camera(6*y, 700.0-y, x+y*2,  2*x+y, -y+240, height-x-200,    -10, 0, 0.0);

 pushMatrix();
 for(int a=0; a<60; a++){
 translate(20,5,90);
   rotateX(fase);

   CS.draw(fase, int(x), a);
 }

 popMatrix();
 fase=fase+0.005%TWO_PI;

}


void mousePressed() {
 if(eixos){
   eixos=false;
    }
 else{
   eixos= true;
   }
}




class cubGira{
public cubGira() {

}
public void draw(float fase, int amp,int tamany){
  pushMatrix();

fill(#00FF00);
translate(-y,float(amp),-x);
 rotateY(y);
 line(30, 20, 285, 175);
 
 popMatrix();
}
}

Re: can't load libraries after upgrading to 1.0.7 !
Reply #6 - Oct 12th, 2009, 10:11am
 
and likewise, any code (as well as from Processing core examples) which includes an external library import does not work Sad
Re: can't load libraries after upgrading to 1.0.7 !
Reply #7 - Oct 13th, 2009, 8:38am
 
anyone??
Re: can't load libraries after upgrading to 1.0.7 !
Reply #8 - Oct 13th, 2009, 9:05am
 
OK, I don't have a Mac, so it is hard to help, but perhaps you can show where your Processing is installed, where your sketchbook is located, where you have put the libraries (although OpenGL comes out of the box, so it is puzzling!).

You upgraded from which version?

Another puzzling point is that you got this error about traer's function, so it might mean the library is actually there, otherwise you would have got a "package does not exist" error instead.
Re: can't load libraries after upgrading to 1.0.7 !
Reply #9 - Oct 13th, 2009, 11:51am
 
i've upgraded from 1.0.6 to 0.7 and then went back to 0.6.

i'm on OSX 10.5.8 with Java 1.5.0_20

my Processing is installed in /Applications. my Processing sketch folder is located in /Documents/Processing/ and within that folder there's a /Libraries/ folder with different libraries (in sub folder each).

... i've tried running different sketches from the examples folder which uses an additional library, and noticed that some of them work. for instance, i can load all the Minim library examples and they work fine.
it's only when i try to load sketches that uses OPENGL. keep getting this error:

Exception in thread "Animation Thread" java.lang.RuntimeException: You need to use "Import Library" to add processing.opengl.PGraphicsOpenGL to your sketch.
     at processing.core.PApplet.makeGraphics(PApplet.java:1193)
     at processing.core.PApplet.size(PApplet.java:999)
     at processing.core.PApplet.size(PApplet.java:959)
     at SpaceJunk.setup(SpaceJunk.java:42)
     at processing.core.PApplet.handleDraw(PApplet.java:1403)
     at processing.core.PApplet.run(PApplet.java:1328)
     at java.lang.Thread.run(Thread.java:613)




Re: can't load libraries after upgrading to 1.0.7 !
Reply #10 - Nov 2nd, 2009, 4:17pm
 
I have the same problem, running Processsing 1.09 on OSX 10.5.8 with Java 1.5.0_20.

Any news on this?
Re: can't load libraries after upgrading to 1.0.7 !
Reply #11 - Nov 4th, 2009, 9:47am
 
I have the same problem, running Processsing 1.09 on Windows XP SP3 with Java 1.6.0.100
When a try to use the Traer Physics library, i'm getting an error saying:
The function advanceTime(float) does not exist.
Thanks!

Code:


import traer.physics.*;

ParticleSystem physics;

Particle[][] particles;
Particle[] anchors;
Particle anchor;

int screenWidth = 400;
int screenHeight = 400;

int gridSize = 10;
float springStrength = 1.0;
float springDamping = 0.1;
float particleMass = 0.1;
float physicsStep = 0.2;
float bounce = 0.8;

float xBoundsMin = 10.0;
float xBoundsMax = screenWidth - 10.0;
float yBoundsMin = 10.0;
float yBoundsMax = screenHeight - 10.0;

void setup()
{
   size(screenWidth, screenHeight);
   smooth();
   fill(0);
   frameRate(60);

   physics = new ParticleSystem(0.2, 0.005);

   particles = new Particle[gridSize][gridSize];

   float gridStepX = (float) ((width / 2) / gridSize);
   float gridStepY = (float) ((height / 2) / gridSize);

   for (int i = 0; i < gridSize; i++)
   {
 for (int j = 0; j < gridSize; j++)
 {
particles[i][j] = physics.makeParticle(0.1, j * gridStepX + (width / 4), i * gridStepY + 20, 0.0);
if (j > 0)
{
   Particle p1 = particles[i][j - 1];
   Particle p2 = particles[i][j];
   physics.makeSpring(p1, p2, springStrength, springDamping, gridStepY);
}
if (i > 0)
{
   Particle p1 = particles[i - 1][j];
   Particle p2 = particles[i][j];
   physics.makeSpring(p1, p2, springStrength, springDamping, gridStepY);
}
 }
   }

   particles[0][0].makeFixed();
   particles[0][gridSize - 1].makeFixed();

   anchors = new Particle[4];
   anchors[0] = particles[0][0];
   anchors[1] = particles[0][gridSize - 1];
   anchors[2] = particles[gridSize - 1][0];
   anchors[3] = particles[gridSize - 1][gridSize - 1];
}

void draw()
{
   physics.advanceTime(physicsStep);

   if (mousePressed)
   {
 anchor.moveTo(mouseX, mouseY, 0);
 anchor.velocity().clear();
   }

   background(255);

   for (int i = 0; i < gridSize; i++)
   {
 for (int j = 0; j < gridSize; j++)
 {
Particle p = particles[i][j];
float px = p.position().x();
float py = p.position().y();
float vx = p.velocity().x();
float vy = p.velocity().y();

if (px < xBoundsMin)
{
   vx *= -bounce;
   p.moveTo(xBoundsMin, py, 0);
   p.setVelocity(vx, vy, 0);
}
else if (px > xBoundsMax)
{
   vx *= -bounce;
   p.moveTo(xBoundsMax, py, 0);
   p.setVelocity(vx, vy, 0);
}
if (py < yBoundsMin)
{
   vy *= -bounce;
   p.moveTo(px, yBoundsMin, 0);
   p.setVelocity(vx, vy, 0);
}
else if (py > yBoundsMax)
{
   vy *= -bounce;
   p.moveTo(px, yBoundsMax, 0);
   p.setVelocity(vx, vy, 0);
}
 }
   }

   for (int i = 0; i < gridSize; i++)
   {
 beginShape( LINE_STRIP );
 curveVertex(particles[i][0].position().x(), particles[i][0].position().y());
 for (int j = 0; j < gridSize; j++)
 {
curveVertex(particles[i][j].position().x(), particles[i][j].position().y());
 }
 curveVertex(particles[i][gridSize - 1].position().x(), particles[i][gridSize - 1].position().y());
 endShape();
   }
   for (int j = 0; j < gridSize; j++)
   {
 beginShape( LINE_STRIP );
 curveVertex(particles[0][j].position().x(), particles[0][j].position().y());
 for (int i = 0; i < gridSize; i++)
 {
curveVertex(particles[i][j].position().x(), particles[i][j].position().y());
 }
 curveVertex(particles[gridSize - 1][j].position().x(), particles[gridSize - 1][j].position().y());
 endShape();
   }

}

void mousePressed()
{
   int mx = mouseX;
   int my = mouseY;
   float d = -1.0;

   for (int i = 0; i < gridSize; i++)
   {
 for (int j = 0; j < gridSize; j++)
 {
float dTemp = distance(mx, my, particles[i][j].position().x(), particles[i][j].position().y());
if (dTemp < d || d < 0)
{
   d = dTemp;
   anchor = particles[i][j];
}
 }
   }
}

void mouseReleased()
{
   if (keyPressed)
   {
 if (key == ' ')
 {
anchor.makeFixed();
 }
   }
   else
   {
 anchor.makeFree();
   }
   anchor = null;
}

float distance(float x1, float y1, float x2, float y2)
{
   float dx = x2 - x1;
   float dy = y2 - y1;
   return sqrt((dx * dx) + (dy * dy));
}
Re: can't load libraries after upgrading to 1.0.7 !
Reply #12 - Nov 4th, 2009, 1:33pm
 
Juanjo wrote on Nov 4th, 2009, 9:47am:
The function advanceTime(float) does not exist.

Yes, that's what we wrote above...
You might be looking at an old example.
Page Index Toggle Pages: 1