Hacker Newsnew | comments | show | ask | jobs | submitlogin

The Java way has always been: To run this, click on the .bat file or type java -jar myapp.jar. And some people wonder why Java has been such a failure on the desktop.

This should have been in Java from the beginning, instead of outsourcing this functionality to third parties (Mainly Windows only installer applications that sucks, and also isnt used that much).

That said, I think it is misguided to include a JRE in the bundle. The correct way would be something like OS X Lion has, promt the user if Java is not installed. and then do a more or less automatic install of Java, in the system.




> That said, I think it is misguided to include a JRE in the bundle. The correct way would be something like OS X Lion has, promt the user if Java is not installed. and then do a more or less automatic install of Java, in the system.

Apple is recommending that as of Mountain Lion, Java apps should bundle the JRE from Oracle's OpenJDK and use that. Apple's unofficial Java spokesperson Mike Swingler is adamant that this new approach (for Apple) is better.

-----


IMO the correct way is to include subset of JRE that's actually required for given application. This can lead to relatively small total application size and deployments that do not require any knowledge of java and java world from end user. Having one JRE for all apps on the system is nice but it's usually not needed.

-----


Yes, but still parts of the JVM would be duplicated between apps and updated on app developer X's own schedule.

-----


There are downsides to this sort of duplication (like security bug fixes not being automatically applied to all apps using a certain JRE revision) but in real-world practice, the benefits outweigh the downsides.

Windows' SxS DLL system has the same basic issues but it solves so many distribution, UX and versioning problems that the downsides are totally worth it.

-----


Part of what this seems to be there to solve is the situation where the user doesn't have access rights to install a JRE.

-----


Why "installing" almost anything requires "access rights" is still confusing to me. I don't understand why there's not been a movement to 'install' things in to my own home directory structured, vs "c:\program files" on windows "/usr/bin" and such on linux. - Fall back to c:\mystuff or ~/bin.

-----


ClickOnce[1] does this.

Some other apps have their own mechanisms to do the same, e.g. Google Chrome.

I don't think it's a good idea though, as it makes those apps more susceptible to being modified by malware.

[1]: http://en.wikipedia.org/wiki/ClickOnce

-----


Is this really such a problem on modern systems? How many stripped JREs is it going to take to add up to a gigabyte?

-----


Yes, it's always amazed me how such a simple thing gets screwed up.

Here on Ubuntu I had to write a custom minecraft launcher just so that I could launch the .jar from my desktop.

-----


You can use the binfmt_misc kernel module to configure Linux to automatically launch Jar files that are marked as being executable. See: http://www.mjmwired.net/kernel/Documentation/java.txt

That Ubuntu doesn't do it by default, that's just their choice (a sane choice I think).

-----


Hold it!

Kernel module seems a bit drastic. You can just change the file association.

-----


I'm tempted to downvote this, but maybe you know something I don't. The kernel module allows you to chmod +x a class, jar, or applet and execute it from the command line. Or run it from a script, or exec() it, or whatever. It essentially makes it a real executable alongside ELF. Is there some other way to accomplish this? What file association do you mean?

-----


I believe he's talking about configuring your desktop environment such that it will launch .jar files with java (perhaps through a script intermediary), which is indeed not nearly as cool as what you're describing.

-----


Given that the original comment here said "from my desktop", I assume he means something he can click, and associating jars with the JRE in the desktop environment is probably a reasonable solution.

-----


Yeah, and I rarely use java command line utilities, personally, with one exception.

-----


At least on Mac OS X, you can double-click .jar files and they will get launched as the user expects, complete with Dock presence.

-----


Most Java applications are not built to work that way. They usually need the full CLASSPATH formed before they can launch. One .jar would not suffice.

-----


The developer of a jar can specify a Class-Path entry in the Manifest file to set up the classpath correctly. In this case, "java -jar some.jar" is all you need.

https://blogs.oracle.com/olaf/entry/jdev_including_a_classpa...

-----


Yes, that is a bit better than Windows, were this functionality would have mattered the most to have from the beginning.

Still, its not 100% the way OS X users expect apps to work.

-----


You seem to be under the impression that Windows doesn't do the same. That's wrong.

Windows does the same thing as OS X. You can do the same on Linux, even on the console over there (using binfmt_misc, see [1]) without a desktop environment.

For as long as I can remember Java installed an entry in HKEY_CLASSES_ROOT for .jar files. On my machine it's currently set up to run

  "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*
whenever I want to 'launch' a jar file.

1: http://stackoverflow.com/questions/1667830/running-a-jar-fil...

-----


The biggest problem that I've seen is that on Windows apps sometimes steal this association. I used to tell users to do this to launch Java applications, but it was surprising how many times they would end up in WinZip or some other Zip handling application.

Java does try to get that to work by default, though.

-----


File compression utilities really do go way overboard on what they want to open as zipped files. Installing one usually means having to uncheck maybe half the defaults because they're more commonly used as regular file formats.

-----


Spoken like someone who knows nothing about Java. There are a bunch of apps written in Java web start(ie yEd), which involves just clicking on a link. Off the top of my head, some very popular Java apps are Eclipse/Intellij or Azureus.

-----


I use IntelliJ daily, and the install experience is "devloper friendly", not exactly end user friendly. Dont get me started on Eclipse install process.

JWS is awful. It is totally not the way users expect to install applications.

-----


"Dont get me started on Eclipse install process."

Actually, please start. I install the JDK via an installer, unzip Eclipse, run eclipse.exe, and it just works. Am I missing something?

-----


Probably the part where it usually can't find your JDK (and barfs with some random error on startup as a result) until you edit a config file or set some environment variable(s). NetBeans on the other hand usually finds 5 different JDKs on your system and asks which one you would like to use.

-----


which part of intellij installation that is more developer friendly? i just download the DMG and drag the icon to Applications, just like other apps.

-----


Im using ItelliJ on linux now, IntelliJ is just a .zip. You are right thats the way it works on OS X and that is excellent.

-----




Guidelines | FAQ | Support | API | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: