This may be more of a general Java problem, but I'm not sure. I'm designing a touch interface to use with the music programming software Max/MSP, which allows you to create and use custom Java objects within it. I'm using JavaFX for my graphical stuff (as it will be heavily graphically oriented). But this means that I'm trying to open the JavaFX applications from another source.
What is the best way to deal with this? I have the impression that my JavaFX stuff has to be written as it's own application, and not just as some classes I can call, as it extends the Application class. But please correct me if that is wrong. I tried a simple example of opening up the ColorfulCircles examples application from within Max/MSP, but I get this error (in Max): java.lang.NoClassDefFoundError: javafx/application/Application. Here's the code I'm using:
import com.cycling74.max.*;
public class MaxTest extends MaxObject {
public void bang() {
outlet(0, "Congratulations!");
outlet(0, "Executing...");
new MaxTest().execute("ColorfulCircles");
}
public void execute(String name) {
outlet(0, "Executing...");
Class params[] = {String[].class};
outlet(0, "Class params[] =" + String[].class);
try {
Class.forName(name).
getDeclaredMethod("main", params).
invoke(null, new Object[] {new String[] {}});
}
catch(Exception e){ e.printStackTrace();}
}
}
There error happens after the first printout out of "executing", before the second one. Any tips what I'm doing wrong, or if there's a better, completely different way to go about this? Thanks!
-cullam