- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Re: Scala applet deployment strategies
Thu, 2010-12-30, 21:35
2010/12/30 Piotr Kołaczkowski <pkolaczk@elka.pw.edu.pl>
Using proguard is great, but it only delays the problem in time.
But how did you load classes from the jar after unpacking? Is there some magic trick to bring something to a classpath without creating your own classloader? I can't see addUrl method on a standard classloader :(
All I hear when I read this is: "Is there some way for me to hack the Java runtime"?
Regards,
Piotr Kołaczkowski
W dniu 2010-12-30 21:15, Rodrigo Cano pisze:
My solution for an applet of ~10MB was to use proguard
<http://proguard.sourceforge.net/>, the Java class file shrinker,
optimizer, obfuscator, and preverifier. It outputed a jar of 2.2MB with
everything in it that worked fine.
Later on, I wanted even more compaction so I used pack200 on the
proguarded jar. It produced a 680kb packed file, which was OK but not
executable, so I wrote a little java class that unpacks a resource
within the jar (my proguard-pack200-ed app) in runtime, bundled that
together in a jar, and I came up with an executable jar file of 685 KB
:), of course then I added some images so it finally ended up in 840KB.
The con that this approach had is that using pack200 in runtime requires
permissions from the jvm, so I stilled had to show to the user that
"accept certificate" window, Nevertheless I was so glad with the
compaction that I stayed with this approach.
If you want no complications, then I suggest you to simply use Proguard,
and as Kevin suggested while I am still writing this, Java's class
loader works with urls and requires no extra permissions if those urls
points to the server from which the original jar came from.
Cheers.
2010/12/30 Piotr Kołaczkowski
<pkolaczk@elka.pw.edu.pl
<mailto:pkolaczk@elka.pw.edu.pl>>
Hello,
Maybe my question is not regarding Scala directly, but many really
smart people knowing Java read this list and maybe someone knows how
to solve my problem.
Ok. So the problem is I want to deploy a rather large application as
an applet. The application is split into several jars. One of them
is scala-library.jar. ;) Of course, it is undesirable for the end
user to wait for all the application to download (~10 MB), before
the applet is started.
Is there a way to deploy a Scala applet so that it loads just a
single small jar first (a jar responsible for a basic GUI or at
least showing something more than just the standard Java applet
progress bar) and then, from the same server get the rest of the
jars in the background, while allowing the user to start playing
with the application? Is it possible for an unsigned applet. If not,
can I made an applet that won't show any stupid "accept certificate"
window to the user? The main problem is - when I download the jars
from the server, how to force them to be included "on the
classpath", so that I can load classes from them dynamically?
Oh, and any other suggestions on how to make the scala-library.jar
smaller are also welcome...
Regards,
Piotr Kołaczkowski
--
Viktor Klang,
Code Connoisseur
Work: Scalable Solutions
Code: github.com/viktorklang
Follow: twitter.com/viktorklang
Read: klangism.tumblr.com