Why is it recommended to change the jdk after long use? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
When I was first learning java from a crash course, we were advised by the teacher to change the jdk after long use.
While she couldn't provide any scientific explanation to this, even I find it necessary to change the jdk at points of time. In the computer at my home, sometimes it happens that a program that I've written, is syntactically, semantically and logically correct, but both BlueJ and NetBeans give unexplained compilation or run-time error. Both BlueJ and NetBeans run on the same jdk.
If I download a new jdk package and install it, removing the previous one, it solves the problem.
Can anyone explain this?

New versions of the JDK can run old code, but the opposite is not necessarily true: Recent applications will take advantage of recent features of the JDK, and will not be compatible with older versions.
Note that sometimes, applications built with some JDK may not run with newer versions. For instance, JDK 7 has removed some deprecated classes from JDK1.6.

Related

Does this mean that Java is not free any more? [duplicate]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have couple of projects using JDK 1.8 in production. However Java is paid from January 2019 onwards. Is my problem solved if I migrate my projects to OpenJDK 1.8 because it's open source?
As far as I know, it concerns only the Oracle Java APIs.
OpenJDK and OpenJFX are largely independent (besides getting contributions from Oracle).
As general Oracle Java was a bit smarter than the OpenJDK (on Linux), the entire outcries are a storm in a glass of water: it makes a (ill guided) sense to let Oracle be paid for its development effort.
The thing to do, is trying out the OpenJDK, and taking notion of com.sun classes.
You might need to look for new versions of your typical server or framework, that might rely on com.sun.* classes.

Java version upgrade [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I've upgrade my Java JDK installation to a later minor release version (e.g. 1.8.131 to 1.8.144).
Should I recompile project source code to get any security benefits from bytecode generation or should I just run the old bytecode on the updated JRE?
Any real world examples welcome as I will need to justify this to the project team.
You are mistaken.
The java compiler doesn't do much, besides turning Java source into bytecode. There are few special optimisations. And no "security" related things at all.
And keep in mind: all invokations of system methods that your code is doing - will be going to Java8 classes on a Java8 VM.
Thus there is no pressing reason to update "everything".

What to choose for execution environment JRE [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to implement a java desktop-application using eclipse and when I click on new project I have to choose the JRE version (J2SE 1.2-1.5, JavaSE 1.6-1.8). My question is: what is the best version that I would choose? And if I decided to work with jre1.8.0 would other computers that support earlier JRE versions (e.g jre1.6) be able to run the application on their machines?
Generally, you should use the newest version of Java for your development.
If your client is restricted to an older JRE, then you can set your compiler level. This is a separate setting from your JDK version (right click your project, go to properties, then Java compiler). Newer versions of Java can be set to create code that will work in older versions of Java.
You can use the latest version. Every new version will support all the features of old version. I would go for jre 1.8.

When is it soon enough to use new Java features? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm developing an application that I plan to publicly release, or at least share with a group of people. The problem that I am facing as a developer is compatibility. On my machine, I am using the new Java 8, but I am afraid to use its new features, and in fact, I'm even afraid to use the new features in Java 7, like try-with-resources, in fear that the users will not have an up-to-date Java version, and consequently, will not be able to use my application. For example, my school's computers still use Java 6.
First off, am I correct in thinking that? Or can code compiled with a newer JDK run on a machine with an older JRE? If I am correct, is there an established "rule" or standard for compatibility? Something like, "Make sure your code is compatible with a JRE that is two versions old!" Or is it purely a matter of the developer's judgement of when new features should be utilized for a released work? And just for emphasis, I am talking about just running the program. The user will never have to compile it.
I know this is a bit open ended, but this is the best place that I could think of to ask.
Thanks.
First, you can always specify the version of Java that you want to support by compiling it with the -version flag. This means, since you're using Java 8, you could always force your code to compile down to a lower version (that is, Java 6).
To your point about older Java versions - yes, you'll likely run into that. A lot of people don't update their Java version for one reason or another. But, this is where you have to make a decision: do you choose to support their version, or do you choose to support another version? This particular part is open-ended, but depending on what you ultimately want to use in your code (diamond operator, try-with-resources (which is actually very nice), NIO), then you'd want to use the version of Java that works well with you and with what you want to support.

Applet is not running in java6 and it is working using java7 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am using applet code in my application. When I am running that applet it is aksing me to install java 7 version.
Is it mandatory to install java7 version?
If it is mandatory how the applets were run in java6 version previously?
I am confused.
Is it mandatory to install java7 version.
Basically, yes. And you should do it anyway, since Java 6 is no longer getting security patches.
If it is mandatory how the applets were run in java6 version previously.
The author has (presumably) changed something. He/she might have started using Java 7 language constructs or Java 7 specific library APIs. Or he/she might have just changed the JNLP configurations to force you to upgrade for your own good.

Categories