GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Can you include only  a partial Java Runtime with you applications? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can you include only  a partial Java Runtime with you applications?" Watch "Can you include only  a partial Java Runtime with you applications?" New topic
Author

Can you include only a partial Java Runtime with you applications?

Gus Wilco
Greenhorn

Joined: Aug 01, 2008
Posts: 4
Hi.. been away from Java development for a few years. Has anything changed about distributing the JRE with your applications? Sun used to make you include the entire thing, which would bloat the size of download. Are you allowed to include a stripped down Sun Java JRE with your application? Tried Apache Harmony, but run into some glitches.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Java 6 Update 10 (which is in release candidate stage right now) is introducing a new Java Kernel. It allows for incremental downloading of the JRE and/or plug-in. This is so applications can start faster for users that do not yet have the JRE installed. It first downloads the parts that are needed, starts the application, and then downloads the remainder.

I have not done enough reading on it to know if it will allow you to limit the size of the JRE you bundle with an application. You can look here (http://java.sun.com/developer/technicalArticles/javase/java6u10/index.html) for a technical article on what Java 6 update 10 is bringing to the table. (Not sure why they are doing this as an "update" rather than a .1 release.) I believe the Java Kernel is geared towards applets and Java Web Start (JWS) applications, so it may not offer what you are looking for. But again, I've only cursorily read on the subject.

There have been a number of articles on the subject on java.net as well. So Googling that site for Java Kernel might give you some more info.
[ August 25, 2008: Message edited by: Mark Vedder ]
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

p.s. the Java 6 Update 10 release candidate is available for download.
Gus Wilco
Greenhorn

Joined: Aug 01, 2008
Posts: 4
hmmm... sounds like c# might be a better choice for developing desktop Apps for Windows :-(

Was hoping that Sun would have allowed a stripped down, private JRE to be distributed as part of my Application.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Gus Wilco:
hmmm... sounds like c# might be a better choice for developing desktop Apps for Windows :-(

Was hoping that Sun would have allowed a stripped down, private JRE to be distributed as part of my Application.
I have been involved with a C# desktop application, and our install procedure does involve installing the .Net runtime. You can't assume that will already be on a Windows PC. And it's about the same size as a JRE, i.e. about 10 or 20 megs. So, if ease of installation is your primary criterion for choosing, C# isn't better.

Sun does allow installing a private JRE, but not a "stripped-down" one, whatever that might be. I don't know whether you can install a private .Net runtime or not.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

You might want to take a look at yGuard which is a free Java� Bytecode Obfuscator and Shrinker. With "regular" third party jars, it will examine your code and shrink the API jars down to just the classes you are using, and their dependencies, from the jar:


from http://www.yworks.com/en/products_yguard_about.html

Code Shrinking: drastically reduces the size of the input Jar files if your application does not use all of the contained bytecode.
The shrinking engine analyzes the bytecode of all input Jar files in order to determine which code entities can not be reached from a set of given code entry points. These obsolete code fragments (either entire classes or single methods and fields) will then be removed by yGuard. If you use any third party libraries, you will probably benefit a lot from the yGuard shrinking engine, since applications usually do not use all of the functionality provided by an external library and a large fraction of the contained bytecode and resources can be safely removed.



I've never tried to use it on the actual JRE jars (such as rt.jar)... don't know if you even can... but who knows... maybe it will work. Risky in my humble opinion... but "cutting edge" to someone else perhaps
[ August 25, 2008: Message edited by: Mark Vedder ]
 
Don't get me started about those stupid light bulbs.
 
subject: Can you include only a partial Java Runtime with you applications?