Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

developing the java component #123

Closed
bryantChhun opened this issue Sep 18, 2020 · 6 comments
Closed

developing the java component #123

bryantChhun opened this issue Sep 18, 2020 · 6 comments

Comments

@bryantChhun
Copy link

Simple question that might be useful for others:

Because pycro-manager and micro-manager are separate repositories, how does one develop and test pycro-manager on the java side?

The Java component appears to have modules (remote and internal.zmq) that are added to the Studio. So I assume that running micro-manager from IDE (IntelliJ) in debug mode needs to include files from both repos during compilation of the Studio.

I can add both sources to the project, but run into the following error:

java.io.FileNotFoundException: /Applications/Micro-Manager-2.0.0-gamma1-20200914/plugins (Is a directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at org.micromanager.internal.zmq.ZMQUtil.getPackagesFromJars(ZMQUtil.java:399)
	at org.micromanager.internal.zmq.ZMQServer.<init>(ZMQServer.java:75)
	at org.micromanager.internal.MMStudio.runZMQServer(MMStudio.java:941)

@henrypinkard
Copy link
Member

The Studio depends on PycroManagerJava.jar, which includes both remote and internal.zmq packages. The only explicit call to either package is here to instantiate a ZMQ server. All other objects from these packages are generated by interacting with this server (or subsequent servers that it spawns).

So if you want to develop the Java side, that's correct, you need to include the source of these packages. In addition many of the features used by Pycromanager live in seperate repositories. Specifically NDViewer, the image display window, NDTiffStorage, the disk storage, and AcqEngJ, the acquisition engine. PycroManagerJava depends on all of these. So depending on what you're trying to do you might want to add the source for these as well.

Here is how I set everything up in IntelliJ. Under File-project structure I have a module for each one. Also shown are Magellan, which is not necessary and micromanager, which contains the studio source code and is also not necessary (i.e. you could just use MMJ_.jar instead).

Screen Shot 2020-09-18 at 7 35 51 AM

Sources and dependencies are set up for pycromanager as shown:

Screen Shot 2020-09-18 at 7 39 45 AM

Screen Shot 2020-09-18 at 7 43 34 AM

mmLibraries contains all the Jars within the plugins/Micro-Manager folder of a micro-manager install, except for the ones that you're running from source (i.e. NDViewer, AcqEngJ, NDTiffStorage, and MMJ_, which is the compiled version of studio source code though its name may change in the future). MMCoreJ is separated out here even though it's also in this folder so that it can be separately used as a dependency for the other three libraries without having to include everything else in that folder.

NDTiffStorage and AcqEngJ are set up similarly. Their only dependency is MMCoreJ. NDViewer has an extra dependency, and has a resources folder as shown:

Screen Shot 2020-09-18 at 7 53 18 AM

Screen Shot 2020-09-18 at 7 50 41 AM

Lastly, you need to setup a run configuration. Here the working directory is the root of your micro-manager install:

Screen Shot 2020-09-18 at 7 54 59 AM

@bryantChhun
Copy link
Author

I got everything set up as above, but launching the pycromanager or micromanager configuration does not run micro-manager (but does open ImageJ). I've done the "command-drag-to-desktop" trick to get around OSX security, but MM still won't launch.

@henrypinkard
Copy link
Member

I would guess this a problem with either your working directory in the run configuration or the MMJ_.jar library or micro-manager studio source as added to the project.

Do you see Micro-Manager in the IamgeJ plugins menu?

@bryantChhun
Copy link
Author

Indeed I can see micro-manager in the ImageJ plugin menu. But when I select the Studio it gives me this error (in IntelliJ console)
image

I added the MMJ_.jar from my nightly build installation to the mmLibraries -- then everything worked perfectly. So clearly the problem is somewhere during my compilation of studio from source.

@bryantChhun
Copy link
Author

bryantChhun commented Sep 21, 2020

Ok I solved it. My micro-manager project-structure-modules did not include resources as a content root. Including resources fixed it.

Thanks for all the help! Looking forward to contributing.

@henrypinkard
Copy link
Member

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants