I have developed a .jsp website using NetBeans. It is working perfectly well when I run it from NetBeans but when I clean and build the project and copy the .war file from the dist folder and copy in the webapps folder of the TomCat 5.0 that is installed alongwith no .jsp file is being executed.
The error shows:
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Sometimes while cleaning and building the project an error occurs in NetBeans that MySQL driver.jar i.e. included library cannot be deleted.
tomcat uses environment variable JAVA_HOME, set it to point to your jdk
Related
I have JRE made for Android. I am trying to execute /data/local/tmp/j/java but that gives
following error:
Error occurred during initialization of VM Unable to load native library:
The other files for java are at: /data/local/tmp/java.
I have executed following commands:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/java/lib/jli
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/java/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/java/lib/server
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/java
But the same error as above is still showing. The reason why i have moved java executable to /data/local/tmp/j/java is because on Android you can only execute and include lib[name].so files in jniLibs/abi so i am unable to move bin, lib folders to /jniLibs/abi.
I would be very grateful if someone could help me out with this as i am working for days to get this completed.
before now, my application has always compiled and executed. I just do my compilation using
jar cvmf mainClass.txt starcoder.jar .class images/.gif images/*.jpg *.bat
I have a
**Windows 7 OS,
Java JDK jdk1.7.0_05,
JRE JRE7,
Connector J mysql-connector-java-3.1.14-bin,
Using a TextPad for development,
The runtime is on C:/Program Files/Java and Java_home**
This application from TextPad, it runs well with the CLASSPATH and executes fine.
The system compiles properly but my JAR file fails to execute
PROBLEM: It fails to find my CLASSPATH on runtine execution(which works perfectly on compile time) giving me this Error
c:\Program Files (x86)\Java\jdk1.7.0_05\bin>java -jar starcoder.jar
ClassNotFoundException: com.mysql.jdbc.Driver SQLException: No
suitable driver found for jdbc:mysql://localhost/starinv?user=r oot
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/mail/MessagingE xception
at serialz.(serialz.java:96)
at serialz.main(serialz.java:240) Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinCla
ssLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(C
lassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more
The CLASSPATH
.;C:\Program Files (x86)\Java\jre7\lib\ext\comm.jar;.;C:\Program Files
(x86)\Java\jre7\lib\ext\mysql-connector-java-3.1.14-bin.jar;.;C:\Program
Files (x86)\Java\jre7\lib\ext\jxl.jar;.;C:\Program Files
(x86)\Java\jre7\lib\ext\mailapi.jar;.;C:\Program Files
(x86)\Java\jre7\lib\ext\mail.jar;.;C:\Program Files
(x86)\Java\jre7\lib\ext\activation.jar;.;C:\Program Files
(x86)\Java\jre7\lib
My connector J file is in the right location but I get an error while executing my JAR file.
I need help to resolve this.
is the same for both my development and runtime environment.
Try calling like this:
java -cp .;"C:\Program Files (x86)\Java\jre7\lib\ext\comm.jar";"C:\Program Files (x86)\Java\jre7\lib\ext\mysql-connector-java-3.1.14-bin.jar";"C:\Program Files (x86)\Java\jre7\lib\ext\jxl.jar";"C:\Program Files (x86)\Java\jre7\lib\ext\mailapi.jar";"C:\Program Files (x86)\Java\jre7\lib\ext\mail.jar";"C:\Program Files (x86)\Java\jre7\lib\ext\activation.jar";"C:\Program Files (x86)\Java\jre7\lib" -jar starcoder.jar
Note that I removed your classpath's redundant "." entries and quoted each path.
I'm going through a Java course, using Intellij IDEA. In this "Test" project, I have only two test classes as shown below (they really don't have any code).
Before I get into the problem, I just need to state that all my projects run correctly, it's just that I have the following problem with running the terminal command, and I'm afraid I messed something up with my IDE:
The problem occurs when I need to get the serial version of the class BankAccount using the following command:
E:\Software Projects\Test\out\production\Test>serialver com.company.BankAccount
I get the error that is shown below, and I understand that the classes were compiled by a newer Java Runtime error, but how do I troubleshoot this in Intellij? I get the same error when running the command on any class in any project.
Additional note: I also get an error related to this one when running the Main class in terminal using java com.company.Main
What I think could be the cause of the problem: Prior to even trying "serialver" for the first time, I changed the name of a project folder (I just used "Rename" in my file explorer in Windows, and it messed everything up in Intellij (whatever project I opened, it had no SDK and no Run/Debug Configurations). So, I selected "Add SDK" on a project (or something similar, and selected a JRE 12 from the list.
Then I ran "Debug Main" and the Run/Debug Configurations were set automatically.
When I go to Project Structure > Project Settings > SDKs I only have one SDK :"C:\Program Files\Java\jdk-12.0.1".
When I go to "Run/Debug Configurations" in a project, in the JRE of Application > Main I have the following to select (but as far as I understand, these are all one and the same SDK, right?):
Default (12 - SDK of 'Test' module)
12(java version "12.0.1")
"C:\Program Files\Java\jdk-12.0.1"
So I don't know how I can adjust anything here? How was I able to compile these classes at a newer Java Runtime version at any point?
The problem here is that I'm not sure if something else is wrong, or if the prior adjustments I've made have messed something up.
The classes:
package com.company;
public class Main {
public static void main(String[] args) {
// write your code here
}
}
package com.company;
public class BankAccount {
}
When running
E:\Software Projects\Test\out\production\Test>serialver com.company.BankAccount
What I get in the terminal is the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/company/BankAccount 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 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at jdk.compiler/sun.tools.serialver.SerialVer.resolveClass(SerialVer.java:108)
at jdk.compiler/sun.tools.serialver.SerialVer.serialSyntax(SerialVer.java:80)
at jdk.compiler/sun.tools.serialver.SerialVer.main(SerialVer.java:188)
Error when running the Main class with E:\Software Projects\Test\out\production\Test>java com.company.Main:
Error: LinkageError occurred while loading main class com.company.Main
java.lang.UnsupportedClassVersionError: com/company/Main 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 55.0
Run java -version in the command line. If it's not Java 12 or later, it will explain the issue. You are targeting Java 12 version while run it on an older Java version.
The solution would be to either adjust the target language level so that your code can run on older Java versions or to adjust your PATH environment so that java from JDK 12 install directory is the first. Or you can specify the full path to java.exe in the command line when trying to run the code:
E:\Software Projects\Test\out\production\Test>"C:\Program Files\Java\jdk-12.0.1\bin\java.exe" com.company.Main
Solved by editing file "idea.properties" and setting proper JVMVersion
I run my program in suse 11 operation system. The JRE is OpenJDK 8u-191. The program runs smoothly except kaptcha for login. When I login the page will show me the kaptcha, but an exception occurs.
java.lang.UnsatisfiedLinkError: /usr/local/java8/jre-8u191/lib/amd64/libfontmanager.so: libfreetype.so.6: cannot open shared object file no such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
...
Is the libfreetype.so.6 in OpenJDK? I can't find it. Should I download the libfreetype.so.6 from internet?
This is part of libfreetype6 and you can find it here https://software.opensuse.org/package/libfreetype6
I have Intellij 2017.2.3 and Checkstyle-IDEA 5.10.0 running on my Ubuntu 17 dekstop. When i try to add a checkstyle for my Java project (at Settings->Other settings->Checkstyle) I get this error message:
java.lang.NoClassDefFoundError: org/apache/commons/collections/FastHashMap
at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:963)
at org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBean.java:391)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:217)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.contextualize(AutomaticBean.java:249)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:455)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:186)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:58)
at org.infernus.idea.checkstyle.service.cmd.OpCreateChecker.execute(OpCreateChecker.java:26)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.executeCommand(CheckstyleActionsImpl.java:126)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:56)
at org.infernus.idea.checkstyle.service.CheckstyleActionsImpl.createChecker(CheckstyleActionsImpl.java:47)
at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:44)
Is it familiar for anyone?
I got the same issue while migrating the project from WAS 8 to WAS Liberty.
I did copying the jar commons-collections.jar in to the server location /servers/<server_name>/lib/global and resolved it.
So try to place the jar at IntelliJ local server.
java.lang.NoClassDefFoundError: org.apache.commons.collections.FastHashMap
at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:963)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:935)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:823)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:431)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)