Author Topic: Java API with Scala / SBT  (Read 12690 times)

Offline mbedward

  • Newbie
  • *
  • Posts: 7
    • View Profile
Java API with Scala / SBT
« on: February 28, 2014, 00:17:39 »
Hi all,

I'd be interested to know if anyone here is using Hugin from Scala. I have just begun to explore this, using SBT as the build tool and Eclipse for editing.

After copying the Hugin api jar and dll file into the sbt project lib directory, and adding an element to my build.sbt file to recognize the dll file as an extra classpathType element, I am able to compile and run an app that loads an oobn file successfully. Unfortunately this only works when running from SBT so far. Trying to run the app from Eclipse provokes a comjplaint about the dll file not being a valid archive (zip / jar).

If anyone has experience with Hugin / Scala / SBT I'd be grateful for any tips about setting up the build environment.

Cheers,
Michael

Offline Nicolaj

  • HUGIN Expert
  • Newbie
  • *****
  • Posts: 5
    • View Profile
Re: Java API with Scala / SBT
« Reply #1 on: March 04, 2014, 16:22:39 »
Hi mbedward.

In eclipse you must add the dll file to the library path. Otherwise the java runtime environment will not be able to combine the JBC with the binary code.

In your eclipse project select Run As... -> Run Configurations -> Arguments and add the following in the field labeled "VM Arguments":
-Djava.library.path=Whereeveryourdllfileislocated

I hope this helps.

Regards
Nicolaj

Offline Nicolaj

  • HUGIN Expert
  • Newbie
  • *****
  • Posts: 5
    • View Profile
Re: Java API with Scala / SBT
« Reply #2 on: March 04, 2014, 16:31:44 »
If that was not clear from the above, "the dll" file would be the one you find in ...\Hugin Expert\Hugin Dist 7.8\HDE7.8J\Bin

Regards
Nicolaj

Offline mbedward

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Java API with Scala / SBT
« Reply #3 on: March 05, 2014, 05:21:23 »
Thanks very much Nicolaj. Before seeing your reply I discovered that I could also set the dll location via project properties -> Java Build Path -> Native library location. However, your method seems a lot clearer.

Cheers,
Michael