Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After a lot of trial and error, this is the best method I found for packaging the Scala app for distribution:</p> <p>First, create a Java class to be the main entry point for the application as described by <a href="http://garyboone.com/2009/06/creating-single-file-runnable-jars-in-scala-and-eclipse/?wscr=1680x1050" rel="noreferrer">Gary Boon</a>. This allows you to run the application from a JAR with the java command. I found that running a Scala class with the java command is problematic, even when you have the Scala libs on the source path:</p> <pre><code>import java.util.ArrayList; import scala.tools.nsc.MainGenericRunner; public class Main { public static void main (String[] args) { ArrayList&lt;String&gt; argList = new ArrayList&lt;String&gt;(); argList.add("fully.qualified.ClassName"); for (String s : args) { argList.add(s); } MainGenericRunner.main(argList.toArray(new String[0])); } } </code></pre> <p>Now you can use Eclipse's <em>Export Runnable JAR</em> command to package up all your classes and libraries into a JAR file. Set the JAR's main class to the Java entry point. You can also save the Eclipse-generated output settings as an ANT build file so you can make adjustments. Using ANT to create the JAR with a Java entry point yielded best results. You can also package up other JAR dependancies this way which makes it a whole lot simpler when trying to run the JAR on a different host. As a minimum you will need the Scala library and the Scala tools JAR.</p> <pre><code>&lt;zipfileset excludes="META-INF/*.SF" src="${scala.lib.jar}"/&gt; &lt;zipfileset excludes="META-INF/*.SF" src="${scala.tools.jar}"/&gt; </code></pre> <p>If you're using embedded Jetty, as I am, you can run the server as a Daemon process using the following command (<a href="http://www.jguru.com/faq/view.jsp?EID=472493" rel="noreferrer">source</a>):</p> <pre><code>nohup java -jar MyJettyServer.jar &lt; /dev/null &gt;&gt; server.log 2&gt;&gt; server_error.log &amp; </code></pre> <p>This runs the program as a background process which is independent of the current user session so the process will continue after you logout of the host.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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