Setting Up Environment

Open PowerShell as administrator (“run as administrator” on right-click), and peform the steps below:

  • Set the execution policy as remotesigned in order to install chocolatey:
    • set-executionpolicy remotesigned
  • Install chocolatey package manager
    • Install instructions available here
  • Install the following packages with “chocolatey install <packageName>”
    • Mandatory packages (running, compiling and installing)
      • jdk7 and/or jdk8 (depending on C* version to develop)
      • ant
      • git
      • python2
      • easy.install
      • pip
    • Optional packages (productivity)
      • gnuwin
      • poshgit

Running cassandra-dtests

Running CCM

  • You need to set the execution policy to unrestricted to run CCM on PowerShell as administrator:
    • set-executionpolicy unrestricted
  • Add .PY extension to environment variable $PATHEXT, to allow ccm to be executed from any location (run on PowerShell as administrator):
    • [Environment]::SetEnvironmentVariable("PATHEXT", "$env:PATHEXT;.PY", "MACHINE")

  • Create a symbolinc link (as administrator) to make chocolatey ant work with ccm, since ccm expects an ant.bat executable, while chocolatey creates and ant.exe file:
    • cmd /c mklink C:\ProgramData\chocolatey\bin\ant.bat C:\ProgramData\chocolatey\bin\ant.exe

Script for switching JDKs

In a mixed JDK7/JDK8 the following PowerShell functions might be useful for switching jdks (place them on $ENV:HOME\Documents\WindowsPowerShell\profile.ps1):

function updateJavaHome($newHome)
    [Environment]::SetEnvironmentVariable("JAVA_HOME", $env:JAVA_HOME, "Machine")

function updateRegistry($newVersion)
    Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\' CurrentVersion $newVersion

function updatePath
    $PathWithoutJava=(($Env:Path).Split(";") | where {$_ -notmatch 'java'}) -join ";"

function java8
    updateJavaHome("C:\Program Files\Java\jdk1.8.0_51")

function java7
    updateJavaHome("C:\Program Files\Java\jdk1.7.0_76")
  • No labels