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 › Importing Processing Libraries in Java Mode
Page Index Toggle Pages: 1
Importing Processing Libraries in Java Mode (Read 516 times)
Importing Processing Libraries in Java Mode
Feb 11th, 2010, 11:48am
 
Hello Processing Community,

I have the following problem, maybe someone knows a workaround or a solution for me...

I'm programming in Java Mode - so i can't use in the "*.java" files the import statement for the library (or better: i can use it, but processing doesn't find the library then). In "*.pde" files it works great. I think the problem is, that the sketchbook/libraries folder isn't in the java classpath - but i dont know, what i can do (except: write the library parts all in a "*.pde" file).

I do not use eclipse - only the normal processing environment (and the library i try to get running in "*.java" files is "procontroll").


Thanks for any Ideas!  Smiley

EDIT:
No response yet, so i think its a good idea to expand my post with source code for demonstration:

GamePad.java doesnt find the library
Code:
import procontroll.*;
import net.java.games.input.*;

import processing.core.*;
import java.io.*;


public class GamePad extends Object{

 // procontroll stuff
 protected ControllIO controll;
 protected ControllDevice device;
 protected ControllStick stick;
 protected ControllButton button;
 protected PApplet pApp;
 
 float totalX = width/2;
 float totalY = height/2;
 
 public GamePad(PApplet pApp){
   this.pApp = pApp;
   //prokontroll stuff
   controll = ControllIO.getInstance(this);
   device = controll.getDevice(3);
   device.setTolerance(0.05f);
   ControllSlider sliderX = device.getSlider(2);
   ControllSlider sliderY = device.getSlider(3);
   stick = new ControllStick(sliderX,sliderY);
   button = device.getButton("0");
   totalX = constrain(totalX + stick.getX(),10,width-10);
   totalY = constrain(totalY + stick.getY(),10,height-10);
 }
}


But in a pde, similiar Code works without problems:
Code:
import procontroll.*;
import net.java.games.input.*;
import java.io.*;

// procontroll stuff
ControllIO controll;
ControllDevice device;
ControllStick stick;
ControllButton button;  
float totalX = width/2;
float totalY = height/2;
 
void setup(){
 //prokontroll stuff  
 controll = ControllIO.getInstance(this);
 device = controll.getDevice(3);
 device.setTolerance(0.05f);
 ControllSlider sliderX = device.getSlider(2);
 ControllSlider sliderY = device.getSlider(3);
 stick = new ControllStick(sliderX,sliderY);
 button = device.getButton("0");
 totalX = constrain(totalX + stick.getX(),10,width-10);
 totalY = constrain(totalY + stick.getY(),10,height-10);
}


Page Index Toggle Pages: 1