Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8202983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:23:05+00:00 2026-06-07T07:23:05+00:00

I have a Scala project and I would like to export it as a

  • 0

I have a Scala project and I would like to export it as a jar.

*1. At first I tried creating 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[] {""}); //SMain.main is the actual *main*

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.

*2. My second try consisted of trying what lach suggested here How to 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"); //???
  for (String s : args) argList.add(s);
  scala.tools.nsc.MainGenericRunner.main(argList.toArray(new String[0]));

This time it won’t even run from Eclipse, although it gives only 6 or so exceptions starting with the famous NoClassDefFoundError. I have a feeling I’m not getting fully.qualified.ClassName right. *3. If the main Scala class is called “Dis.scala” and is located in package “pack” shouldn’t this fully.qualified.ClassName be “pack.Dis”?

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.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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:23:07+00:00Added an answer on June 7, 2026 at 7:23 am

    Here is what worked for me:
    1. Create scala project
    2. Create Wrapper java project
    3. Add the scala-library.jar to you java project build path.

    So you only need the 3rd step in addition since the rest looks similar to what I did. Then you can happily use: java – jar file.jar

    EDIT:
    How to create a JAR File which contains Scala/Code which can be consumed by another Java Project, using Scala – Eclipse IDE.

    1. Create a new Scala Project and define an object with a main method as entry point.
    2. Now create a new Java Project and add your Scala Project to the new ones buildpath. Additionally add the scala-library.jar to the Java project.
    3. Now create a Wrapper class in the java project which calls your entry point class from the scala lib. Run the wrapper class to create a eclipse run configuration and test if you can call the scala project.
    4. Use the Export->Java->Runnable JAR file, Wizard now on the wrapper project.The eclipse run configuration will be used as entrypoint into the JAR. Depending on your needs you may want to :
      extract required libraries into generated JAR
      or
      Package required libraries into generated JAR

    Finally you get a complete packaged JAR which you can use like this:

    java – jar wrapped.jar

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing java/scala application using a global thread pool. I would like
I have a Scala/Java dual language project where I need to pass a Scala
I am learning Scala and I have a Java project to migrate to Scala.
Just starting to learn scala for a new project. Have got to the point
I'm learning myself Play 2.0 (Java API used) and would like to have a
I have a simple Scala project that runs without any problems inside Eclipse, however,
We have a project that contains a library of Python and Scala packages, as
I have created a project that uses scala that has some abstract classes definitions
I have the following situation. My project has a main.scala.html file and a folder
Does Scala have a version of Rubys' each_slice from the Array class?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.