Note that there are some explanatory texts on larger screens.

plurals
  1. POExporting Scala project as jar from Eclipse
    text
    copied!<p>I have a Scala project and I would like to export it as a jar.</p> <p>*1. At first I tried creating a Java class for the project as an entry point</p> <pre><code>public class JMain { public static void main(String[] args) { System.out.println("Java main calling Scala main"); SMain.main(new String[] {""}); //SMain.main is the actual *main* </code></pre> <p>and this worked fine and dandy when launched from Eclipse, but when I export it as jar it'll give me 18 exceptions or so. I do now know how to replicate then "environment" in which Eclipse manages to launch this and I'm prety sure it relies on the fact that Scala is on my system already - I need a self contained jar with everything packed in there.</p> <p>*2. My second try consisted of trying what <em>lach</em> suggested here <a href="https://stackoverflow.com/questions/2921600/how-to-deploy-a-scala-project-from-eclipse">How to deploy a Scala project from Eclipse?</a> namely:</p> <pre><code>public class JMain { public static void main(String[] args) { System.out.println("Java Main"); List&lt;String&gt; argList = new ArrayList&lt;String&gt;(); argList.add("fully.qualified.ClassName"); //??? for (String s : args) argList.add(s); scala.tools.nsc.MainGenericRunner.main(argList.toArray(new String[0])); </code></pre> <p>This time it won't even run from Eclipse, although it gives only 6 or so exceptions starting with the famous <strong>NoClassDefFoundError</strong>. I have a feeling I'm not getting <em>fully.qualified.ClassName</em> right. *3. If the <em>main</em> Scala class is called "Dis.scala" and is located in package "pack" shouldn't this <em>fully.qualified.ClassName</em> be "pack.Dis"?</p> <p>I'm using Jre 1.6 and Scala 2.9.2 EDIT: I have included all external imported jars, even scala-library.jar - everything is nice and packed in the jar</p> <p>P.S. I am not familiar with Ant or Maven or Sbt. I just want my Scala project jared - if possible without getting into hairy things.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload