HOWTO: Get started with the Java API in IntelliJ with remote debugging - with images (BWS 2.2)

RELATED
PRODUCTS

Post

I put together a guide on how to create a new project and configure IntelliJ IDEA in a convenient way to get started with developing controller scripts. If you're not using IntelliJ IDEA, then shame on you. Go to https://www.jetbrains.com/idea/download/ and get it.

The guide itself is hosted on my github account: https://github.com/outterback/bitwig-co ... r-tutorial

I've written it around windows, but it should be trivial to configure it for Mac and Linux. If there are any mistakes, or if you have any comments, let me know and I'll take a look!

Post

Incredible! Thank you.

Post

I've been using your guide many times already, and just found this post and thus a possibility to thank you! I Even made an account just for this. :D
Thank you for that nice neat guide!

Post

JakeXY wrote: Thu Sep 24, 2020 9:12 am I've been using your guide many times already, and just found this post and thus a possibility to thank you! I Even made an account just for this. :D
Thank you for that nice neat guide!
Hey man... are you on osx? I'm having difficulty getting maven and the jdk configured. which isn't covered in this guide. What JDK are you using?
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

I'm on Windows, but had difficulties too.
If I remember correctly what did the trick, was installing Java 12 SDK and setting it as the JAVA_HOME Variable on Windows. I don't know whats the equivalent in OSX, and am not 100 % the Second step was necessary.
Then don't forget to select the JAVA 12 SDK in your IDE.

I think after that, also the maven install would stop complaining and just work as it does according to the Guide.

Post

man. its rough out here for us. Glad you figured out the JAVA_HOME thing on windows. its much simpler to set up there than OSX and all the different versions it goes back. wow.

Besides that I got the intellij Idea CE working and debugger connected. I'm wondering if you were able to get the println to output to the Debugger window vs the bitwig console.

Another thing frustrating is if I put any breakpoints in init() and the bitwig console is up it loves to stay the top window and the debugger has locked bitwig process. So it just hangs there... so I'd just prefer to have that stuff right in Intellij.

Also related to that last thing...it would be helpful for a method to restart a script from the IDE. So that the window doesn't stick to the top and obfuscate any debugging/step through. Maybe you have a way for this already JakeXY?

Check the screenshot here...
Screen Shot 2020-09-26 at 5.04.58 PM.png
You do not have the required permissions to view the files attached to this post.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

I am modding the DrivenByMoss Script, so for simple Print debugs I was using his show text overlay in Bitwig Functionality.
I have never really tried it with System.out.println, so no Idea, sorry.
You could search his Script for the display Text function (getDisplay.notify()), and copy it. But, as everything in the Script, its not just a Basic command, but some advanced stuff with many abstract wrapper classes and interfaces.., so I could not extract the actual Bitwig API Command for you at first glance.

So I did not really work with the console in Bitwig, and thus have no Wisdom to share :(.

(if you assign, what ever you wanted to print to a variable at that point , you can see it's value int the debugger Variables View in Intellij of course, maybe that's a sufficient alternative?)

I don't think it's possible to restart the Script from the IDE, but you can just restart it, by restarting your hardware Controller.

Good Luck with the Coding ! :)

Post

Awesome... Yeah i will just need to adjust myself getting used to the debugger vs prints. One of those things I guess. I've built so many things without a debugger that I'm quite comfortable with adding println, reloading and observing.

Thanks for the tips JakeXY!
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

oh wanted to add how to add the debug port to bitwig here since that is all that is necessary because intellij handles the JDK download (Although, it was difficult to track down a working version of JDK 12 for bitwig 3.2.8)

Close Bitwig, Open Terminal,

Code: Select all

launchctl setenv BITWIG_DEBUG_PORT 5005
Then open bitwig again and you should be able to connect with intellij. I'm still researching into how to add this as a permanent thing so i don't have to run it every time I logout/login.

EDIT:Moss and I put some notes in this thread to get the environment variable and paths to maven to work on OSX. viewtopic.php?f=268&t=553031
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

Wow... I'm really enjoying the IntelliJ IDEA CE. Having everything typed, autocompleted and compiled is a dream. I feel that the scripts run and execute way faster, although I don't and will never have timing details... but i'm pretty sure so far that debug output is immediate when refreshing the script instead of taking a sec.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

Kirkwood West wrote: Mon Sep 28, 2020 9:46 pm (Although, it was difficult to track down a working version of JDK 12 for bitwig 3.2.8)
And how did you? :)

Post

minortom wrote: Sun Oct 04, 2020 11:23 pm
Kirkwood West wrote: Mon Sep 28, 2020 9:46 pm (Although, it was difficult to track down a working version of JDK 12 for bitwig 3.2.8)
And how did you? :)
Actually not that difficult :-)
https://adoptopenjdk.net/releases.html? ... nt=hotspot

Post

Yes moss you pointed this one out earlier! but when i downloaded it I could not get it to work on Catalina. There was something strange with it, it wouldn't unpack to a folder. So I ended up using the one from Oracle.

https://www.oracle.com/java/technologie ... loads.html

would be happy to use the other if i could get it working... would like to avoid their fee.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

moss wrote: Mon Oct 05, 2020 8:10 am Actually not that difficult :-)
https://adoptopenjdk.net/releases.html? ... nt=hotspot
 
Nice! I looked for that one for a while and somehow could not find it, ended up with https://jdk.java.net/archive/. I looked for the wrong reasons (my extension was improperly packaged, I was misreading the stack trace and blaming it on a JDK mismatch).

On OSX that can be installed as easily as

Code: Select all

brew cask install adoptopenjdk12
I wonder how tolerant the development process is to differences in JDKs.
Kirkwood West wrote: Mon Oct 05, 2020 8:40 am Yes moss you pointed this one out earlier! but when i downloaded it I could not get it to work on Catalina. There was something strange with it, it wouldn't unpack to a folder. So I ended up using the one from Oracle.

https://www.oracle.com/java/technologie ... loads.html

would be happy to use the other if i could get it working... would like to avoid their fee.
There is a fee? I can't get past needing to create an account. Oracle can suck it as long as I can avoid them altogether.

UPD I see your other thread now. Somehow when I searched for "jdk" this came up first.

Post

minortom wrote: Mon Oct 05, 2020 9:18 am There is a fee? I can't get past needing to create an account. Oracle can suck it as long as I can avoid them altogether.
Yes, you need to pay for the Oracle version. Without paying you get can either use OpenJDK or AdoptOpenJdk.

Post Reply

Return to “Controller Scripting”