BeanShell.jar not found

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

BeanShell.jar not found

Matt Cottrell
I’m trying to use the eval function to run beanshell code in an ImageJ macro.

The command I’m trying to run is: eval("bsh", "gui.enableLiveMode(false)”);

This generates an error indicating that “BeanShell.jar was not found in the plugins folder or is out of date. Click “OK” to download it from the ImageJ website".

I click “Ok” and BeanShell.jar is then downloaded to the plugins folder.  But trying again to run the eval command generates the same error.

I can successfully run beanshell commands in the MicroManager script panel.  

I’m running MicroManager 1.4.22 on macOS 10.11.6 El Capitan.

Thanks,
Matt
--
Matthew Cottrell
Leesburg, VA 20175

https://www.linkedin.com/in/matthew-thomas-cottrell
http://www.mattcottrell.org
(302) 430-3489 mobile


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: BeanShell.jar not found

Nico Stuurman-2
Hi Matt,


On 3/19/17 4:14 PM, Matt Cottrell wrote:
> I’m trying to use the eval function to run beanshell code in an ImageJ macro.
>
> The command I’m trying to run is: eval("bsh", "gui.enableLiveMode(false)”);
>
> This generates an error indicating that “BeanShell.jar was not found in the plugins folder or is out of date. Click “OK” to download it from the ImageJ website".
>
> I click “Ok” and BeanShell.jar is then downloaded to the plugins folder.  But trying again to run the eval command generates the same error.

I think that you are trying to call Micro-Manager functions from an
ImageJ macro.  I can replicate your problems quite easily.  Indeed,
ImageJ downloads a "Beanshell.jar and stores it in
plugins/jars/Beanshell.jar". However, when re-starting Micro-Manager, it
appears to still use the bsh-2.0b6.jar in plugins/Micro-Manager, and it
still fails.  Replacing bsh-2.0b6.jar with Beanshell.jar causes an error
during Micro-Manager start up (resulting in it not starting up).  So, no
way out of this conundrum.  Even if you could get both to work, I don't
think that you would have access to the "gui" object from the beanshell
environment in ImageJ.

I am not aware of a good way to call Micro-Manager code from an ImageJ
macro.  Maybe someone else on this list has an idea?

Best,


Nico



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: BeanShell.jar not found

JonD
Administrator
Hi Matt,

Matt Cottrell wrote
I’m trying to use the eval function to run beanshell code in an ImageJ macro.

...

I can successfully run beanshell commands in the MicroManager script panel.  

Nico Stuurman-2 wrote
I am not aware of a good way to call Micro-Manager code from an ImageJ
macro.  Maybe someone else on this list has an idea?

Perhaps instead you could call your ImageJ macro from a Beanshell script in Micro-Manager's script window?  I have done this for ImageJ baked-in menu items, and I imagine that you could use it to invoke your own macros as well. Then This thread [1] or others in the archive might be helpful if you go this route.

Jon

[1] http://micro-manager.3463995.n2.nabble.com/Beanshell-script-and-imageJ-macros-td4555033.html

-------------------------------------------
Jon Daniels
Applied Scientific Instrumentation
29391 West Enid Rd, Eugene, OR 97402
Phone: (541) 461-8181 x118
-------------------------------------------

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: BeanShell.jar not found

Peterbauer Thomas
In reply to this post by Nico Stuurman-2
On 2017-03-20 17:55, Nico Stuurman wrote:

> Hi Matt,
>
>
> On 3/19/17 4:14 PM, Matt Cottrell wrote:
>> I’m trying to use the eval function to run beanshell code in an ImageJ macro.
>>
> I think that you are trying to call Micro-Manager functions from an
> ImageJ macro.  I can replicate your problems quite easily.
>
> I am not aware of a good way to call Micro-Manager code from an ImageJ
> macro.  Maybe someone else on this list has an idea?
>

I don't know if it's feasible in this particular case, but it works the
other way round: one can call ImageJ macros from within Micro-Manager's
beanshell:

import ij.IJ;

macro = "print(\"Hello World!\");";
IJ.runMacro(macro);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Loading...