SDK: Spin's utlimate IntelliJ setup thread

Spin

Well-known member
Joined
May 22, 2019
Posts
474
Likes
189
Hello fellow (aspiring) MW-coders :)

I have been seeing a lot of "Please help me with my MW SDK setup ! "- questions lately, both here on our lovely Forum and in my VB6.systems mailbox.
As coders we must always strive for efficiency, so I decided to create this 'Ultimate IntelliJ SDK Setup Thread'

It should be fairly straighforward to follow and I hope to get you all up and running (and deploying your own custom made Studies & Strategies !) in no time

  1. Obviously, you would have to install the nice IntelliJ-platform first. Head here: https://www.jetbrains.com/idea/download/#section=linux
    (the Community Edition will do just fine, but please consider to support the maintainers of this beautiful and handy IDE, by paying for the Ultimate version)

  2. Once installed, go to File > New Project, and create a Java project. You do not need to select / tick anything extra, just press 'next' in the bottom right corner.

    611

    On the next screen (the one about 'templates'), no change is needed. Simply click 'next' again.
    On the last screen, name your Project (mine will be called "For_MW_Forum"), and click 'finish'.


  3. You should now have a Project on the left of your screen, with a few subfolders / files in it:
    1. .idea
    2. src
    3. an .iml file

      The whole should resemble the screenshot below
      613
  4. Now it's time to add some resources to your project. MotiveWave-resources more specifically.
    Browse to MotiveWave's site and download (part of) the Software Development Kit (or SDK): http://www.motivewave.com/support/sdk.htm
    Download the file called "MotiveWave_Studies.zip" and extract it anywhere on your computer.
    In the extracted folder you will find a bunch of juicy stuff:
    1. bin (we won't need that folder)
    2. build (we will need 2 files from here)
    3. lib (we will need only one file here)
    4. src (we will need everything from this folder)
  5. Head back over to IntelliJ and create 2 subfolders in your project. You do this by right-clicking the Project's name (the one in bold, 'For_MW_Forum' in my example), and select 'new directory'.
    Name the folders / directories 'lib' and 'build'
    Now drag the following files from that extracted MotiveWave_Studies-folder into the following directories:
    1. from the build-folder: the files build.xml and Manifest.MF into the Project's build folder
    2. from the lib-folder: the file mwave_sdk.jar into the Project's lib folder
    3. from the src-folder: the complete 'study_examples'-directory into the Project's src folder

      The end result should look like this:

      618
  6. Almost there, so hang on !! ;)
    All we need to do now, is tell IntelliJ what file to use as ANT-buildfile, so we can compile the code that we are about to write (or the code someone else has written for us).
    To do this, right-click on the build.xml file in the build directory and select the 'Add as ANT build file'-option from the bottom of the menu:

    615



  7. That's all ! :D
    On the right of your screen an 'ANT'-window will have popped up with a few options. You will most likely only use 2 of those:
    1. 'deploy' to compile your code (it will appear in the MW Platform on your computer right away)
    2. 'deploy jar' to package your code into a .jar file, that you can send to another computer and import into MW there.

      616

      A note:
      both of the above ANT-options will create files in your 'MotiveWave Extensions' folder
      (on Linux this folder is located at /home/user/MotiveWave Extensions⁄, should be somewhere similar on Win / Mac)
      Deploy will add to a subfolder called 'dev', while 'deploy jar' will add to 'lib'

      To start over with a clean sheet, simply remove these 2 subfolders from the MW Extensions folder, and your MW-platform should be back to it's original state (all the previously compiled Studies & Strategies will have disappeared)

      Another note:
      MW offers all its Studies & Strategies for download: https://support.motivewave.com/foru...evelopment-kit-documentation-and-resources.5/

      Last note:

      The java learning curve can be steep. If you don't feel like going it through it yourself, you can pay someone to handle all the frustration in your place and code your Studies / Strategies for you. I am such a person.
      Please refer my signature below 👇👇👇
 
Last edited:

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
Hello again,
just when I thought all will be flying from here, I was grounded right away. I added "ProjectionOscillator.java" to the src study_examples folder and when I run deploy, I got compile error. Please note "ProjectionOscillator.java" code is straight from those 275 studies file you suggested in "Another note:", without single change. Compile error says "cannot access Node ...". Do you have any idea what could go wrong here?
Thanks again for your help,
 

Attachments

  • Screenshot 2021-02-14 175513.jpg
    Screenshot 2021-02-14 175513.jpg
    106.6 KB · Views: 47

Spin

Well-known member
Joined
May 22, 2019
Posts
474
Likes
189
Ah, yes, a classic :)

As very often is the case, the solution is already (partially) present in the error statement:

Notice that your error reads "symbol:variable Utility"
This means that your Study (ProjectionOscillator) references a variable from another class. That in turn means you need to add that class to the same folder ('src') so your compiler can find it, and compile everything.

What happened here is that the MW-coders put several -often-used- calculations in a separate Study (so they did not need to rewrite it into every Study they needed it in) called the 'Utility'-Study (or 'Utility'-class to be more precise). They could then easily reference this Utility Class whenever they needed (parts of) it.

To solve this you simply go find the 'utility'-class (it's in the 'general' subfolder of the 275 MW-Studies) and copy/paste it over to your 'src'-folder:

620

The red wavy line underneath the word 'Utility' will disappear from your ProjectionOscillator Study, and you will be able to compile.

Note: it is possible that parts of the 'Utility-class' refer even other classes. You need to add either those as well, or comment out the code in the Utility-Class that references them.

Like I said: possible steep learning curve. Through courage and perseverance even the snails reached Noah's Ark :ROFLMAO:
 
Last edited:
  • Like
Reactions: RBM

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
Thanks again,
even when I added all 275 (or so) studies available, I had error. However, most likely my answer is in your last two sentences from previous post, therefore I will start from scratch and see where it goes. Thanks for all, as most likely I would never even come this far.
Cheers,
 

MrHwang

Member
Joined
Apr 9, 2021
Posts
15
Likes
16
Just wanted to mention, when you add the mwave_sdk.jar library file, you must also right-click it and select "Add as Library . . ." , which of course makes sense. You want to be able to see the class structure of the .jar file as a tree hierarchy like such:

Screenshot_1.jpg

I add it as only a project level library, but perhaps if you add it as a global library this will not be necessary for every project. Idk.
 
Last edited:

q0paz

Active member
Joined
Aug 19, 2020
Posts
27
Likes
6
Just wanted to mention, when you add the mwave_sdk.jar library file, you must also right-click it and select "Add as Library . . ." , which of course makes sense. You want to be able to see the class structure of the .jar file as a tree hierarchy like such:

View attachment 764

I add it as only a project level library, but perhaps if you add it as a global library this will not be necessary for every project. Idk.
took me hours to figure that out :(
 

Wxll

Member
Joined
Oct 22, 2022
Posts
15
Likes
4
that helped big time!!!

NOTE: You have to move the .jar file from the lib into the `MotiveWave Extensions` folder, else MW won't detect the new study.
Also remove the dev folder dont have them install at once...
At least that helped me after hours and hours trail and error why my cut&past example was not working....
 
Last edited:
Top