Home AMX User Forum Duet/Cafe Duet

External Dependancies

Hey there fellow Duet'ers and Duet'ettes. For those of you who have some nice libraries / utility classes etc that you share between projects and like me had been doing the import thing every time you need them in a new project here's a much funkier way.

Turns out that you can export your nice useful reusable and sexy libraries as a jar (yes I know, you knew that you could do this). But... if you use a custom manifest and include the line 'AMX-Type: Duet' things start to get sexy.

This allows you to place the jar in one of the directories in which NLStudio looks for modules (by default AMXShare\Duet\bundle, AMXShare\Duet\lib and AMXShare\Duet\module - or you can add more from the preferences window). From there when you create new modules in Duet simply include the JAR in the build path and add it to the 'File Dependencies' in the modules duet manifest.

Now every time hit the compile button in NetLinx Studio for a project that uses the module it will look for the jar (if it's not in the NetLinx compiler build paths you'll get something similar to this) and... it will also be transferred to the controller along with your module - exactly the same was as snapirouter.jar and devicesdkrt.jar are handled. Now you have one nice re-usable jar that all you modules can use without having to worry about continuously importing helper class and maintaining them across projects. Sexy.

Comments

  • AuserAuser Posts: 506
    Nice hey - I started to have a play with this the other day. Note that the custom manifest is required; if you don't have one NS will complain that your .jar is not a valid Duet module.
  • jjamesjjames Posts: 2,908
    Auser wrote: »
    Nice hey - I started to have a play with this the other day. Note that the custom manifest is required; if you don't have one NS will complain that your .jar is not a valid Duet module.
    AHA! Thank you for that!

    I'm seeing how great Duet is now, but man it's a whole other world for this NetLinx programmer. *sigh* I just wish they would have went the .NET route like a certain competitor. In the end, that could pull me away.
  • ericmedleyericmedley Posts: 4,177
    jjames wrote: »
    AHA! Thank you for that!

    I'm seeing how great Duet is now, but man it's a whole other world for this NetLinx programmer. *sigh* I just wish they would have went the .NET route like a certain competitor. In the end, that could pull me away.

    Now that I'm doing both control systems, and have been spending a lot of time with .NET doing the Certified Cyber Solution stuff, I really would like to get into DUET/JAVA more. I'm sure I'd have the same issues you're having. The other thing to is that I'm not a spring chicken anymore. It's harder for me to switch hats. It seems to take me longer to get the gears shifted. :/
  • jjamesjjames Posts: 2,908
    I might be a "spring chicken" - but I just suck at Java . . . I got a D- in the Intro To Java Programming class, and that only because I tried, otherwise I really failed it. I also think that I'm used to the rules of .NET and not those of Java 1.4 - they really need to upgrade it, at least to 5 if not 6. Seven looks like it'll be nice with its new string capability in switch..case (something I've been spoiled by with NetLinx.)
  • PhreaKPhreaK Posts: 966
    Yeah, I'd kill to have at least a java 5 vm on the boxes. Infocomm is only a couple of hours away - would be nice if something like that was announced.

    Just a note on the custom manifests - there seems to be a bug in the eclipse jar exporter used by the latest version of Cafe Duet. You need to make sure that there's a couple of empty lines after your last key/value pair otherwise it will remove it.

    Eg, if you tell it to use a custom manifest containing
    Manifest-Version: 1.0
    AMX-Type: Duet
    
    and then look at the manifest in the exported jar it will only contain
    Manifest-Version: 1.0
    
    add a couple of blank lines to the file before shooting it the jar-in-at-or however and it all plays nice.
  • jjamesjjames Posts: 2,908
    PhreaK wrote: »
    Yeah, I'd kill to have at least a java 5 vm on the boxes. Infocomm is only a couple of hours away - would be nice if something like that was announced.
    *Sniff*Sniff* - I smell something cooking.
Sign In or Register to comment.