We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
i am new to processing and this forum so i hope i put my question into the right section.
i managed to get Processing working with Intellij IDEA (Windows 7, Java8, Proceesing 2.2.1). I created a simple sketch that compiles and starts nicely:
public class Simple extends PApplet
{
/* main method of sketch */
static public void main(String[] passedArgs)
{
String[] appletArgs = new String[]{"demo.Simple"};
if (passedArgs != null)
{
PApplet.main(concat(appletArgs, passedArgs));
}
else
{
PApplet.main(appletArgs);
}
}
/* sketch initial setup */
public void setup()
{
size(300, 200);
background(0);
}
/* put something on the stage */
public void draw()
{
// Draw gray box
int d = 20;
int p1 = d;
int p2 = p1 + d;
int p3 = p2 + d;
int p4 = p3 + d;
stroke(153);
line(p3, p3, p2, p3);
line(p2, p3, p2, p2);
line(p2, p2, p3, p2);
line(p3, p2, p3, p3);
}
}
the output i get:
So stage shows up, box gets drawn, everything fine.
The problem i have is: i can't get video working. I added the following files to my classpath:
(a full text list you can see here: pastebin.com/kTqzL1vW)
but the Video doesn't get displayed. The code i use works fine with the Processing IDE so i guess i just forgot to add something to the classpath or to add additional VM parameters so that the native libs can be found (my guess).
i also tryed to add the following VM parameter to my RUN configuration:
-Djava.library.path=C:/path/to/native/libs
still, all i see is a black screen, no video playing, no exceptions or log output displayed :(
Here is my sample code i use for the Video sample:
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import processing.video.*;
import java.io.File;
public class Simple extends PApplet
{
public processing.video.Movie myMovie;
public void setup()
{
size(300, 200);
background(0);
// load movie for first window
final File movieFile = new File("./data/blue-HD.mp4");
myMovie = new Movie(this, movieFile.getAbsolutePath());
myMovie.loop();
if (!movieFile.exists()) System.out.println("movie file NOT found.");
}
public void draw()
{
image(myMovie, 0, 0);
}
// Called every time a new frame is available to read
void movieEvent(Movie m)
{
m.read();
System.out.println("read");
}
}
Can you help me?
Just to show really everything, here is my RUN Configuration:
Answers
Ok, i got it working after looking through tons of source code this afternoon. In the example above i did a mistake. i created the method movieEvent(Movie m) without the public access specifier which makes it "protected" per default and than the Movie class can't invoke the method and thus can't load the video frames.
The correct method should look like:
you see the word "public" in fron of void? that did the trick (shame on me).
there are nor special VM parameters required but if you run into trouble with the GStreamer native libs (which is the video lib that is used behind the scenes in Processing 2.2.1) add the following:
where the directory "GStreamer/libs" should contain all files as listed here pastebin.com/kTqzL1vW (the .jar files arent required but they need to be on your classpath so just put everything at one place)
HTH, chris
Processing's pre-processor stamps the access level keyword
public
in almost anything automatically!When using another IDE, we gotta put those for ourselves! :-S
How did you managed to get Processing work with IntelliJ IDEA? I want that too, if you don't mind telling me.
@Flu: there is a slide share presentation online that explains how to use processing with IntelliJ IDEA.
slideshare.net/eskimoblood/processing-in-intellij
it's for Mac Users but if you have IDEA experience it should be no problem to do the steps on windows also.
Also there is a book which explains to do it:
Processing 2: Creative Programming Cookbook
Chapter 11: Using Processing with Other Editors -> Using Processing with IntelliJ IDEA p.277
If you have troubles to get it running drop a message here and i'm gonna create a better explanation.
HTH, chris
Thank you, I will try!
Yeah, I did it. At first, I couldn't find the Global Libraries stuff but I found it finally. And now, I imported the Processing core and it works. But it annoys me that when the program is run, the applet's window looks like this:
It should have been an image there, but for an unknown reason, I can't put it...anyway, the applet's window has like a taskbar up with an Applet menu and down it is like a notification that says Applet started. How I get rid of those?
have you looked in preferences and properties?
Where do I find those?
in the menus
;-)
just kidding
But @chris1779 managed to do it somehow.
@Flu:
Can you upload a screenshot and show me the window you got?
for example here 666kb.com/
or here postimage.org/
or on any other image sharing site.
postimg.org/image/5hjqszrxb/
@Flu
thats the normal Windows 8 window border that get's added to an applet. In my screenshot above the border is also there. it just looks different.
to get rid of this border you can change your setup method to look like that:
of course thats just one way to do it.
HTH, chris
No, I'm not talking about the bar with the title and the close, minimize, etc. buttons. I am talking about that bar under it, with Applet written on it. In PDE it doesn't put that at all. I know how it looks like the normal windows 8 border. And if I recall corectly, you can take it with:
What you gave me throws a NullPointerException, but I really don't know why...
Since I only use Processing's IDE dunno whether this technique can make any diff...
My idea is having our own main() and invoke PApplet.main() from there:
You know what's weird? My code throws NPE too :-? that is kind of weird since it works perfectly on PDE. @GoToLoop , I don't think your code makes any difference...
@Flu
show me the full stacktrace and your full code, maybe i can help you.
@GoToLoop Actually, it gets me an error:
Error:(7, 23) java: main(java.lang.String[]) in notesStuff cannot override main(java.lang.String[]) in processing.core.PApplet attempting to assign weaker access privileges; was public
@chris1779 What do you mean, stacktrace? What is that? Plus, that's the whole code I gave you earlier:
Have you actually test it? Anyways, if you just wanna change the text at the title bar, use
frame.setTitle("");
.the code to startup -has too look like that- could look like that:
your exception says that you didnt use the word "public" in front of the signature of the main method.
As any code coming from Processing's IDE, you gotta add
public
for yourself! (~~)That's obviously wrong! [-( How would you explain my snippet working too? :>
Neither @GoToLoop code or @chris1779 code doeesn't make a difference. I tried them all.
@GoToLoop:
sorry, i'am not native english speakin so i may have accidentally enforced it too much ;)
I think the majority of us aren't native english speakers, hmmm... that's weird!
@Flu
i think your RUN configuration maybe wrong. Did you create an 'Applet' or an 'Application' RUN configuration?
Try to create an 'Application' RUN configuration, your should not see a border anymore.
btw.
works for sure (Java8,Processing.2.2.1 :)
f.666kb.com/i/cps4c7b4q7naillxz.jpg
Me neither! But for programming things, where almost everything is possible, the word "should" is more appropriate! O:-)
@GoToLoop
thanks for the hint :)
Very well said, @GoToLoop! @chris1779 I think I made an Applet RUN Configuration... but I don't know for sure how do I choose what.
@Flu
To create a RUN configuration select from the menu bar:
Run -> Edit Configurations ...
as shown here:
f.666kb.com/i/cps4hgu1mgoi4oxnb.jpg
and than click on the + - sign or (Alt+Insert) and select "Application" from the drop down menu. as shown here:
f.666kb.com/i/cps4iw5e9mc650313.jpg
of course you also have to select your main class afterwards.
I've found an example using setUndecorated() here: =:)
You gotta adapt it to your IDE though! :-SS
I think I will stick with the PDE :)