Åge83
Åge83

Reputation: 35

Unable to use java code in scala

The following scala file is located in a folder that also contains subfolder de\tilman\mathParser. In that subfolder the java class MathMLParser is located.

import de.tilman.mathParser.MathMLParser

object MathML2LaTeX{
  def main(args: Array[String]) {
    /*try {
      val parser = new MathMLParser()     
    } catch {
      case e: Exception => println("exception caught: " + e);
    } */

  }
}

If I try to compile:

%USERPROFILE%\Documents\MathMl2Latex\MathParser> scala MathML2LaTeX.scala
C:\Users\Aage\Documents\MathMl2Latex\MathParser\MathML2LaTeX.scala:1: error: not found: object de
import de.tilman.mathParser.MathMLParser
   ^
one error found
Process scala exited with code 1

I'm doing this in a simple texteditor,it is a tiny program I'm writing. Just wanted to try writing something in Scala and I am thinking it shouldn't be neccessary to start project in an IDE for a small thing like this. Waiting for Netbeans to load probably increases "development" time by 50%. (just gonna call a method in MathMLParser with text in clipboard as argument and put the returned value back on clip board...)

Upvotes: 1

Views: 89

Answers (1)

Rob Starling
Rob Starling

Reputation: 3908

Could it be that the scala runner isn't looking in . for the classpath? See scala -help and scalac -help. Try scala -classpath . MathML2LaTeX.scala

Also, can you confirm that MathMLParser has already been compiled to a .class file (in ./de/...) ? I don't think the scala-runner will do that on the fly.

Upvotes: 2

Related Questions