I have a Scala project and I would like to export it as a jar.
* 1. First I tried to create a Java class for the project as an entry point
public class JMain { public static void main(String[] args) { System.out.println("Java main calling Scala main"); SMain.main(new String[] {""});
and it worked fine and dandy when starting from Eclipse, but when I export it to jar it will give me 18 exceptions or so. Now I know how to replicate the "environment" in which Eclipse manages to run this, and I am sure that it relies on the fact that Scala is already in my system - I need a separate jar with everything that is packed there.
* 2. My second attempt was to try what lach suggested here How do I deploy a Scala project from Eclipse? namely:
public class JMain { public static void main(String[] args) { System.out.println("Java Main"); List<String> argList = new ArrayList<String>(); argList.add("fully.qualified.ClassName");
This time it will not even start from Eclipse, although it gives only 6 or so exceptions, starting with the famous NoClassDefFoundError . I have the feeling that I am not getting fully .qualified.ClassName correctly. * 3. If the main Scala class is called "Dis.scala" and is in the "pack" package, should it not be fully .qualified.ClassName "pack.Dis"?
I use Jre 1.6 and Scala 2.9.2 EDIT: I included all external imported jars, even scala -library.jar - everything is fine and packed in a jar
PS I am not familiar with Ant or Maven or Sbt. I just want the Scala jared project - if possible, not to get into hairy things.
java scala compilation
adrianton3
source share