issue with import statements

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
Hello,
if anyone can understand below, please let me know what is wrong here and what I should do to get to real coding.
Started new study from clean sheet, meaning no single study example within project and under library I have mwave_sdk.jar.
In first line I have
package com.motivewave.platform.study.general;

After that I entered
import com.motivewave.platform.sdk.common.Coordinate;
and I am getting motivewave as an error.(you can see it from picture). Below it says
java package com.motivewave.platform.sdk.common does not exist.
When I unzipped mwave_sdk.jar file, there are present following folders:
mwave_sdk->com->motivewave->platform->sdk ;
under sdk, there are 4 folders: common, draw, order_mgmt, study
For whatever reason intellij does not see motivewave folder inside .jar file.
Coding is done in IntelliJ community edition; setup is prepared as per Spin's guidance, except under /src folder I have no study examples.
Thanks in advance,
 

Attachments

  • Screenshot 2021-03-29 220801.jpg
    Screenshot 2021-03-29 220801.jpg
    16.5 KB · Views: 9
  • Screenshot 2021-03-29 215418.jpg
    Screenshot 2021-03-29 215418.jpg
    74.1 KB · Views: 9

Spin

Well-known member
Joined
May 22, 2019
Posts
478
Likes
191
Hello @MIhalj and congrats on the job done so far. You are well on your way :)

As always: the error is correct: there is indeed no package with that name.

Try putting your study inside a package with a name of your own chosing, like this:

706

The takeaway here is this: Studies / Strategies should be put into packages, and the package name should be the first line of the code.
A package can hold multiple classes: I have coded Strategies that had 5 or so. By using this structure, it will be possible to use Values from one class in another one in the same package (necessary for Strategies!)

TLDR: https://www.tutorialspoint.com/java/java_packages.htm
 
Last edited:

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
Thanks,
obviously I had no idea that package has to be part of src folder. When I had study examples in, all was ok, but this is first time when I do not want that have those examples in. BTW Java is not even close organized in same was as Microsoft oriented languages as C# or VB.Net. Thanks again for your help. Best regards,
 

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
Hello again,
I tried putting special package name and then I dropped into that folder all classes found in com/motivewave/platform folder and again I have issue with classes not being seen for some reason (please see pictures in attachment; I cannot even comprehend what is off here as path is fully specified).
Ideally, Spin can you please specify, similarly as you did with "How to setup study_example inside IntelliJ" , what should go where in regards to packages (like complete process in detail), and inside "src" folder, so my newly created java file sees classes.
Best regards,
 

Attachments

  • 1.jpg
    1.jpg
    138.3 KB · Views: 7
  • 2.jpg
    2.jpg
    103.8 KB · Views: 6

MIhalj

Member
Joined
Feb 8, 2021
Posts
13
Likes
0
FYI I think I figured it out. I did not know that I have to compile .jar file into dependencies before coding (and not adding literally all classes into package). Best regards,
 
Top