Can I do Java 6 development in OS X? - java

I know when Leopard came out everybody (well, everybody that was a Java developer and cared enough to do development on a Mac) was pissed that there was no Java 6 SDK support. I know somebody provided some kind of hack way a few months after Leopard was released, but I could have sworn that I read sometime later that Apple and/or Sun finally put out an official version of the Java 6 SDK.
So now a year and a half later I am finally interested in doing some Java dev on the Mac (thank Google App Kit for that). But when I go to Apple's Java site... all I see is stuff about Java 5.
So, can I do Java 6 on a Mac?
See also: Installing Java 6 on Mac OS

Yes, JDK6 is available, and it is quite nice, for example it supports DTrace, which otherwise you only get on Solaris.
The main drawback is that Apple is very aggressive in deprecating older hardware (and OS versions). Java6 will never be released for Mac versions before 10.5, and only works on 64bit Intel. That also kills native 32 bit libraries, such as SWT/Carbon, which is what Eclipse uses (they need to move to Cocoa now).
Update: Snow Leopard apparently has Java6 for 32bit Intel, too (in addition to 64bit).

http://developer.apple.com/java/ (which is only for 64-bit Macs)
http://landonf.bikemonkey.org/static/soylatte/ (SoyLatte, a separate Java 6 port).

Yes, JDK6 is available.
However, some versions of Eclipse do not support it. There is a new one (based on Cocoa) that should but it is not officially available.

You can but you have to be very wary of Apple on this one. Sun released JDK 6 in December 2006. Apple released Java 6 for MacOS X a year later.
Why the delay? It seems that integrating the new Look and Feel was the answer but we don't have an official reason.
Now if Java 6 was important to you at the time this would've been (and was) a big deal.
As other answers mention, support for certain hardware and libraries can also be problematic.
windows and Linux are (imho) still the preferred Java development platforms. If it ever becomes critical you can always do Java development on a Mac in a VM however.

Partly. Apple released its version of Java SDK 6 a few months back. But there are still some functions which are not available on Apple's SDK 6 which exist in Sun's Java SDK 6. I don't know why this is so.
For e.g., after Unisys's patent on GIF format expired, Java included the capability to write image files in GIF format in SDK6. Yet, you still can't write GIF files on Apple's SDK.

http://developer.apple.com/java/
Looks like you can.

Related

Options to use Java free for commercial use [duplicate]

This question already has answers here:
Which free version of Java can I use for production environments and or commercial purposes?
(5 answers)
Closed 8 months ago.
If I want to keep my software (be it an application or even a game for Windows) free for me as developer/publisher as well as my users/clients what should I do (use)/can I even do that today?
To download the JDK you have two options (that I know of): OpenJDK / jdk.java.net and Oracle JDK. Am I right to assume that you can use everything from OpenJDK free of charge for commercial use as well, while Oracle JDK depends how they stand, some are free while for some you need a subscription (JDK 17/18 says that they are free under NFTC while for JDK 8 you need a subscription)?
As for JRE, can I download Java from here (version: Windows Offline (64-bit)) and add it in a folder with the software, to check if the user/client has it or not, and prompt an install it they don't have it?
To download the JDK you have two options (that I know of)
Oh, heck no. There's Temurin by Adoptium, Zulu by Azul Systems, Coretto by Amazon. Other vendors include Red Hat, IBM, SAP, BellSoft, Microsoft, Oracle, Pivotal, etc.
Am I right to assume that you can use everything from OpenJDK free of charge for commercial use as well
Yes. But note that they stop supporting it when a new version comes out. I'd use Adoptium or Coretto instead.

Apple Retina Display Support in Java JDK 1.7 for AWT / Swing

