easelpeasel
easelpeasel

Reputation: 73

Prevent java from opening a browser

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.

Upvotes: 1

Views: 259

Answers (3)

Michele Dorigatti
Michele Dorigatti

Reputation: 817

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.

Upvotes: 2

Michele Dorigatti
Michele Dorigatti

Reputation: 817

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>

Upvotes: 0

JollyJoker
JollyJoker

Reputation: 1406

You could remove the default browser setting from the registry.

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

More detail

Upvotes: -1

Related Questions