Views
pdj allows you to write OS-independent pd externals in Java. It is a clone of the mxj object for Max/MSP, so that the Java code that you write for pdj should(!) also run fine in mxj.
I found personally hard to install in my Dell Latitude E6400 the current pdj version (0.8.7) under Linux Ubuntu 12.04 with pd-extended 0.43.1 beta.
Here is the procedure I followed:
-
Assume to have ant and Sun Java(TM) Development Kit (JDK) 7 installed (both by synaptic or similar archive manager)
-
download pdj for your OS. Unpack, for example in a separate folder on the ~/Download directory
-
download the puredata 0.43.1 source tarball. Unpack, then copy only the src folder into your existing pd-extended folder. Probably like this:
sudo cp -r src /usr/lib/pd-extended/
-
configure Linux-build.properties inside pdj-0.8.7/ this way through you preferred text editor (edit accordingly if you have an amd64 equivalent machine):
# property file for Linux, now with default ubuntu packages # put the path of where the jdk (java sdk) is installed jdk.home=/usr/lib/jvm/java-7-sun # put the path of where pd is installed pd.home=/usr/lib/pd-extended # common linux properties isLinux=true compiler=gcc linker.type=shared platform=linux # 64-bits system ? uncomment this #jdk.libs=${jdk.home}/jre/lib/amd64 jdk.libs=${jdk.home}/jre/lib/i386 pdj.outfile=${dist.dir}/pdj
-
build inside pdj-0.8.7/:
sudo ant package(I noticed several warnings)
-
copy the folder dist in your additional externals folder of puredata, and rename it as pdj. In my case:
sudo cp -r dist /usr/local/lib/pd-externals/ sudo mv /usr/local/lib/pd-externals/dist /usr/local/lib/pd-externals/pdj
-
add needed classes (folder pdj-0.8.7/work/com) inside the new folder. In my case:
cd /usr/local/lib/pd-externals/pdj/classes sudo cp - r ~/Downloads/temp/pdj-0.8.7/work/classes/com .
-
make the new additional externals visible by puredata (Edit -> Preferences -> New... -> /usr/local/lib/pd-externals/pdj)
-
configure pdj.properties in (the easiest) way for puredata to run the test classes:
# this is the pdj classpath (dynamic) to set : pdj.classpath= # this will print all .jars that are loaded before compiling/loading the # user class pdj.verbose-classloader=true # the type of compiler to use with the pdj classloader. use only 'javac' # or 'jikes'. do not put full path to your compiler # # to disable the automatic compilation simply use # pdj.compiler=null # pdj.compiler=javac # pdj compiler/classloader directory. by default, ${pdj.home}/classes # directory is used if this property is not defined. Before compiling, pdj # will check if your .java needs to be compiled. # #pdj.classes-dir= # this will redirect the java out/err streams to the pd console. If you need # to log pdj errors and exceptions to stderr and stdout, set this to false. # pdj.redirect-pdio=true # the jvm to use. If it is not found and the system is on Windows, # the jvm installed with the registry will be used. Not used on OS X # pdj.JAVA_HOME=/usr/lib/jvm/java-7-sun # the JVM version to use with OS X; linked to the Java Framework on OS X # #pdj.osx.JVM_JAVA_VERSION=1.5.0 # NOTE: pdj.home is set automagicly from where the pdj.pd_linux or pdj.dll # is installed (you need to put it in your pd path in OS X) # ========================================================================= # VM ARGUMENTS # # to monitor memory and thread usage with 1.5 (jconsole) use # -Dcom.sun.management.jmxremote # to do remote debugging at port 8000 # -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 # to check jni calls # -Xcheck:jni -verbose:jni # # All arguments on the same line just like $ java -X... -X... myclass # pdj.vm_args=-Xincgc -Xms32m -Xmx256m # tells pdj what type of jvm it must use: client or server. Not used on # OS X. client has lower starting time and can take less memory. server # starts slower and takes more memory, but once the code is executed, # it will be faster than in client mode. # pdj.vm_type=server
The test patches should work fine at this point.
The following note, left by Hans, may solve visibility problems encountered by puredata, when running a pdj~ module when it is opened for the first time.
-
made a symlink to pdj.pd_linux (GNU/Linux) or pdj.pd_darwin (Mac OS X) and make it called pdj~.pd_linux (GNU/Linux) or pdj~.pd_darwin (Mac OS X) like:
(GNU/Linux)
cd ~/pd-externals ln -s pdj.pd_linux pdj~.pd_linux
(Mac OS X)
cd ~/Library/Pd ln -s pdj.pd_darwin pdj~.pd_darwin