Error in importing project to Eclipse - java

I'm new in java and storm
i imported a project in eclipse with the needed library and i got errors in some code
The code of the project i imported here
https://github.com/nathanmarz/storm-starter .
and i run pom.xml using Maven .. Build Successfully .
I'm using eclipse Kelper Jee Release .
the photo i upload it show more about my problem .
`
what about warning i have . it's suppose for project ... work well ? am i ignore it or no ?

... must override a super class ... is because the project's Java compiler compliance level is 1.5 but it needs 1.6. Java 1.5 does not allow #Override annotations on methods implementing interface methods. Try right click on project -> Properties -> Java Compiler set compliance level 1.6 or 1.7

Looks like there is problem in version of jars that you are using.

Go To Window -->Preference Check Java Compilation level,Check your java Build path JRE included correctly or not JRE version is Low Find 1.6 instead of 1.5

Related

Eclipse setup for a java project

Have a java project with couple of main java classes in it. On server this program has to run using java 1.5 version.
Trying to setup the same in eclipse.
Project properties/Java compiler ---- set to 1.5
Project properties/Java build path ---- Added JRE library ---> J2SE-1.5
But, when running one of the main class in the project in eclipse getting error as
SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by this driver
what else do I need to do in eclipse to run the program using java 1.5??
Go to Window -> Preferences -> Java -> Compiler and choose the default compliance level as 1.5
In Project properties/Java compiler make sure that 'Enable project specific settings' is checked.
Also, I would double check the build path for duplicate JRE libraries

Set Intellij Idea Compiler Language Level to 1.3

I'm using Intellij Idea 15.0.1 and have a Java project, it imports class of default package from the class of a named package.
Since it is allowed only in Java 1.3, I've set JDK 1.3 everywhere:
- Project Settings
- IDE Settings - Java Compiler
- Edit Configurations (Application)
But still when I make project it stops with "Cannot resolve symbol" error. Also making starts with the message:
Information:Using javac 1.8.0_51 to compile java sources
Why Idea still uses javac 1.8 and how to set java 1.3 for the whole project, including syntax highlight?
You need to install JDK 1.3, configure it in Project Structure | SDKs and select it as the project SDK in Project Structure | Project.

Error when using LogManager (l4j2) with Java 8 (java.lang.reflect.AnnotatedElement cannot be resolved)

I just encountered a strange error when switching the JDK version of a new Project of mine from 7u45 to 8u20. A harmless LogManager declaration at the beginning of my class is being refused with the following error:
The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files
This is the code:
public class Class1 {
private static Logger log = LogManager.getLogger(Class1.class);
...
Eclipse proposes me to configure the build path, but I have no Idea what to configure because I don't know the underlying problem of that error.
Using the JDK with version 7, everything works fine.
When using JDK 8 and an IDE (or any other code processing tool/framework) with its own compiler, like Eclipse, you have to update the tool to a version with Java 8 support, even if you are not using the newer Java 8 features.
The reason is that the compiler must be able to load the newer class files of the JRE in order to compile your software which references these classes.
Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse older class file parsers as they use new features, notably AnnotatedElement, which now has default methods, and Map.Entry, an interface which now has static methods.
It seems that Eclipse does not make a difference between references for which no class file could be found and class files it failed to read when saying “«classname» cannot be resolved”.
The same applies to all tools and frameworks using ECJ as embedded compiler.
If this happens to you in Tomcat running from within Eclipse (question was closed as duplicate and redirects here), go to Preferences → Server → Runtime Environments → Tomcat version → Edit… and make sure the selected JRE matches the Tomcat version. (Maybe you need to install one.)
Solution 1:
Try changing the source level.
Go to Project > Preferences > Java Compiler.
Enable Project specific settings
Set compiler compliance level to 1.4 or below.
Restart
Solution 2:
Create a new workspace.
Copy project files into the new workspace.
Import project into eclipse and rebuild.
I change from JRE 8 to JRE 7 and restart Eclipse then it works fine.
I was using Eclipse Helios with JRE 8 and updating the software solve the problem.
Now I'm using Eclipse Mars and works just fine -> https://eclipse.org/downloads/

No source code is available for type java.util.Objects

I've run into a pretty weird problem.
I checked out a repo from github in eclipse. It's a gwt project. When I try to compile the project, I got an error:
No source code is available for type java.util.Objects.
There are also some similar errors which all point to the same problem: I use the wrong Java version.
What is weird here is that I do use Java 7 in my project.
I can not post an image here but I do use java7. I added a test class which contains some features in java7, like switch(String), it works fine when I run it as a Java application.
Got a clue? Need help!
Answer: Thanks to sᴜʀᴇsʜ ᴀᴛᴛᴀ, I got it right. I used gwt-2.5.1. Change it to 2.6, it works! Thank you guys.
That's because Eclipse couldn't find the java library.
Please check the project settings and source tab. and make sure that the java sdk was included.
If are you using GWT 2.6 , then below 2.6 versions of GWT doesn't support java7.
Java7 support added in GWT 2.6 version.
Make sure that the GWT version and Java version matching or not.
Just because you have java 7, doesn't mean you have the source for it.
Java code running in GWT is translated to Javascript, so some classes that work on a JVM won't work with GWT
Check the JRE system library in project build path.
Right click on project -> Build Path -> Libraries
Also check for the java compiler compliance level
Right on project -> Properties -> Java Compiler

Exception while compiling: wrong version 50.0, should be 49.0

I am working an application with JXL API and when i tried compiling using eclipse IDE, it's working fine and the same is not compiling when i am trying to compile in Command prompt and showing the below exception..
Extract.java:6: cannot access jxl.read.biff.BiffException bad class file: C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext\jxl.jar(jxl/read/biff/BiffException.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import jxl.read.biff.BiffException;
^
1 error
EDIT:
I am able to executing using JDK 1.6. Since JDK 1.6 must also be compatible with lower versions, why doesn't it support the class files which were compiled in JDK 1.5.
The library you're using was compiled with Java 6
Your compiler is Java 5 that's why it doesn't understand that format.
To fix it you have to get a 1.5 version of the library or upgrade your compiler to 1.6 I suggest the later.
Per http://www.jnode.org/node/2140...
Submitted by Stephen Crawley on Fri, 11/30/2007 - 07:15.
I suspect that you are mixing code compiled with different versions of Java. Class file version 50.0 is used by Java 6.0, and 49.0 is used by Java 5.0.
Try doing a "build clean" to get rid of all existing class files, followed by a regular build.
JNode is being developed using Java 6.0 only. Last time I tried, it didn't build using Java 5.0 (aka 1.5). (It is a problem with the program that builds the JNode boot image.)
Try changing the builder in Eclipse. If you're using 3.4, it's Project - Properties - Java Compiler - Enable Project Specific Settings - Compiler Compliance Level = 1.6. You'll prolly also need to have JRE 1.6 installed, as well.
Check you class path in eclipse and make sure that its the same class path your compiling to in the command prompt, also check your library imports
It means that, you have compiled that class with Java 6 and trying to execute with Java 5.
Solution :
If your using ant, execute below steps on the project root directory
ant clean
ant deploy
If your using eclipse, just
clean the workspace(remove the class files which were compiled with Java6)
and build again
this could be that in you IDE you point to latest version of JDK but when you build your program outside the IDE(maybe with maven) your java_home is the older version to the one on your IDE.

Categories

Resources