Shop OBEX P1 Docs P2 Docs Learn Events
libraries and packages in Java IDE — Parallax Forums

libraries and packages in Java IDE

EmilyPEmilyP Posts: 21
edited 2009-07-15 20:28 in General Discussion
Hello,

I am trying to do something very simple but cannot manage to figure it out. I have my javelin connected to the HM55B compass. I would like to download the code online to test the compass, which I've gotten to work with my basic stamp. Up until this point, I have written all my own code for the javelin and never used any of the libraries or other cool/useful code out there.

My problems / questions are as follows:
JIDE compiler does not recognize the package
I need to import various libraries like stamp/math/IntegerMath. I am getting misplaced package / non-existent entity errors.

If some one could walk me through downloading a package and importing classes, that would be great. I know this is pretty basic but I haven't been able to find documentation out there either. If anyone knows of documentation that I've over looked, please give me the heads up.

Thanks,

Emily

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-07-15 16:30
    First go here:
    http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/

    That is basically the Javelin IDE installation folder of your PC.
    You will find the folders lib and Projects, just as on your PC.

    The folder layout is identical to the PC folder layout,
    which makes it easy to install packages.

    If you go here:
    http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/math/

    you are in fact looking at package stamp.math
    which is located in folder [noparse][[/noparse]javelin installpath]\lib\stamp\math

    If you don't have the folders on your PC but that are on the Yahoo group,
    then make them on your PC using the EXACT same folder names (upper/lowercase letters)
    and copy the files from Yahoo to their identical PC folder.

    Now the files are ready to be imported by your programs.

    regards peter
  • EmilyPEmilyP Posts: 21
    edited 2009-07-15 19:45
    Hmm ... I have my folders exactly like the Yahoo Group and have for some while. My errors have something to do with incorrect files. My files are exactly how the error comment recommends. I have checked this multiple times.

    [noparse][[/noparse]Java Error]HM55B.java(5): Error: Could not find package named:
    C:\Program Files\Parallax Inc\Javelin Stamp IDE\lib/stamp/peripheral/sensor/compass/HM55B or |
    C:\Program Files\Parallax Inc\Javelin Stamp IDE\Projects/stamp/peripheral/sensor/compass/HM55B|
    [noparse][[/noparse]Java Error}HM55B.java(7): Error:"stamp/math/IntegerMath" is either a misplaced package name or a non-existent entity
    [noparse][[/noparse]Java Error]HM55B.java(86): Error:"IntegerMath" is either a misplaced package name or a non-existent entity

    In both these errors, the HM55B one and the IntegerMath, the beginning top lines of my code read:
    package stamp.peripheral.sensor.compass.HM55B;
    import stamp.core.*;
    import stamp.math.IntegerMath;

    I am using the JIDE. I really don't get this error at all. Packaging in java is always a little messy but I'm not sure what trouble shooting I can still do.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-07-15 20:28
    Are you sure the file HM55B.java is located in the folder
    c:\program files\Parallax Inc\Javelin Stamp IDE\lib\stamp\peripheral\sensor\compass\HM55B

    Note the HM55B javafile is located in a folder HM55B
    So the HM55B java file must not be placed in the compass folder.
    An easy to make mistake.

    If you have the file in the correct folder
    and still get the error, please post the program
    where you import the HM55B file.

    To import HM55B you must use
    import stamp.peripheral.sensor.compass.HM55B.HM55B;
    or
    import stamp.peripheral.sensor.compass.HM55B.*;

    Perhaps you are using
    import stamp.peripheral.sensor.compass.HM55B;

    Also, your own program should not have
    package stamp.peripheral.sensor.compass.HM55B;
    unless your program is in the HM55B folder.
    Use an import line in your program.

    regards peter

    Post Edited (Peter Verkaik) : 7/15/2009 8:48:24 PM GMT
Sign In or Register to comment.