The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Is there a way to "export" the compiled class files into runnable jar?

1 reply on 1 page. Most recent reply: Dec 29, 2008 4:42 PM by Haixu Huang

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Haixu Huang

Posts: 6
Nickname: regular
Registered: Oct, 2008

Is there a way to "export" the compiled class files into runnable jar? Posted: Dec 25, 2008 12:36 AM
Reply to this message Reply
Advertisement
See title.


Haixu Huang

Posts: 6
Nickname: regular
Registered: Oct, 2008

Re: Is there a way to "export" the compiled class files into runnable jar? Posted: Dec 29, 2008 4:42 PM
Reply to this message Reply
OK, maybe it's too simple to reply it.
I now give an answer for it.
I use Eclipse.
First, create a small entrance class, with the "main" method.
package scala.loader;
 
import java.util.*;
 
public class Test
{
    public static void main(String[] args) {
        List<String> argList = new ArrayList<String>();
        argList.add("scala.main.object.name");
        for (String s : args) argList.add(s);
        scala.tools.nsc.MainGenericRunner.main(argList.toArray(new String[0]));
    }
}


Second, be sure to set the class path of .../scala.tools.nsc_2.7.?.jar
In eclipse, it maybe exists in plugins/ directory.

Third, in eclipse, export to the runnable jar. The main class is the class we created in first step.

That's all.

I take reference of Scala's scala.bat file.

Flat View: This topic has 1 reply on 1 page
Topic: Can I override a field with a method? Previous Topic   Next Topic Topic: Chapter 15 Example Issue

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use