Forums > Java

creating mxj object from processing library

April 13, 2012 | 4:19 pm

I’m running a node.js server and have a java library that connects to this server through processing. From there I pass information to max/msp through the max.link library in processing. I would like to take processing out of the equation so I thought to use the java library from processing in an mxj object.
The problem I’m having right now is getting all of the correct java files organized in my file path and compiling them correctly. I have two java classes that rely on each other but after compiling each class I am unable to instantiate the mxj object.

Here is the import section of my code which when I try to instantiate the mxj object I get an error: cannot find constructor. When I compile with the ‘package com.itpredial.tinyphone.client;’ I get an error
java.lang.NoClassDefFoundError: TinyphoneClient (wrong name: com/itpredial/tinyphone/client/TinyphoneClient)

what am I doing wrong here? All of the java files are in the cycling74/classes directory and i have a TinyPhone.jar file in the cycling74/lib directory. What is the difference between import and package? Im not super savvy with java.

/*package com.itpredial.tinyphone.client;*/

import com.cycling74.max.*;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.net.Socket;
import java.net.UnknownHostException;

import com.itpredial.tinyphone.client.TinyphoneEvent;
import com.itpredial.tinyphone.client.TinyphoneEvent.EventType;

Thanks for all of the help!



Jan
April 17, 2012 | 8:18 pm

It´s not really possible to give any "diagnosis" and i have no experience with processing so far.

probably something going wrong with with instantiation of classes… try using the full name names instead of short one like
new com.itpredial.tinyphone.client.TinyphoneEvent() intead of new TinyphoneEvent()
— don’t know if you ever instantiate this particular class… just anx example for the sytax–

What is the difference between import and package? Im not super savvy with java.

in short :

a package is an organized collection of different classes that usually form an application together (or a library)

the import statement declares which classes/packages you will use inside your code that are not of the same package as your class.

jan


Viewing 2 posts - 1 through 2 (of 2 total)