3

I am trying to run Scala in TextMate. I have created a new variable TM_SCALA and set it to the path which I obtained on executing the following command on the terminal

which scala

But when I try to run a Scala program, I get the error

Run Script: line 4: scala: command not found

This is the run script

#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"

scala -classpath . -savecompiled "$TM_FILEPATH"

I am unable to understand the problem. Thanks in advance.

Dinesh
  • 2,194
  • 3
  • 30
  • 52

2 Answers2

4
  1. Make sure you have scala downloaded.

  2. update PATH variable in TextMate preferences. Append scalac path there.enter image description here

Pranalee
  • 3,389
  • 3
  • 22
  • 36
0

Add a new command (or replace the 'run script' one) with this:

#!/usr/bin/env ruby -w

cmd = ENV['SCALA_HOME'] + "/scala -nocompdaemon -howtorun:script '" + ENV['TM_FILEPATH'] + "'"

result = "" + `#{cmd}`

puts "#{result}"

That assumes that you have a SCALA_HOME environment variable set to something like this:

export SCALA_HOME="/path/to/my/scala/scala-2.11.4/"
magicrebirth
  • 4,104
  • 2
  • 25
  • 22