1

I want to run the tool ChromHMM locally, which opens a web browser after finishing the calculations. The tool uses

java.awt.Desktop.getDesktop().browse((new File(...)).toURI())

and it doesn't have a parameter to prevent that behavior.

  • 2
    Is this a jar file you're running locally for personal use? Or is this a dependency you're pulling in with a tool like maven/gradle? Please include some additional information in your question, such as what you are trying to do, and what program you are using. – byxor Dec 05 '19 at 15:34
  • Which command are you running exactly? – Michele Dorigatti Dec 05 '19 at 16:51

3 Answers3

2

On ChromeHMM GitHub account there is a relevant issue from 2017 that lists several solutions:

This:

unset DISPLAY && java -mx1600M -jar $chromhmm LearnModel -s 1 -p $threads -nobrowser $binariesdir $modelsdir $num_states $assembly

Or specifying -Djava.awt.headless=true

java -Djava.awt.headless=true -jar ChromHMM.jar LearnModel -nobrowser <inputdir> <outputdir> <numstates> <assembly>

Weirdly, I found also this comment:

The '-nobrowser' flag skips the launching of the web browser but not the generation of emission parameters images.

Michele Dorigatti
  • 811
  • 1
  • 9
  • 17
  • 1
    Thank you! Maybe this is also a bug, because even with -nobrowser chromHMM is opening a browser. I will contact the developer. – easelpeasel Dec 05 '19 at 17:12
  • It would be great if you could edit your question with the exact command, maybe it is just a matter of wrong position of the option... Also, it would people later. Also, which solution worked for you exactly? unset DISPLAY or the java -D option? – Michele Dorigatti Dec 05 '19 at 17:14
0

EDIT: The OP pointed out that this solution is wrong, I am leaving it for reference:

-nobrowser doesn't produce browser files. A bit confusing, but it has nothing to to with opening a webbrowser after finishing the calculations


There is a -nobrowser option, as documented in the ChromHMM User Manual .

-nobrowser – If this flag is present, then browser files are not printed. If -nobed is requested then browserfile writing is also suppressed.

So the command would be:

java -jar ChromHMM.jar LearnModel -nobrowser <inputdir> <outputdir> <numstates> <assembly>

Michele Dorigatti
  • 811
  • 1
  • 9
  • 17
  • 1
    -nobrowser doesn't produce browser files. A bit confusing, but it has nothing to to with opening a webbrowser after finishing the calculations. – easelpeasel Dec 05 '19 at 16:40
  • Too bad! But does still try to open the browser, even if there are no browser files? – Michele Dorigatti Dec 05 '19 at 16:44
  • Yes, browser files are some internal ChromHMM thing. The webbrowser just displays some analysis summary. – easelpeasel Dec 05 '19 at 16:46
  • "Also upon termination webpage is created called webpage_NUMSTATES.html (or webpage_NUMSTATES_outfileID.html if a outfileID is specified) summarizing all the files and images created, and if a browser can be found, then is automatically opened with this file" So, depending on the OS, it is enough to disable browser opening. But there must be a batch mode. – Michele Dorigatti Dec 05 '19 at 16:49
  • Which ChromHMM command are you using? It seems that LearnModel calls a browser, but maybe there is a similar command, or combination, that generates the same output. – Michele Dorigatti Dec 05 '19 at 16:52
-1

You could remove the default browser setting from the registry.

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\URLAssociations\(http|https)\UserChoice

More detail

JollyJoker
  • 1,256
  • 8
  • 12