I need to migrate my swing application from Java 1.7 to 1.8.
Application only works for Window environment.
Did this Java upgrade especially for swing API cause any feature stop working or any of its UI components behaviour change?
There was an interesting bug report on StackOverflow recently. But seems that the situation described in that question is very specific. We successfully migrated our quite huge Java 7 Swing application to Java 8. There were only several minor things to fix not related to Swing. In particular some complex generic parameters may work in Java 7, but produce a compilation error in Java 8. After several months of using Java 8 no Swing-related problems were noticed in our application.
Related
I need to target Java 7 and would like to use JavaFX and FXML on that project. We have some working code for Java 8 and it would save an immense amount of time if we can retro-fit those modules to Java 7.
I'm posting because I'm getting compile errors on the first attempt. In the first instance, I can't find the #FXML annotation, package:
import javafx.fxml.FXML
In Java 8 JDK. However that just a for instance example.
I was hoping to find Java 7 JDK JavaFX documentation. The searches and tutorials seem to be either aimed at Java 8 and/or not about things that work differently between the two
The solution is some documentation describing what's different in Java 8 JDK JavaFX to Java 7's JavaFS JDK? Google isn't giving me much satisfaction and most of the Stackoverflow questions are going the other way. I suppose it is rare for someone to ask how to go back a version. Any one seen, know of or some release notes on code differences (or a migration guide??). Many thanks in advance.
JavaFX 2 is the version of JavaFX included in Java 7. All of the Oracle JavaFX 2 documentation is currently available online (it may be removed at some time in the future in the same way JavaFX 1 documentation was removed). FXML is supported in Java 7, there were no significant changes to FXML for Java 8, so any FXML specific information you read for Java 8 will also be relevant for Java 7.
You don't really need a backward migration guide I think (not that any such guide would exist anywhere anyway). You can just compile your program against the most recent version of Java 7 and fix any compile errors that occur by removing any lambda references and coding against the older API. Unless you are using JavaFX 3D or printing or some such feature which was completely new in Java 8, I can't really see backward conversion being much of a problem or an extremely large task (90%+ of the public API will be unchanged).
One reason you are getting compile errors such as class not found is because you need to explicitly add the JavaFX 2 runtime to the compile and runtime classpath (for Oracle Java 8, this requirement was removed). See the answer to Compile code using JavaFX 2.0 (using command line) for more details.
I'd recommend against backporting code anyway as there were so many improvements in JavaFX 8. Also Java 7 has a limited support life. If you bundle your app as a self-contained application, then you have control of the Java runtime that the app runs on, so Java 8 would be an obvious choice for such a scenario. But I guess you may have some constraint which forces you to code to Java 7 (which you don't need to outline here).
I compiled my old JAR files in Java 7 and my production environment has Java 8. Is there anything I need to be careful about directly deploying the JAR files onto Java 8 Environment? I test ran them on Java 8 and it worked fine. Could I encounter any problems or should I be fine? I was wondering this because I was debating removing Java 8 and installing Java 7.
EDIT: A side question: Do companies update their code when they update their Java version? I can't imagine how painful this must be so have your app working on a previous version and then completely fail on the new version.
I was wondering this because I was debating removing Java 8 and installing Java 7.
I assume you mean the other way around?
Java attempts to maintain backwards compatibility as far as it can, so theoretically at least you should be ok.
In practice however, issues do sometimes come up, so I'd advocate testing thoroughly. These may be due to regression bugs, or (more likely in my experience) buggy code that might have run fine under Java 7, but not under 8. (FWIW, I had a couple of FX apps that mixbehaved under 8 but ran fine under 7, it turned out both were due to bugs in my code that coincidentally had no unusual side effects when running with 7.)
Usually, there should be no problem. Otherwise you would have a hard time to use any third-party libraries not explicitly compiled for Java SE 8.
I recommend to run your automated tests on a continuous integration server such as Jenkins using Java SE 8 and see if you have any issues.
It is safe to package Java 8 application with jar dependencies compiled with Java 7. Given that said, however, keep in mind differences in JDK 7 and 8, that can result the same Java code could behave differently when running on JDK 8 vs JDK 7 (refer to JDK 8 release notes)
I will be making a Java application using Java FX. I want to use SE8, but I'm concerned that Java FX isn't as usable in SE8 as SE7; has anyone used Java FX in SE8 and can confirm that it isn't buggy or difficult to use? Thanks, I don't want to have to switch platforms in the middle if it gets messy!
Review the answer to: Is there a JavaFX 8 changelog?
Then decide for yourself if you would rather use Java 7 or Java 8, given that:
Many bugs in the JavaFX implementation in Java 7 were fixed in Java 8.
Many features were added to JavaFX in Java 8 which are not present in Java 7.
Numerous architectural performance improvements were implemented for Java 8.
The currently scheduled date for end of public updates for Java 7 is April, 2015.
The JavaFX project developers rarely backport bug fixes from the Java 8 branch to earlier branches.
Is JavaFX in Java 8 bug free? => No.
The Java 8u20 update release will include many (mostly minor) bug fixes for JavaFX.
Future Java 7 update releases will not include the majority of these bug fixes.
Does JavaFX in Java 8 have fewer bugs than JavaFX in Java 7? => Certainly.
The major issue with JavaFX development on Java 8 at the moment is the SceneBuilder tool for Java 8 is only in early access release. However, it will have a production release quite soon and the latest early access release builds for SceneBuilder are quite usable.
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.
Where can i find informations on API changes between JavaFX 2.x and JavaFX 8? When i try to let my project run on a JDK 8 preview, i see that some things are broken - even if some of that might have its reason in the immaturity of a preview version, i'd also like to know how the APIs and the CSS changes between the two versions.
Once JDK8 released most probably there would be "JavaFX Compatibility Guide" posted, similar to JDK one.
But anyway JavaFX 8 is expected to be backward compatible to JavaFX 2. If you met any issues, please, file them at http://javafx-jira.kenai.com
all important (news, roadmap, rellease candinates) is on FX Experience
Apart from browsing jira and checking what features are targeted for Lombard (= JavaFX 8), and following FX Experience, you can also find some information about new features on the wiki, such as:
3D features
Rich Text API
TreeTableView