I wrote a program that connect to remote LINUX machine and executes a command. I used jsch-0.1.42.jar file to connect to remote machine. My program working well and returning output. Now I would like to call method, which is declare inside in Servlet from JSP using the following code
<% SSHCommandExecutor sshce = new SSHCommandExecutor();
sshce.runCommnad();
%>
But I am getting following error
HTTP Status 500 -java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch Servlet.service() for servlet jsp threw exception: java.lang.ClassNotFoundException: com.jcraft.jsch.JSch
You need to import the class inside your jsp page before using it as we import the class in normal java class.
Just the method to import is different.
We import the class in normal java class files just after the
packagestatement( ifpackagestatement exist) or as the first statement.In jsp we mention the
importattribute in thepagedirective like this :