Recently I'm studying Java. I had no real troubles while building normal java files to .class and execute them, but, when I started a bit with applets I haven't been able to run anything.
Before I had started Java, as developer I had already a lot of development tools (Eclipse, Visual Studio, CodeBlocks and others). So, basically, I already had JDK but downloaded it again to get updated to 1.8.
Now, I have also JRE 8 and there are no troubles in using javac.exe and java.exe to build and execute, but, after building the .class file of applet, when I load the html page, I got an error which strongly recommends me to upgrade JRE.
Just to translate it:
Current version of Java is obsolete.
Upgrade (recommended choice)
Block
Later
If I do the update, it gets me to this page http://java.com/it/download/index.jsp), but, it's the download link of JRE 1.7. As much as I know, JDK 1.8 is not beta (it's accessible a 1.9 preview) so why shall I use 1.7? Indeed, after downloading and installing, when I try to run the applet, the message above is shown again.
Is actually possible to install JRE 1.8 on Google Chrome?
I resolved it. It wasn't easy since it wasn't a real trouble of java.
I had effectively Java 7 version 55 and Java 8 (but also 7-45 and 6). Java 8 was 64-bit while Java 7 was 32.
Google Chrome (32-bit browser) used so the last version it could use. According to Oracle, it's recommended to remove older versions of java (because of security) so I removed everything but the 8, and then switched to 64-bit browser (Chromium). I left older JDK installed for compatibility development reasons.
Related
I've been working with Java for a bit now and the JDK/JRE version has given me quite a bit of trouble lately. I am developing using the Intellij IDEA IDE and it of course uses the latest version of the JDK, 14. However when I attempt to execute software compiled with JDK 14 outside the IDE, I get an error that the JRE isn't new enough to run this software. So I updated Java on my computer and another machine and attempt to run again without any success. After some digging, I tweaked my machine to use the JRE included in the JDK 14 which is compatible.
However it is kind of odd that I had to do that, one would think that the latest version of java should of been enough to run applications made with the latest version of the JDK (14). Right now Java is version 8 build 251 and says there is no newer update available. If JDK 14 is out for a while now, why would they not update the version of Java they ship?
The problem is partially solved, as only the machine I am using for development is capable of executing the created applications. Other people I've sent them to have been unable to run them, despite having the latest version of java. Also it is a pain to get the latest JDK, especially when having limited experience on how to get rid of old versions, change path point to the latest version, get the right package (open/oracle JDK) and do that for windows and several distrubutions of linux. What is going on? Did I get Java from the wrong place and everyone else as well? Why are oracle doing this and why are there no java updates since clearly there exists a newer version?
Starting with Java-11, separate JRE does not exist anymore. In other words, if you are using Java-11 or above, you should care about JDK only.
You should uninstall JRE-8 from your machine and make sure your JDK-14 bin folder in the PATH variable. Some application even requires JAVA_HOME to work and therefore you should make sure that your system has an environment variable called JAVA_HOME and its value set to the root folder of JDK-14 (i.e. one level above your JDK bin).
Q: What should my clients do to run my application compiled on JDK-14?
Ans: Your clients must install JDK-14. Also, check this thread for some alternatives.
You're confusing how IntelliJ or JDK are used on the OS. IntelliJ, now, often comes with its JDK binaries (but even this can be configured, IntelliJ can be configured to use any JDK/JRE build you'll provide to it); however, if you run your Java application out of IntelliJ, most likely you're using Java installed locally on your OS, which might be referenced via your JAVA_HOME environment variable.
I'd suggest to:
Check java -version in your shell (and hence you'll see what JVM instance your OS spins up when you run a Java application);
Check where java (on Windows, or which - on Linux) in your shell, to see all the Java binaries available on your OS.
Try to uninstall Java SE Development Kit and Java JRE(if you have both in your machine) and reinstall both again, JDK and JRE both, I am sharing my google drive link where you can find the latest version of both JDK and JRE and when you are done installing, add there bin folder path in the Environment Variables of your machine.
It is to my understanding that Java JREs are backwards compatible, if you write a program in Java (JDK) 7, it will run with Java (JRE) 8.
I have a couple of programs I developed in Java 8, and have .jar and EXE files that I built when I finished them, and they always ran fine. However, after installing Java JDK 11 (11.0.2), these old .jar files break...
A couple of them still run, but their GUIs have expanded, with buttons and images being bigger than before, and in some cases blurry
One program just doesn't run at all, trying to run it in a console gives an exception: "Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/activation/ActivationDataFlavor"
I understand that this class and some other javax classes have been removed from JDK 11, so from a development standpoint you couldn't use them anymore without a tool such as Maven. But I do not understand why installing JDK 11 has any effect on my old jars, as I didn't install a new JRE, and even if one came with it, it should be backwards compatible?
Too add to this, I use Apache NetBeans 10, it worked fine with Java 8, but after I installed JDK 11, NetBeans 10 still ran but its loading window was big and blurry, and the IDE's images are blurry, and all the text is bigger.
So why is installing JDK 11 having these negative effects on older programs?
Note - I have tried associating the jars/EXEs with javaw.exe from JRE version 8 (201), however, they all still have the same issues.
Java tries to be backward compatible but sometimes breaking changes are necessary to evolve the ecosystem. Until now breaking changes were shipped with major release e.g. Java 9, 10, 11. In your case you are most likely affected by Java 11's JEP 320: Remove the Java EE and CORBA Modules.
Remember that Java 8 was released in 2014. For 5 years Oracle and the Java community provided patches and security fixes for Java 8 but doing this forever is impossible.
The issue you are facing is likely not an incompatiblity w.r.t. the bytecode. It is just a missing class.
Java 11 dropped the support of some old technologies - for example Java Applets. If you run a Java 8 Applet in a Java 11 JDK / JRE you will get a ClassNotFound exception just because Java 11 does not provide the class / jar.
Similarly for JavaFX, which still exists, but is not longer part of the Java Distribution. You have to add it as a separate Jar.
I believe it would be possible to add these classes to a project. Personally I would like to see a port.
I have Java 8 installed on my computer, before it was Java 7. But I need to work with version 6.
How can I install Java 6? On Oracle website, it is no longer possible to download the old versions.
How can I downgrade Java if it was not installed before?
Please be aware that Java 6 is no longer receiving public updates. You always should use the most updated Java version.
But you can find some historical Java releases on Oracle Java Archive. The page warns:
WARNING: These older versions of the JRE and JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production.
These are the links to download old versions of Java SE:
Java SE 8 Archive Downloads
Java SE 7 Archive Downloads
Java SE 6 Archive Downloads
Java SE 5 Archive Downloads
Java SE 1.4 Archive Downloads
Java SE 1.3 Archive Downloads
Java SE 1.2 Archive Downloads
Java SE 1.1 Archive Downloads
It's possible. A lot of notable software can be traced to the very first version (for testing or other purposes). You can actually find and download the first version of Firefox, Chrome, Netbeans, WordPress etc. The same with Java. They just make it a little bit more difficult to dig the old versions up, and they intentionally hide it for good reasons.
These older versions of the JRE and JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production.
and
Keeping old and unsupported versions of Java on your system presents a serious security risk.
(and Java is already not really reputable, security-wise)
You cannot "downgrade" a certain version of Java. You install different versions of Java you need, and set your project to be built with that specific version. On a system, there can be several Java versions installed together.
I don't know if it is the right place to ask, if not tell me I will migrate my question elsewhere.
I am using OSX (Maverick) and I am trying to install the JDK 7 in order to use javaFX. So I downloaded the .dmg package from oracle and when I double click on the package, I get the error message can't found mountable file systems. In the documentation I found this alert:
If you download Java 7, you will not be able to run Java content in Chrome on Mac OS X and will need to use a 64-bit browser (such as Safari or Firefox) to run Java content within a browser. Additionally, installing Java 7 will disable the ability to use Apple Java 6 on your system.
So how can I properly install the JDK 7? and Is it dangerous to install it? Could it mess up all my settings, knowing that I only want to use the JDK 7 to run some java project ?
I believe the error message you are getting just indicated a corrupt dmg file.
Try downloading and installing it again and it should work fine.
So how can I properly install the JDK 7?
You can only install the 64bit version of Java 7, the only real downside is that it will not work with things like the crome browser, you can install it the same way as you first tried, download and install it from here: JDK Download
Is it dangerous to install it? Could it mess up all my settings
No, installing the JDK should not make any noticeable change, even if you run apps on it instead of your previous JDK/jar, they should still work. If you have older JDK's installed you can still use/select them in an IDE. If you do use crome then it should continue to work as normal using the existing/old JRE/JDK that you have installed.
knowing that I only want to use the JDK 7 to run some java project ?
The Java 7 JDK is backwards compatible, meaning it should run all existing java apps.
If you were worried about swapping between Java 6&7 then this thread may help: https://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2
You can download on another system. And unzip the contents to a folder. Then you can copy that onto your Mac and try. I guess that is what he meant by the folder.
My Java applet only supports 1.4 java run time(1). I am having one machine on which both Java 1.4 and 1.6 environment is installed. Is there some setting available by which I can make sure my applet will always use Java 1.4 run time when it runs?
We are using key event class private data array bData with the help of Java reflection. The data which is there in this array JDK 1.4 and 1.6 is different in both the version.
A Java application compiled with JDK 1.4 will run on JDK 1.6.
You can compile a Java application with JDK 1.6, but compatible with JDK 1.4 by configuring the 'source level'.
Although you can choose your default JDK to be safe, but it depends on your operating system. If you are on Linux, you can choose between available Java versions using pdate-alternatives --config java command (which will modify some symlinks in the hindsight).
On Windows 7:
Control Panel -> Programs -> Java
Select 'Java' tab, and View the Java Runtime Environment settings.
Ensure that your Java 1.4 entry is selected.
There's a way to force a specific installed version to run, but if one Java plugin replaces the other there might be an issue with this. See linked question for further details.
Force Internet Explorer to use a specific Java Runtime Environment install?
Are there any issues with running the 1.4 code on 1.6? If not, you should be fine. Just avoid using anything in the classpath that changed significantly between these versions. Otherwise, look [here][1]. The codebase download thing is interesting, since it lets you download a different classpath. So, regardless of the JRE version, you could force the download of a 1.4 JRE classpath, which should ensure full compatability.
Edit: found an updated guide to using previous classpaths with newer Java versions in applets, which actually seems to work:
http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
Edit 2: I actually have it working, but it appears to need to download JRE 1.4 and install it, but then it will run the applet with it automatically. However, this might be suitable for your needs.
http://www.2shared.com/file/bl3Rua2e/applet.html -- extract the archive, and then run index.html inside this. All source code is included.