Reputation: 285
I'm trying to write a simple batch script to test my Scala program. The script should be something like this:
#!/bin/bash
scala ./build/classes/MyClass "../../res/some_file.txt"
This returns:
Exception in thread "main" java.lang.RuntimeException: Cannot figure out how to run target: ./build/classes/MyClass
If I'm in the classes directory running:
#!/bin/bash
scala MyClass "../../res/some_file.txt"
works as expected.
What am I doing wrong here?
-Lee
Upvotes: 2
Views: 343
Reputation: 297165
You cannot pass the file name of a class -- you have to pass the class name, and it has to be in the classpath. So, instead, try this:
#!/bin/bash
scala -cp ./build/classes MyClass "../../res/some_file.txt"
Upvotes: 7