migrating from C++ to java so starting today wanted to follow some tutorials but, when I create new dynamic web project, get error straight away in web.xml file. I installed java 11 se and downloaded java 8ee but not linked anywhere yet, also installed and linked tomcat 10.
ERRORS
Could anyone know problem here?
Thank you in advance
SOLVED:
To get rid of first 5 errors change Java version to the installed on machine
To get rid of xml error, change xmlns="http://java.sun.com/xml/ns/j2ee to
xmlns="http://Java.sun.com/xml/ns/j2ee make Java upper case
Related
Error: A JNI error has occurred, please check your installation and try again.
Eclipse states: test has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0.
I had the problem referenced at this question: "Could not find or load main class" while trying to use JavaFX in Eclipse When using JDK13 and JavaFX13. All solutions pointed to downgrading to Java 8.
I installed Java 8, updated the build path, and it built fine. But now I get the error I am using Eclipse 2019-06 (4.12.0), JavaFX13, and JDK 1.8.0_231.
I researched the answer but the two questions that come didn't help. One was for an IntellJ solution and the other had a package I am unfamiliar with, and the error had to do with that package.
I simply don't know how to correct the build path or dependencies to fix this issue. It appears I need a lower version of the JVM, but cannot seem to locate it. Am I right, or can you please help?
Well, I have dropped back to JDK 8 and the built in JavaFX. Despite my best efforts, I cannot get JDK13 and JavaFX 13 to work without receiving the error "Could not find or load main class" (see link in post). Since there is no solution to that problem yet that works for me, I can bypass my error on this request all together and just use much older packages.
At the moment i'm migrating an application to java 8. This application id deployes on WAS 8.5.5.9 (Full profile). The application is working fine. Java 8 code is also working. So sar so good. But when I take a closer look to the compiled jsp's I see that they are compiled into java 6. Anyone who knows whats the problem and how I can solve this?
I've been on a very old version of GAE for a long time. Every time I try to update to the latest version I get this error when deploying it to GCP:
java.lang.IllegalArgumentException: Class file is Java 8 but max supported is
Java 7: org/eclipse/jetty/http/BadMessageException.class in C:\Users\XXXXXXXXXXX\
backendservlet\build\exploded-app\WEB-
INF\lib\jetty-http-9.3.2.v20150730.jar
I think jetty comes with GAE so how do I fix this? When I deploy it locally it runs without errors. It also builds without error. This only happens when deploying to GCP.
My appengine instance is on JAVA 7 runtime so maybe that's the issue? How do I change that? I tried deplying with a different version and name and it still didn't work.
Please help.
Looks like jetty (or at least the version you're using) needs Java 8, which is not supported on GAE: Does Google App Engine support Java 8?.
GAE does not yet support Java 8. If jetty is a dependency of your project, you need to use a version that has source 1.7. Otherwise delete C:\Users\XXXXXXXXXXX\
backendservlet\build\exploded-app\WEB-
INF\lib\jetty-http-9.3.2.v20150730.jar
I am new to NetBeans, and have previously been using Eclipse. I have started using NetBeans now because I need to learn a variety of Java EE concept, and I have found more relevant tutorials for the NetBeans IDE. A lot of the abstract concepts in EE still has me confused, so I have found that step-by-step holding hands-tutorials works best for me for now.
I have however met a dead end. I am following this tutorial, on setting up a web service client. However, one of the lines include a try-with-resource statement, which is new in java 7. Picture here:
When I started this tutorial, I was using Netbeans 7.1.3, with Glassfish 3.1.2. I knew it didn't have support for EE7, so i downloaded NetBeans 8.0.1 with Glassfish 4.1. I have realized later on that the try-with-resources is a part of SE, and my upgrade was in this matter reduntant.
I figured there was something wrong with my project settings, so i right-clicked it and opened it's properties. Under the Libraries option, I found that the JDK was correctly set to Java 1.7 (update 51). Picture here:
I also checked the oter options, and under Run I found that Java EE is set to 6, even though Glassfish 4.1 is selected as server. I figured this was an implementation of EE7, but the option is locked to EE6. This confuses me a bit, but shouldn't be the cause of the problem. I still attach a picture of it, just in case it is relevant:
So what is wrong with my Java settings for this project? Why can't it accept a Java 7 feature, when it seems like it is set to use Java 7? Are there other places where i need to set java version/home?
You use Java7 for the system library but compile your source code to be compatible with Java6.
To change this you have to go to sources in your project settings and change the source compatibility to Java7.
My problem started the other day when I tried to run a jar file that was compiled in java 1.6 from a friend. I then got:
java.lang.NoClassDefFoundError
Since I was only using java 1.5 obviously. So I updated using the system update. This did not help and when I ran:
java -version
in the terminal it still said I had java 1.5. I then saw on the internet that there was an "java SE update 4" on apples download page available. I downloaded and installed this file but it still wouldn't work. I gave up and decided to go back to my programming in eclipse. When I tried to compile and run my application in eclipse I now recieved the same error java.lang.NoClassDefFoundError and it wouldnt let me proceed. I tried right clicking the project and viewing the properties but it wouldnt let me, just gave me another error. I figured I might messed something up when I installed the new java version so I tried reinstalling eclipse but it still gave me the same error. I tried creating a new workspace but that wouldnt help either. I then figured I would try to compile throught the terminal using:
javac main.java
java main
But I still get the same error. I went in under systems settings and diabled "java 1.6" and i tried creating new projects with both javaSE-5 and javaSE-6 but it just wont work. My thoughts now is if it has something to do with eclipse not being able to access the bin & src directories in the project directory but that should work if i reinstalled it? I also saw someone mention setting the classpath in os x but I don't know. I would really need some help solving this issue since a lot of my work rely on eclipse working. I would rather not have to reinstall the whole OS just because of this but if I can't get it to work I guess there is no other alternative.
Best Regards
Jonas Kristensson
"Reinstall the whole OS"? Good lord, no.
Your problems have nothing to do with the version of Java. You don't understand how CLASSPATH works.
The class you were trying to run wasn't on the CLASSPATH. If your friend gave you a JAR, you need to add it to your CLASSPATH and use the fully-resolved class name to run it.
A word of advice for your future mental health: When you have problems, don't assume the worst and jump to extreme measures. Try the simple solutions first.
I tried to run a jar file that was compiled in java 1.6 from a friend. ... Since I was only using java 1.5 obviously
Note that if this was really the case you'd get a java.lang.UnsupportedClassVersionError, since Java 5 can't run classes compiled for Java 6 (it might be able to do so, but the class files say "I'm Java 6+" (class version 50) and thus Java 5 would just refuse to run it (max class version in Java 5 would be 49).
Try to compile with
javac -source 1.5 target 1.5 .....