EduArn is your learning hub for AI, Cloud Computing, and DevOps tools and technologies. Explore detailed guides, practical examples, and real-world use cases of artificial intelligence platforms, cloud services, automation tools, CI/CD pipelines, containers, Kubernetes, infrastructure as code, and modern IT solutions. Learn how emerging technologies are transforming software development, deployment, and business operations while building your technical skills for the future.
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building CommandsGUI 1.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ CommandsGUI --- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CommandsGUI --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ CommandsGUI --- [INFO] Compiling 11 source files to C:\workspace\CommandsGUI\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.687 s [INFO] Finished at: 2016-08-04T17:35:31+01:00 [INFO] Final Memory: 8M/20M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project CommandsGUI: Fatal error compiling: tools.jar not found: C:\Java\jdk1.8.0_74\jre\..\lib\tools.jar -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Solution:
Right Click on the project > Build Path > Configure Build Path
Select java build path > Remove the old JRE e.g JRE 1.6
IOException while executing the unix shell command by java, Runtime.getRuntime().exec(), java.io.IOException, Cannot run program, No such file or directory.
BufferedReader reader = new BufferedReader(new InputStreamReader(
objProcess.getInputStream()));
String line = "";
while ((line = reader.readLine()) != null) {
System.out.println((line + "\n"));
objOutPut.append(line + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
%>
<textarea rows="20" cols="150">
<%=objOutPut %>
</textarea>
</body>
</html>
Issue:
java.io.IOException: Cannot run program "ls -tlr": java.io.IOException: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:494) at java.lang.Runtime.exec(Runtime.java:612) at java.lang.Runtime.exec(Runtime.java:485) at org.apache.jsp.jsp.cmd_005foutput_jsp._jspService(cmd_005foutput_jsp.java:75) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:701) Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
Solutions:
Put the command in .sh file and call that file with actual path.
Change the port in server.xml file, if port conflict there then change the other value:
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8051" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> -->
<!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL/TLS HTTP/1.1 Connector on port 8091 --> <Connector port="9001" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8491" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="9001" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8491" /> --> <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8491 This connector uses the NIO implementation that requires the JSSE style configuration. When using the APR/native implementation, the OpenSSL style configuration is required as described in the APR/native documentation --> <!-- <Connector port="8491" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->
<!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="2001" protocol="AJP/1.3" redirectPort="8491" />
<!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm>
The type SimpleCalculator must implement the inherited abstract method InterfaceForAbstractClass.display()
packagecom.tutorialbyexample;
publicclass SimpleCalculator extends Calculator {
public SimpleCalculator() {
// TODO Auto-generated constructor stub
}
@Override
void print() {
System.out.println("Print implementation from abstract class");
}
publicstaticvoid main(String arg[]) {
SimpleCalculator obj = new SimpleCalculator();
obj.Addition(1, 2);
obj.print();
}
@Override
publicvoid display() {
// TODO Auto-generated method stub
}
}
Errors & Solutions: * Issue with final abstract, e.g. public final abstract class Calculator { } * Class cannot be both final and abstract or The class Calculator can be either abstract or final, not both Solution: We can't put final and abstract together. While putting final can't subclass. public abstract class Calculator { }
* Issue with static abstract, e.g. public static abstract class Calculator { } Illegal modifier for the class Calculator; only public, abstract & final are permitted Solution: public abstract class Calculator { }
* Issue we can't instantiate abstract class * Cannot instantiate the type Calculator Solution: Don't try to create object of abstract class. Calculator obj = new Calculator(); Issue, if you not implement the abstract method in abstract class while implementing The type SimpleCalculator must implement the inherited abstract method Calculator.print() Solution: Implement abstract methods in implementation class what we have in abstract class.