Updating Java and JRE are causing many errors in Eclipse - java

I'm using Eclipse to program Android applications, and when I opened the program yesterday, it popped up an error saying I need to install JRE - I've downloaded the JRE and installed it - when during the installation I got a message saying that the JAVA version I have on the computer (Version 7) is too old for the JRE (Version 8), and that I need to update the JAVA also.
I did so, and then opened up the Eclipse again - And all of the projects,that before worked great, are now full with errors.
I tried installing all of the SDK updates - didn't work, also tried uninstalling Eclipse and re-install it - also didn't work.
The errors I get are: "XXX cannot be resolved to a type" - in amost every single line in the project.
How do I fix it??
Thank you!!

android development tool(adt) are install.. and all update SDK and then import an old program.. Ithink then work.

I would suggest to check that your java build path is functioning properly. This kind of error for me usually means that eclipse cannot find the JRE installation.
Form eclipse you can go to Project->Properties and check for any errors there. Any inconsistency there would cause all your projects to fail.

First of all, you need the JDK installation, not JRE. Second, Android currently supports up to Java v7, which means you'll need to get JDK v7 from here. Make sure you download the correct 32-bit or 64-bit JDK version for your operating system.
Also, ensure your Android SDK and Android Development Tools (ADT) are on the same released version. Different versions of Android SDK and ADT can lead to many unforseen problems.

Related

Java Eclipse saying my version of JVM is not suitable

I run the windows 10 64 bit version of Eclipse. The first time I log onto Eclipse it works just fine (though I haven't fun any code yet, so I'm not sure if that works) but upon closing and reopening Eclipse it says, "Version 1.8.0_301 of the JVM is not suitable for this product: version 11 or greater is required." and immediately quits. I have downloaded jdk 16 and installed it. Redownloading Eclipse fixes it until I close it again. How can I fix this? I am a new Java programmer and am not experienced with any of this.
You should have a folder like ths: C:\Program Files\Java. In there, there should be a folder named 1.8.0_301. Delete this folder and reinstall java.
I had the same problem, this solved it for me...
First of all I suggest you check the version of your eclispe IDE. You may have downloaded a version that doesn't supprot your installed jdk.
This link should provide you with the suitable jdk version for every eclipse version.
https://wiki.eclipse.org/Eclipse/Installation.
I hope I helped you a bit.
Cheers!
I had this problem with Java version 1.8.0_351.
In the program management settings of Windows I removed Java 8. After that, my Eclipse installation worked fine.

Java: Getting a "Requires JDK 5.0 or later" error in Eclipse

