Dinesh
Dinesh

Reputation: 2204

run Scala in TextMate

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.

Upvotes: 3

Views: 901

Answers (2)

Pranalee
Pranalee

Reputation: 3409

  1. Make sure you have scala downloaded.

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

Upvotes: 4

magicrebirth
magicrebirth

Reputation: 4234

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/"

Upvotes: 0

Related Questions