Cannot access greenfoot.World - class file has wrong version - java

I try to use Intellij IDEA for Greenfoot development on Mac.
Here is a tutorial to use NetBeans with Greenfoot:
https://www.greenfoot.org/doc/running_on_netbeans
So I created my scenario in Greenfoot. Then saved it and opened it in IDEA.
I took greenfoot.jar and bluejcore.jar from application package and added these libraries to a project structure.
At this point I receive the following error:
Error:(9, 30) java: cannot access greenfoot.World bad class file:
/Users/.../Greenfoot/greenfoot.jar!/greenfoot/World.class
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Some conflict with a version. However I took both jars from the Greenfoot application installed on my machine. Appreciate some help.

The error says, that greenfoot.World was compiled with Java 11 and you try to use it with a compiler supporting up to Java 8.
Try changing the JDK

Related

Error : class file has wrong version 55.0, should be 52.0

On running my main program I am getting the above error. I am not sure what could be the reason for this.
On one of the pages online I found that the class files have been generated by a different version of the compiler and the current JDK is different
I deleted everything inside the .m2 folder and the target folder, but still, it showed the same error. Not sure maybe I should delete the .idea folder too and check.
There should be some way to resolve it without changing to Java 11.
This is the exact error -
java: cannot access org.hibernate.Session
bad class file: /C:/Users/name/.m2/repository/org/hibernate/orm/hibernate-core/6.0.0.CR1/hibernate-core-6.0.0.CR1.jar!/org/hibernate/Session.class
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Hibernate 6.0 and later versions require at least Java 11 (https://docs.jboss.org/hibernate/orm/6.0/userguide/html_single/Hibernate_User_Guide.html#_system_requirements).

I am new to camel framework , I tried a program to copy a file from one directory to another but while running the program I got the following error

Error:(3, 24) java: /C:/Users/AMIT/IdeaProjects/learncamel/src/main/java/com/learnCamel/copyfile.java:3: cannot access org.apache.camel.CamelContext
bad class file: jar:///C:/Users/AMIT/.m2/repository/org/apache/camel/camel-api/3.1.0/camel-api-3.1.0.jar!/org/apache/camel/CamelContext.class from ZipFileObject
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
I am new to Camel and java so I am not sure how to correct it. If anyone can help I would be thankful.
So, I resolved this issue. The problem was that my runtime java was version 1.6 and the compiler was using version 1.8 for compiling so that's why it was showing error.

I'm having a trouble with starting Eclipse : Error : ... cannot be solved to a type

I really don't know what the problem is.
I followed several web postings about installing and settings of JDK/ JRE and also completed clearly on environment variables :Path & CLASS PATH
I'm sure about that since i checked the cmd and it worked well.
the same problem occured over and over again.
I corrected on Library tab
I add the Library list like this,
But, I still have the same problem. Did I make a severe mistake? what should I do about this problem?
still have JAVA problems
Please check the Java source directory configuration under Java Build Path, Source tab and Java Compiler version settings.
Did you recently update your Java version? If so, then you have to readjust your path so that it directs to the new updated version.

Android Java compiler error (compiling old files?!)

I refactored some packages in my IDE and everything seems to be ok. But when I compile my app I get an error that file x.java can't be read in x.java.
Both files are located in the old packages which do not exist anymore.
The package definition is fine in all classes. Also the Manifest is fine.
I'm using IntelliJ IDEA from JetBrains.
java: error reading K:\APP\src\com\renemaas\android\APP\About.java; K:\APP\src\com\renemaas\android\APP\About.java (The system can't find this path)
I hope someone can help me with this problem.
Note: Yeah I have search for nearly 1 hour to solve this problem on my own. I'm new to Android development.

org.apache.xerces.jaxp.SAXParserFactoryImpl not found when importing Gears API in GWT

I've created a GWT project using Eclipse which was working perfectly (I was able to run it in both Hosted Mode and on Google App Engine) until I tried to import the Gears API for Google Web Toolkit. After adding the following line to my java source file:
import com.google.gwt.gears.client.geolocation.Geolocation;
I get the following error when I try to compile:
19-Jun-2009 3:36:09 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext#1c7d682{/,C:\Documents and Settings\Geoff Denning\workspace\TaskPath\war}
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
I've already added the gwt-gears.jar file to my \war\WEB-INF\lib directory, and I've referenced it in Eclipse as follows:
I've even opened the gwt-gears.jar file and confirmed that org/apache/xerces/jaxp/SAXParserFactoryImpl.class does exist. Can anyone give me any pointers as to why I'm getting the above error?
Check that Xerces exists in:
$JAVA_HOME/lib/endorsed
Sounds like a Java 5 issue. Also check the Java system property for:
javax.xml.parsers.SAXParserFactory
It should be:
org.apache.xerces.jaxp.SAXParserFactoryImpl
If not then that's your issue, make sure you set the system property.
Apparently this is a bug in jre 1.5. I was able to resolve the problem by switching my default JRE in Eclipse from 1.5.0_06 to 1.6.0_03, as shown below:
Thanks to Jon and Rahul for pointing me in the right direction.
This happened to me. I had conflicting JARs in my workspace. I removed one and boom it worked. The message didn't lend very well to the root of the error.
My SAXParserFactoryImpl problem was caused by gwt-gadgets.jar I had in my boot class path. Removing this JAR from the boot class path solved the problem for me. Basically you have to remove any JAR containing a SAXParserFactoryImpl class from your build path (user libs).
Remove the $JAVA_HOME/jre/lib/jaxp.properties fixed the issue.
Take a look at Trouble with Selenium (XercesImpl) and Google App Engine.
I had a similar problem with GWT / GAE (SAXParserFactoyImpl not found) and solved it by;
Importing the jar to war/WEB-INF/lib
Adding the jar to the build path

Categories