I have just installed the JDK1.8.0 32 bit version on my computer and that all seemed to work nicely. I then followed the instructions on this stackoverflow page to add tools.jar to the Eclipse (although, to be honest, I'm not quite sure what that means?). I'm still getting the error: "Requires JDK 5.0 or later. Please download it from http://java.sun.com/j2se/1.5/".
Could someone please help me understand what the problem is? Also, please let me know if I haven't given enough information, this is my first attempt at using Eclipse and I don't know if you need any other info.
Thanks
Mike
The Oracle JDK installation does not install Java in the location where Eclipse by default looks for it.
I would suggest that you go to http://java.com/en/download/installed.jsp and follow instructions to get a default Java installation on your system.
Eclipse will then use that to run itself. You can then tell Eclipse about your Java 8 JDK in Preferences -> Java -> Installed JRE's and that it is to be used by default by the projects you write.
Note that there is not full support for the new Java 8 facilities in Eclipse yet. That will most likely come in Eclipse 4.4 scheduled for June (http://wiki.eclipse.org/Simultaneous_Release)
When you make a new project, make sure it's using the JRE you want. You may have to change it from default to "use project specific JRE", and then select the 1.8.

Error: jdk1.7 or higher needed to run Google plugin for eclipse

I have been trying to make this work all day long but there seems to be no end to my frustration. I want to use Google App Engine for my android application. I have downloaded the jdk 1.7 u51 but still whenever i start the eclipse ADT, a dialog box appears saying that jdk 1.6 is in use; jdk 1.7 or higher needs to be installed. I have set the path in the preference to jre inside the jdk 1.7. Also, the app engine SDK path shows the error "Failed to initialize App Engine SDk[path]". I have referred all the threads here and over the internet relating to this issue and have tried all the proposed solutions but to no avail. Any help would be greatly appreciated.
versions
eclipse 4.2(ADT)
JDK 1.7u51
App Engine SDK 1.8.9
Try uninstalling the old java version, and making sure that the latest version is the only one installed. Another problem might be if you have a 64-bit computer, you may have the older version installed to one program files, but Eclipse is looking through the x86 program files and not finding the correct version(or vice-versa). You may also want to set your PATH and CLASSPATH.
Type
java -version
javac -version
into the command prompt, and it will return with what Java you have installed.
If all else fails, try reading https://developers.google.com/appengine/docs/java/gettingstarted/installing for more information and see what went wrong.
You must have matching architecture for Eclipse and JDK. If you are using 32-bit eclipse, then use 32-bit JDK else use 64-bit versions of both.
Everything else will fall in place automatically
I am using Indigo and found this forum thread to do the trick.
To your eclipse.ini file add
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_WHATEVERTHESUFFIXIS/Contents/Home/jre/lib/server/libjvm.dylib
Note the suffix "lib/server/libjvm.dylib" which is not what you use for later versions of Eclipse. (For them you link to "bin/java".) This needs to be above any "-vmargs" flags in eclipse.ini.

ArrayList declaration: syntax error on token "(", on both tokens "<" in android application

I have google about it online but didn't help and here I am posting my question. I have eclipse version platform version=3.8 which I downloaded from https://developer.android.com to create a android application. Now when I declare a arraylist <> in my program it doesn't recognize it. I read few questions here saying you need to have a version Eclipse version >= 3.1 to be able to increase Java compiler over 1.7. But now my question is when I already have 3.8 why the Java Compiler options are not showing above > 1.7 for me to select. Is android project and eclipse java project a separate thing? I opened eclipse and created this android application project. Appreciate your time and help.
You forgot to use new.
Android application should use java 1.5 or 1.6.
Android is not supporting 1.7.ArrayList<object> abcd= new ArrayList<object>();
And if you want to use java 1.7 in Java application project. Java 1.7 should be installed in your PC.
my guess would be that while you run eclipse itself with jdk 1.6, it's actually configured with a different default jre. see window->preferences->java->Installed JREs and make sure that the checked JRE is 1.6.
if the default JRE is indeed 1.6, chances are that it's a project specific setting. see that the project is configured to use the right jre.

Unable to run Java Applications in Eclipse [duplicate]

I'm trying to get started with Eclipse/Java/Scala on a MacBook. The installed JDK was 1.5. The SDT plugin for Scala requires 1.6 which was included in an OS update, but I also manually installed a package from Apple to update 1.6.
The problem is that I cannot run anything from Eclipse. I always get the following error:
An internal error occurred during: "Launching TestFooBasicTest".
Could not initialize class com.ibm.icu.impl.JavaTimeZone
I also tried to use the old 1.5 version, but to no avail.
What is going wrong here?
I had the same problem trying to run a scala program with Ubuntu 10.4 and stock eclipse (Galileo 3.5.2) and java (java-6-openJdk ) - and the scala pluging downloaded from scala site, of course. I fixed it by manually changing /usr/lib/eclipse/plugins/com.ibm.icu_4.0.1.v20100125.jar as suggested in this thread (btw I discovered that Emacs can change a jar file in place: nice):
http://www.eclipse.org/forums/index.php?t=msg&goto=488654
It's caused by ubuntu openjdk package with broken symbol links for TimeZone configuration. The best solution from forum thread is,
Reinstalling tzdata-java was the fix for me:
sudo apt-get --reinstall install tzdata-java
The problem is:
An internal error occurred during: "Launching TestFooBasicTest". Could not initialize class com.ibm.icu.impl.JavaTimeZone
A quick google search reveals that this class belongs to the IBM Globalization package ICU. http://www-01.ibm.com/software/globalization/icu/index.jsp
A guess would be that this is a package used internally by Scala that you have not installed properly, causing Scala startup to fail.
Make sure that you set java 1.6 in the run configuration (Run/Run configurations).
Did you upgrade to Snow Leopard? Are you using the Eclipse SWT/Carbon or the Eclipse SWT/Cocoa? I was seeing some strangeness with Eclipse after I upgraded to SL. Switching to the Eclipse SWT/Cocoa from Eclipse SWT/Carbon helped. Also restoring my 1.5 VM, which the SL install removes in a sneaky way(by deleting and leaving the symbolic link pointing to 1.6), helped me fix several issues with Java code that had natives(i.e. usb-serial port code).
Check what are the JVMs that Eclipse is aware of and where they are located (Preferences -> Java -> Installed JRE), and also check the run/debug configuration of your programs. By default, Eclipse knows about the JRE that was used to launch itself, and other JREs that you add manually. However, if you upgrade some components and the JREs changed, Eclipse can get "confused" about them.
I had this same issue with Eclipse on Windows. I tried a number of different things including a new hello world program in a new workspace. I finally got this to work by pointing Eclipse to a different JRE to execute with. I know that Apple provides the JRE for Mac, but it does seem like this issue is related to Eclipse having trouble with the JRE used to run Eclipse itself. See here for configuring which VM Eclipse executes with.

Categories