I just became aware that AWT / Swing under Java JDK 1.7 (as of JDK 7u15) does not support Retina displays on Apple Macbook Pros. Netbeans, for example, is nearly unbearable to use for more than a few minutes running on a Retina display and using JDK 1.7.
This has been somewhat addressed in a StackExchange question here, and quoting one specific post:
Apple's Java 6 JRE will support HiDPI, however it is not currently supported by Oracle's Java 7 JRE. It also doesn't work under the latest dev builds of Java 8. Swing and JavaFX apps are blurry on a Retinia MacBook. This is why IntelliJ still runs under Java 6.
My question is more specific than what is asked by the OP of the above thread.
My employer of less than a month uses Swing in all of its applications. For several reasons we are interested in migrating to Java 7 from Java 6. Within the last several days, another developer (who is on Windows), moved our platform over to Java 7. As I'm running a retina Macbook Pro, I noticed the issue when I pulled the latest stable branch of our code.
I am new to Java with less than a year of experience in the community, hence my question: Will the Java community be fairly responsive to this issue moving forward, or should a substantial delay be anticipated (months to a year or more) before Swing in Java 7 is compatible with Apple Retina displays?
Java 7u40 Early Access now supports HiDPI (Retina) displays, as shown by this changelog. So retina support is now available on:
Java 6
Java 7u40ea or greater
Java 8
last month I was also interested in the same topic and after some time I found out on net that nobody can answer the question exactly.
There is an open bug for this at Oracle:
http://bugs.sun.com/view_bug.do?bug_id=8000629
According to that it should be fixed for Java 1.8. But what I am afraid of is that I am not sure if it also will be fixed for Swing or only for JavaFX. I read somewhere that there is already fix for JavaFX (but not sure if official), which doesn't solve the problem for Swing.
To answer short, after some days of searching on internet unfortunately I couldn't find the answer ...
Regards,
Lubos
Retina is fully supported by Oracle starting 1.7.0_40ea. However, there are lacks of APIs for Retina. For instance, there is no support for HiDPIScaledImages like in Apple JDK. You can find some cool tips about Retina support in Oracle JDK here http://bulenkov.com/2013/06/23/retina-support-in-oracle-jdk-1-7/
According to a long thread that I read some months ago (http://lists.apple.com/archives/java-dev/2012/Oct/msg00127.html) the only way to get Retina in Swing is to install the Apple JDK, which in turn just uses a "hack" to make applications retina-compatible. That thread mentions JavaFX as a workaround (which of course is no real workaround when you already have a complex piece of software written in Swing).
I myself tried to write a simple JavaFX application with Java 7 after reading the above thread and it looked sharper on Retina; same with Ensamble (the JavaFX demo application, available on the App Store) which also seemed to render a lot nicer than a normal Swing application (like the Java Control Panel) but perhaps it's just the power of suggestion.
Since I am actively testing each new Java 8 Snapshot release I can also confirm that little to no work has been done to get Swing look passable on retina displays.
Our best bet right now (just an opinion, don't have any secret knowledge) is that someone at Oracle (or a OpenJDK contributor) will buy a retina mac and fix it in Java 8. I don't think Apple will fix it by supplying the Java 6 fixes since the guy from Apple said that they just reverted code related to rendering back to Quartz. It did give the desired result but is heavily tied to proprietary OS X internals which are not being open sourced.

Java version statistics

Where can I see statistics about the most used Java versions?
(I want to develop applications that will run on most systems)
According to StatOwl, Java 6 has reached a 70% adoption rate.
Version 1.6, update 11 enabled background upgrades so it will always be current. 70% of java installs are version 1.6. Stick with 1.6
http://www.statowl.com/java.php
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Unfortunately a high percentage of system have very old versions of Java or no Java at all.
I suggest you develop for Java 5. Any system which doesn't have this at least probibly should have it installed.
You can make use of Google trends, they have a nice graphical view as well.
It wont show you the most used, but it will show you the most popular according to Google searches etc.
Java 5 has been deprecated for a full year now at this point, leaving Servers that still run it at a full year of security issues that are not patched, and never will be. I'd say stick with Java 6. We don't write Software with Windows 95 or OSX 10.3 in mind either, do we? Sometimes it is time to tell the users to update their software.
Java Tools and Technologies Landscape Report 2016 (Zeroturnaround): https://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-2016/#java-versions
Java version and vendor data analyzed 2017 (Plumbr): https://plumbr.io/blog/java/java-version-and-vendor-data-analyzed-2017-edition

Which eclipse version to use on a Mac? (Carbon or Cocoa)

When i go to the eclipse website (http://www.eclipse.org/downloads/) there are 3 different versions of eclipse for Mac:
Carbon 32bit
Cocoa 32bit
Cocoa 64bit
I'm confused about why there are three version and which one i should be using. (I'm running OSX 10.5 on a MBP)
I say go with the 32-bit Cocoa version unless you want to use Java 6. The 32-bit version will use less memory, and because the 32-bit 1.5 JVM is the client Java VM it's better tuned for UI apps.
If you want to use Java 6 on 10.5, you must use the 64-bit Cocoa version.
You would think there would be a universal 32/64-bit version, but there isn't. The reason there are multiple versions is due to the SWT's (and Eclipse's for that matter) philosophy of one architecture and one windowing system per application. p2/Equinox can't cope with multiple architectures in the same application.
Use Cocoa 64bit, you most likely have a 64 bit processor (unless you know you don't).
Carbon is just the old graphical API, it was replaced by Cocoa.
Depends on what you're using it for. I've been using 32-bit Cocoa on a MBP running 10.5 for most of my development for the past 3 months and haven't had any problems. I wouldn't use Carbon as it is a now deprecated API.

For which surprises do I have to prepare myself if I switch from Sun JDK to OpenJDK?

If I'd switch from Sun JDK to OpenJDK which surprises do I have to prepare myself for?
What does frequently go wrong and how difficult can this be?
Of course, each and every application can have its individual problems, but I'm looking for classes of problems, something many people already have struggled with when switching JDKs.
It is unlikely that anything will go wrong with OpenJDK. It is considered 100% compatible by now. But I think it is good to know what parts had to be rewritten and therefore are not using the same code as the SunJDK.
The Wikipedia entry has a good overview of this:
As of May 2008, the only part of the Class library that remains proprietary and closed-source (4% as of May 2007 for OpenJDK 7, and less than 1% as of May 2008 and OpenJDK 6) is the SNMP implementation.
Since the first May 2007 release, Sun Microsystems, with the help of the community, has released as free and open-source software or replaced with free and open-source alternatives almost all the encumbered code:
All the audio engine code, including the software synthesizer, has been released as Open-source. The closed-source software synthesizer has been replaced by a new synthesizer developed specifically for OpenJDK called Gervill,
All cryptography classes used in the Class library have been released as Open-source,
The code that scales and rasterizes fonts has been replaced by FreeType
The native color management system has been replaced by LittleCMS. There is a pluggable layer in the JDK, so that the commercial version can use the old color management system and OpenJDK can use LittleCMS.
The anti-aliasing graphics rasterizer code has been replaced by the Open-sourced Pisces renderer used in the phoneME project. This code is fully functional, but still needs some performance enhancements,
The JavaScript plugin has been open-sourced (the Rhino JavaScript engine itself was open-sourced from the beginning).
As I know fonts will look garbled, Sun had to remove original ones from OpenJDK since they are not 'open source' and JVM will use some default which are not so nice...
Since OpenJDK is a Sun project, based on the original Java source, I wouldn't expect many problems. The only area where things can break is the code which had to be replaced (because it couldn't be released under the GPL) or changes because of new features (but those should be pretty much the same as in the official JDK).
Use an OpenJDK build known to pass the TCK to minimize the surprises.
Some of the swing UI's did not match up entirely (metal had paddings that were off just aenough to notice). Note that this was 8 months ago.
OpenJDK (IcedTea) applets under linux are a MAJOR PAIN. I'm struggling with remote debugging a piece of rather rusty code for couple of hours already. Official documentation on how to attach to an applet in a browser simply does not work for me. There's no java console by default, BTW. I'm seriously considering replicating the applet config and using JDK built-in applet viewer instead of trying to debug the browser-hosted JVM.
UPD: I am not quite sure that OpenJDK does not have a browser plugin itself. Maybe this changed recently.
OpenJDK is more secure than the Oracle binaries because of IcedTea.

Categories