Skip to content

Compiling

Tres Finocchiaro edited this page Sep 10, 2016 · 46 revisions

Compatibility

  • ✅ 2.1 | ✅ 2.0 | ✅ 1.9 | ...

Steps

  1. First, install dependencies (jdk, git, ant, nsis/makeself) per Install Dependencies

  2. Clone the source code per Clone Source Code

  3. Pull in the latest source code

cd tray
git pull
  1. Compile
ant
  1. Package
ant nsis       # <-- Windows installer
ant pkgbuild   # <-- Apple installer
ant makeself   # <-- Linux installer

Note: The installer will be placed in ./out/qz-tray-x.x.x.x, (i.e. .exe, .run, .pkg)

  1. Troubleshooting
  • Class not found: javac1.8
    • Cause: This is an ant + JDK8 bug
    • Solution: Add the parameter -Dbuild.compiler=javac1.7 to your ant command
  • Could not find appropriate signing identity for "P5DMU6659X"
    • Cause: An apple-certified private key is expected during package time
    • Solution: Remove the line --sign PMDMU6659X from ant/apple/apple-packager.sh.in

Advanced

ANT Command Line

  • Override internal certificate used for signature validation*

    ant nsis -Dauthcert.use=path/to/override.crt

    *Since 2.0.2

ANT Properties File

  • Common uses:
    • Signing a Windows installer executable
    • Providing persistent ant property overrides

Create tray/.../private/private.properties properties signing.alias=#keystore alias signing.tsaurl=#timestamp url signing.keypass=#key password signing.storepass=#store password signing.keystore=#path to jks file #authcert.use=#path to signing auth cert


IntelliJ

  1. Download and install JDK 1.7 or higher from oracle.com/technetwork
  2. Download and install IntelliJ from https://www.jetbrains.com/idea/
  3. Launch IntelliJ
  4. When prompted, click Check out from Version Control (GitHub)

Host: github.com
Auth type: password
Login: <github username>
Password: <github password>

  1. Clone Repository

Git Repository URL: https://github.com/qzind/tray
Parent Directory: <leave default, usually "C:\Users\username\IdeaProjects">
Directory Name: <leave default, "tray">
Note, if the Parent Directory doesn't exist, create it.

  1. Open the project
  2. Switch to project view using ALT + 1
  3. Click File, Project Structure
  • Verify Project SDK is correct. This must be 1.7 or higher (QZ Tray 2.1 requires 1.8 or higher).
  • If <No SDK>, click New, JDK and browse to the appropriate install location, e.g. C:\Program Files\Java\jdk1.8.0_XX
  1. Keeping the Project Struture Window open. Navigate to Modules, Dependencies Tab
  • If plugin.jar shows an error, remove it and re-add it:
    • Click plugin.jar, Click - to remove
    • Click + to add, JARs or Directories
    • Browse to the SDK location, e.g. C:\Program Files\Java\jdk1.8.0_XX\jre\lib\plugin.jar
    • Make sure plugin.jar is at the top of the Dependencies listing, use arrows if needed, OK
  1. From the Project Explorer, Navigate to
  • tray, src, qz, ws, PrintWebSocketServer
  • Right Click, Run
  • On Windows, a firewall prompt may appear, click Run
  1. Exit PrintWebSocketServer by locating it in the System Tray, Right Click, Exit
  • Alternately, you can click Stop within IntelliJ from bottom left "Run" tab
  1. Optional to enable HTTPS support in IntelliJ
  • If a version of QZ Tray is NOT installed, generate a qz-tray.jks and qz-tray.properties manually
    • Create a 2048 bit RSA java keystore with an alias qz-tray

    • Create a properties file with the following lines in it:

      wss.alias=qz-tray
      wss.keystore=<path-to>/private-key.jks
      wss.keypass=<password>
      wss.storepass=<password>
  • If QZ Tray is installed, you may use the qz-tray.properties located in the installation folder.
  • Click on PrintWebSocketServer.java in the Projects Navigator
  • From the file menu click Run, Edit Configurations...
  • In the VM Options add -DsslPropertiesFile=<path-to>/qz-tray.properties
Clone this wiki locally