I hope this is not off-topic for SO (I hesitated between SO and programmers.stackexchange) but as far as I can tell this is a "practical, answerable problem that is unique to the programming profession" so it's complying with the FAQ.
Which version of the JVM do you need in order to run which version of Clojure (Clojure on the JVM, this question is not about ClojureScript)?
The page here: http://clojure.org/getting_started states that:
Clojure requires only Java 1.5 or greater
But is this always going to be the case?
And what about the Clojure ecosystem, like Leiningen?
Basically I'd like to know if I can count on Clojure to be able to develop a desktop app that should run on systems, including OS X systems, that are never going to get Java 6 nor more recent versions of Java (for example on some OS X versions Apple stated that no JVM 6 would ever see the light).
I am not on the Clojure/core team, so I don't have inside information, but here is how I would approach this situation.
Take the latest version of Clojure (1.5 as of this writing) and test it against Java 1.5 for the things you need to do and any Clojure libraries you need to use and stick with that. If Clojure 1.5 is Java 1.5 compatable, it will always be so, since that release is immutable.
I would not make the assumption that all Clojure versions after 1.5 will be Java 1.5 compatible and you definitely can't assume that Clojure libraries will be. For example, I just released a Clojure library that requires Java 1.7 (since it uses a java.util.concurrent class introduced in Java 1.7).
Since Leiningen gives you maven-like dependency resolution if you test all your libraries and your chosen version of Clojure against Java 1.5 and they work, then you can stick with that set of versioned dependencies for as long as you want to keep the app running. Your only risk at that point is that some bug fix releases of a non core library might not be Java 1.5 compatible any longer. This risk is proportional to how many non-core Clojure libraries you need to use.
If you are selective about what libraries you use, then targeting Java 1.5 is certainly feasible.
Clojure is very conservative about it's Java version requirements - hence the dependency on version 1.5 only.
Many libraries depend only on Clojure itself, so will run quite happily on the 1.5 JVM
Some libraries require >1.5, these tend to be more advanced libraries that have requirements for interop with specific Java features (e.g. newer concurrency code).
Note: I personally write all my apps/libraries to target Java 1.6, since I think that is a reasonable minimum and the vast majority of Java-based systems are at 1.6 or above. I'm willing to live with the potential loss of a few users who are stuck on 1.5. Also, even if a future version of Clojure does abandon 1.5, I expect it will continue support for Java 1.6 for a long time.
Notably, in Clojure 1.6 they have bumped the version of Java to 1.6:
The Clojure 1.6 Release Notes
include this ticket:
CLJ-1268: Require Java 1.6 as minimum for Clojure
So, "no" is the answer to the original poster's question of "But is [Clojure requires only Java 1.5 or greater] always going to be the case?"
Related
I want to know whether the official Java core API is part of JDK or JRE.
According to my understanding of Java, I think that the core API should be part of the JRE, as the application should be runnable without the additions provided by the JDK.
I also found some information on the web that says the 3 basic components of the JDK are,
Java Compiler
JVM
Java API
(As the JRE is the implementation of JVM, does the Java API belong to JRE or JDK?)
Edit: actual question: Is the Java API included in JRE?
Your facts are a bit inaccurate.
I also found some information on the web that says the 3 basic components of the JDK are: 1. Java Compiler, 2. JVM, 3. Java API.
That's not a good summary. There are certainly other things in a JDK apart from that.
As the JRE is the implementation of JVM
In fact the JRE includes an implementation of the JVM. And it also includes the core Java APIs, and a few other things.
As Holger points out, a JDK consists of a JRE plus some additional Java development tools. Or as he succinctly puts it:
"JDK = JRE + development tools"
So to answer your question:
does the Java API belong to JRE or JDK?
The Java APIs are included in both a JRE distribution or JDK distribution, but the phrase "belong to" doesn't have much meaning in this context.
(Now one could debate whether a JDK "contains" a JRE (or not), and whether the JRE "contains" the Java APIs. But to be honest it is a pointless debate. What really matters is that the Java APIs are present in both kinds of distribution.
Also, this is substantially moot in Java 11, since Oracle no longer provides JRE distributions for either Oracle or OpenJDK Java. It is now JDK only.)
A picture is worth a thousand words.
However, please note, the above diagram reflects the structure of JDK 8 and for later editions it is different.
My application requires a GUI, and I was thinking of using GTK+ because by far it is the best library for Graphical User Interface. When I looked at the GTK+ page and went to Language Bindings, I found the following:
If Ruby is a good language and has a lot of programmers, why doesn't Ruby support GTK+ 2.14 and newer versions?
Because bindings to a more recent versions hasn't been yet written ? ;-)
Ruby-GNOME project is probably the most known implementation, see status of Gtk2. They also provide bindings for Gtk3, version 3.4 .
The differences between 2.12 and 2.24 are relatively marginal, there is no point it should you keep back at writing Gtk2 UIs in Ruby. The project is very active, latest commits was done a day ago.
Btw. linking on Linux/BSD systems is done to the major version so it'll run regardless minor subversion is currently installed. If there is some very specific feature added in latest versions you can write binding yourself, it's very easy. However as you are just at learning stage I'd bet you'll ever get in such situation in the near future.
I've been debating whether or not to bundle a JRE with my application. I've listed some reasons below why I think it would be useful, but I'm also hesitant to do this because it makes the app much larger.
Why I think it would be useful:
Right now the app is run by running a batch file (well, a shortcut to a batch file, it is run via a batch file). It just calls java -jar XXX, which requires Java to be in the path, which is not always the case.
We're a small team and not fully running on Java 7 (there are some strange errors we are trying to debug still). If a user has Java 7, they may have an unpleasant software experience - this is not good for us. Packaging a specific version of the JRE ensure we've fully tested on it.
We support 32 and 64 bit Windows platforms. When the user downloads the software, they choose 32 or 64-bit, but this is asking which version of Java are they using. Most users don't know if 32-bit java is installed on their 64-bit platform, and it can be confusing to download 32-bit even though their OS is 64-bit.
There are some good reasons why not to package it though:
If a security hole is in Java or other significant updates are made to the JRE, we need to distribute a new version of our app with a new Java version. We are generally updating our app every couple of weeks, so I'm not too concerned about this one right now.
The app will now be much larger because it includes a packaged JRE.
Can anyone provide some guidance as to whether or not (based on these requirements) they think it is a good idea to package the JRE? If not, what are some alternatives to just hoping that java is in the path (and more importantly if it's not, it is possible our users may not know how to add it).
Java Web Start. The JRE will be on the path.
For version control, see Java Web Start - Runtime Versioning & particularly Earlier Version.
JWS can partition resources between a 64 bit & 32 bit JRE.
So, 'bad idea to bundle JRE'. Use web-start instead.
I would suggest to NOT bundle the JRE although I often see it as a common practice.
Instead I would either use webstart (can be used offline as well) or some other installer or pacakge manager solution that ensures that Java is installed including the correct version. This will widely depend on the operating system you expect to run on.
Going down the way of including Java begs the question what else you want to include, just to be sure... which will lead you to the whole operating system and everything needed thought to the end.
I would also suggest to closely look into what types of users will install the app and adapt to that and make some sort of estimate on how capable they will be.
We have a project which (assumed) would be finished in 1-2 years. By then, the JDK7 (and hopefully the Java7 JCP spec) should be ready.
But, I wonder, how probable is the "danger" that Oracle will make a "stupid" decision, which would make the JDK7 a less "attractive" platform then the existing JDK6?
More specific, I'm afraid of scenarios such as:
halting the development of JDK7 before it is "released"
changing the licensing model to be more restrictive than JDK6
...are there other scenarios to be aware of?
What is your opinion on the issue?
NOTE: We would use the NIO2 files API, and perhaps other JDK7-only features which were accepted for "Plan B" (Plan A was rejected, was a proposal to continue to develop JDK7 much longer, instead, Plan B was accepted: develop JDK7 with less features and postpone them for JDK8)
It depends on how many Java 7 specific features you use.
If your code can still compile on JDK 6, I'd say you're quite safe. You can run on JDK 7, since it's backwards compatible, but if there's an issue you can still deploy on 6.
If Oracle does something really stupid you'll have a bigger decision on my hands: Do I rewrite this app in C#, Python, or something else?
I'll be curious to see how well open source JDK will allow you to hedge your bet.
I'd also be curious to see which features of JDK 7 you're already using: closures?
If you're concerned about risks associated with Java 7, you can mitigate them by ensuring your code will run on Java 6. The easiest way to do this is to develop atop Java 6 now, then upgrade to Java 7 once those risks have dissipated.
In addition to the risks you've noted, the set of features planned for Java 7 is in flux.
I'm interested in promoting JRuby in our office as the platform hosting Rails applications.
But how reliable is it?
Is its performance better than MRI 1.8.7?
JRuby 1.5 states that it is 100% compatible with Ruby 1.8.7, does this mean that JRuby can run any Ruby/Rails code?
Yes, JRuby is reliable! Oracle uses JRuby for Oracle mix (http://mix.oracle.com/), Sun had used it for Kenai (http://kenai.com), and it's gonna be the next base for java.net (from kenai site: "Work is on-going for migrating the Java.net domain over to the Kenai infrastructure")!!
You can run almost every code, some gems uses native C extension and in JRuby there's a primitive support to it, but yes...rails just works.
You can deploy Rails apps in Application Servers like Tomcat or JBoss with Warbler that wraps Rails apps inside a .war file, it's pretty awesome!
update: you can see a lot of benchmarks here: http://programmingzen.com/2010/07/19/the-great-ruby-shootout-july-2010/
I am doing a lot of jruby work right now and can tell you that rails is certainly a viable option under the jruby interpreter. I've been pretty pleased and in my case have to use many native Java libraries, so jRuby is just such an awesome wrapper around that java code. I will say that I have had some technical challenges some that are worked out, some that are not yet.
unit testing: spooling up the jvm and then spooling up rails takes much longer, so your tests take longer to run - solution, potentially something like nailgun that keeps the jvm running
deployment: i have not gotten warbler to work for me, with my flavor of tomcat. this is a major issue for us.
pick your libraries, while some c extensions work, they are not all equally compatible.
if you are interested I would highly reccomend the jruby book, in beta, from Pragmantic Programmers at http://pragprog.com
JRuby rocks!! The simple reason being its portability features and integration with Java libraries. I personally use it with Netbeans and the fast debugger that comes with that seems very handly. Plus you do not want to see that native build errors and handling them. All these gems that you download for JRuby work 100% across any platform. With JRuby, you are simply bringing in the advantages of the Java's Platform independence.
Moreover, JRuby uses native threading which uses OS threads instead of Green threads as in CRuby (i think its not the case with the latest versions though)
In Gist, go JRuby!!
for windows I have found it to be much more stable than MRI when working with larger amounts of data. There are some bugs on windows still but they are actually work-around-able. Recommend.
Disclaimer: I don't use jruby in my day job - I merely experimented with running existing code using jruby.
It doesn't mean that it'll run all code successfully. For example, bioruby currently calls fork on jruby even though jruby doesn't really support it. (That's more of a bug in bioruby than a bug in jruby though)
I wouldn't call such behaviour "unreliable" though. It's fail-safe, like a plane that would not get off the ground, much less crash.