Skip to content

Command Line Options

parg edited this page Jan 26, 2024 · 22 revisions

Running BiglyBT from the command line

Windows

Windows systems are highly customizable. As such, the following assumes the most common setup, i.e. BiglyBT and Java SE runtime installed on an x64 edition of Windows with their defaults.

Via PowerShell:

Start-Process -FilePath javaw.exe -WorkingDirectory 'C:\Program Files\BiglyBT' -ArgumentList '-cp "BiglyBT.jar;commons-cli.jar;swt.jar" com.biglybt.ui.Main'

Via the legacy Command Prompt:

start /D "C:\Program Files\BiglyBT" javaw.exe -cp "BiglyBT.jar;commons-cli.jar;swt.jar" com.biglybt.ui.Main

As for your customizations:

  • If you have installed BiglyBT somewhere other than C:\Program Files\BiglyBT (e.g., in D:\My awesome apps\BiglyBT,) be sure to alter the path above.
  • If you have removed Java from your Path environment variable, you must include the full path to javaw.exe in the examples above. In other words, instead of javaw.exe, write "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe".
  • If you have installed BiglyBT via the GitHub_BiglyBT_Installer64_WithJava.exe package, replace javaw.exe with .\jre\bin\javaw.exe.

Some hints:

  • Command Prompt has weird quotation mark rules. javaw.exe and .\jre\bin\javaw.exe must not be placed between quotation marks, but the double quotation marks in "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" are mandatory. PowerShell does not have these finicky pitfalls. You can put your entire string parameters between quotation marks. PowerShell even accepts curly quotation marks.
  • 3rd-party sources on the Internet may recommend java.exe instead of javaw.exe. The latter (which we recommend here) doesn't generate a console window. When the app runs smoothly, this window is a redundant (and perhaps scary) frill. When it does not, this window may display diagnostic information that could be helpful.

For more information about customizations, see: #1649, "How to make BiglyBT portable or at least change the installation folder"

macOS

You can start BiglyBT from a script using the following:

#! /bin/bash

BIGLYBT=/Applications/BiglyBT/.biglybt

java -XstartOnFirstThread -cp $BIGLYBT/BiglyBT.jar:$BIGLYBT/commons-cli.jar:$BIGLYBT/log4j.jar:$BIGLYBT/swt.jar -Duser.dir=$BIGLYBT com.biglybt.ui.Main

Unfortunately, this won't handle a restart correctly, it will restart BiglyBT via BiglyBT.app.

Configuring BiglyBT

Command-line arguments can be added to the scripts mentioned above to adjust BiglyBT's settings. Their general form is: -D<name>=<value>.

Some of the more useful ones are:

  • azureus.config.path: Path of the folder where BiglyBT configuration data is stored
  • azureus.instance.port: Port number used to communicate between instances
  • MULTI_INSTANCE: Specifies whether multiple instances of BiglyBT are allowed; acceptable values are true and false

3rd-party internet sources may recommend 'biglybt.' in place of 'azureus.' in property names. Unfortunately, this is not always the case.

Configuration examples

In the following examples, we start BiglyBT with -Dazureus.instance.port=16889 argument to set the control port to 16889.

PowerShell example:

Start-Process -FilePath 'javaw.exe' -WorkingDirectory 'C:\Program Files\BiglyBT' -ArgumentList '-cp "BiglyBT.jar;commons-cli.jar;swt.jar" -Dazureus.instance.port=16889 com.biglybt.ui.Main'

Command Prompt example:

start /D "C:\Program Files\BiglyBT" javaw.exe -cp "BiglyBT.jar;commons-cli.jar;swt.jar" -Dazureus.instance.port=16889 com.biglybt.ui.Main

Bash example:

#! /bin/bash

BIGLYBT=/Applications/BiglyBT/.biglybt

java -XstartOnFirstThread -cp $BIGLYBT/BiglyBT.jar:$BIGLYBT/commons-cli.jar:$BIGLYBT/log4j.jar:$BIGLYBT/swt.jar -Dazureus.instance.port=16889 -Duser.dir=$BIGLYBT com.biglybt.ui.Main

Configuration persistence

Configurations passed via the command-line arguments are only valid until you exit BiglyBT. To make them persistent, you need to create and edit a file in %APPDATA%\BiglyBT called java.vmoptions. Add a line for each property you want to set. For example:

-Dazureus.instance.port=16889
-DMULTI_INSTANCE=true

Java VM options

These can be added to the command line as well to specify such things as maximum JVM memory size. Here's an example that set the maximum memory to 800MB:

javaw.exe -Xmx800m -cp "BiglyBT.jar;...

Running multiple BiglyBT instances

On Windows, copy everything from wherever BiglyBT is installed (e.g. C:\Program Files\BiglyBT) into a separate folder, e.g., "C:\BiglyBT 2". Create a .cmd file in this folder (e.g., run.cmd) with the following contents:

start /D "C:\BiglyBT 2" javaw.exe -cp "BiglyBT.jar;commons-cli.jar;swt.jar" -Djava.library.path="C:\BiglyBT 2" -Duser.dir="C:\BiglyBT 2" -Dazureus.config.path="C:\BiglyBT 2" -DMULTI_INSTANCE=true com.biglybt.ui.Main

Run this new batch file every time you wish to start this new instance.

An alternative (and better) way to achieve this that doesn't use the command line is to use the "BiglyBT.exe.vmoptions" file to specify specify the necessary overrides to separate the instances. Duplicate the install folder as above (let's say to C:\Program Files\BiglyBT2) and then modify the vmoptions file in C:\Program Files\BiglyBT to contain (for example)

-include-options ${APPDATA}\BiglyBT2\java.vmoptions
-Dazureus.instance.port=16889
-Dazureus.config.path=${APPDATA}\BiglyBT2
-Dazureus.window.title=BiglyBT2

This approach is better as it allows the second instance to restart correctly for updates etc.

Changing the Control Port

See the above regarding configuring BiglyBT, in particular the setting of the control port via

-Dazureus.instance.port=<nnnn>

Console UI

By default launching from the command line enables the SWT graphical user interface. Power users, however, may wish to use the command-line interface (CLI), also known as the console UI.

To launch the console UI:

  1. Use java.exe instead of javaw.exe.
  2. Append the --ui="console" option to the end of the command line.

PowerShell example:

Start-Process -FilePath 'java.exe' -WorkingDirectory 'C:\Program Files\BiglyBT' -ArgumentList '-cp "BiglyBT.jar;commons-cli.jar;swt.jar" com.biglybt.ui.Main --ui="console"'