This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Distributing an application written in Scala

4 replies
mailleux
Joined: 2008-08-23,
User offline. Last seen 4 years 7 weeks ago.
I create a small swing based application in Scala. I am really happy on how modular the code turned out to be. However when it came time to distribute it, I ran into some issues. I need the scala-library.jar and scala-swing.jar. I simply added them to the applications ZIP file in the proper directory, and create a simple script to fire the applications. This works fine, but has a draw back. The end file is 4 MB big, despite my jar being only 330K. I'm sending this to people that are not programming and java savvy, so I have the following questions:

1) Do I violate the scala license in doing this?
2) Is there a simple way to download these two files from scala distribution channels?
3) I noticed that the download page has scala.library_2.7.2.final.jar? Can I ask them to download this? What would be the classpath for the java command to use this file (I never specified classpath for jars in a jar)?
4) Anyone have a generic script for linux and windows that figures out the proper jars needed from looking in the disk? (similar to the scala.bat)?
5) Anyone have a "Setup" application for Scala apps that make it easy for an average user to download the requirements?

Thanks,

 Thomas
DRMacIver
Joined: 2008-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Distributing an application written in Scala
On Fri, Dec 19, 2008 at 8:55 AM, Thomas Sant Ana <mailleux [at] gmail [dot] com> wrote:
I create a small swing based application in Scala. I am really happy on how modular the code turned out to be. However when it came time to distribute it, I ran into some issues. I need the scala-library.jar and scala-swing.jar. I simply added them to the applications ZIP file in the proper directory, and create a simple script to fire the applications. This works fine, but has a draw back. The end file is 4 MB big, despite my jar being only 330K. I'm sending this to people that are not programming and java savvy, so I have the following questions:

You should investigate using something like proguard or jar jar links to reduce the application size. You'd probably find that you can bring the entire thing significantly under 1M.
 

1) Do I violate the scala license in doing this?

You need to keep a copy of the scala license in your distribution, but otherwise it's fine.
mailleux
Joined: 2008-08-23,
User offline. Last seen 4 years 7 weeks ago.
Re: Distributing an application written in Scala


On Fri, Dec 19, 2008 at 12:31 PM, David MacIver <david [dot] maciver [at] gmail [dot] com> wrote:
On Fri, Dec 19, 2008 at 8:55 AM, Thomas Sant Ana <mailleux [at] gmail [dot] com> wrote:
I create a small swing based application in Scala. I am really happy on how modular the code turned out to be. However when it came time to distribute it, I ran into some issues. I need the scala-library.jar and scala-swing.jar. I simply added them to the applications ZIP file in the proper directory, and create a simple script to fire the applications. This works fine, but has a draw back. The end file is 4 MB big, despite my jar being only 330K. I'm sending this to people that are not programming and java savvy, so I have the following questions:

You should investigate using something like proguard or jar jar links to reduce the application size. You'd probably find that you can bring the entire thing significantly under 1M.
 

I tried proguard but ran into a strange issue:

It can find scala.Nothing. Which is in the source tree but not in the scala-library.jar on 2.7.2-final

Any clue?

Thomas
DRMacIver
Joined: 2008-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: Distributing an application written in Scala
On Fri, Dec 19, 2008 at 7:20 PM, Thomas Sant Ana <mailleux [at] gmail [dot] com> wrote:


On Fri, Dec 19, 2008 at 12:31 PM, David MacIver <david [dot] maciver [at] gmail [dot] com> wrote:
On Fri, Dec 19, 2008 at 8:55 AM, Thomas Sant Ana <mailleux [at] gmail [dot] com> wrote:
I create a small swing based application in Scala. I am really happy on how modular the code turned out to be. However when it came time to distribute it, I ran into some issues. I need the scala-library.jar and scala-swing.jar. I simply added them to the applications ZIP file in the proper directory, and create a simple script to fire the applications. This works fine, but has a draw back. The end file is 4 MB big, despite my jar being only 330K. I'm sending this to people that are not programming and java savvy, so I have the following questions:

You should investigate using something like proguard or jar jar links to reduce the application size. You'd probably find that you can bring the entire thing significantly under 1M.
 

I tried proguard but ran into a strange issue:

It can find scala.Nothing. Which is in the source tree but not in the scala-library.jar on 2.7.2-final

Any clue?

Oh. That's unfortunate. :-( I think that's related to https://lampsvn.epfl.ch/trac/scala/ticket/1254

The easiest workaround would be to create a scala.Nothing class file yourself (just create a file nothing.scala containing package scala, class Nothing). Hopefully that should do the trick.
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Distributing an application written in Scala

On Fri, Dec 19, 2008 at 10:20:09PM -0200, Thomas Sant Ana wrote:
> I tried proguard but ran into a strange issue:
>
> It can find scala.Nothing. Which is in the source tree but not in the
> scala-library.jar on 2.7.2-final

I already opened a ticket about this (actually I opened it about something a little different, but
look at my subsequent comments and you'll see it come back around.)

http://lampsvn.epfl.ch/trac/scala/ticket/1572

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland