Many times we need to check the version of java installed on the system due to the following reasons Check if java is installed even or not. Know if the installed java will support some feature or it contains newly added classes or not. How to check java version from command line Open command prompt on windows or terminal on linux and mac systems, type the following command and hit enter. java -version If java is added to the system’s classpath, then it will show following output. C:\>java -version openjdk 14-jpackage 2020-03-17 OpenJDK Runtime Environment (build 14-jpackage+1-8) OpenJDK 64-Bit Server VM (build 14-jpackage+1-8, mixed mode,Read More →

What is context path in a web application Context path, also called context root is the name with which a web application is accessed in the browser. It is the string after the server ip and port in the application URL. Example, if the URL of a web application is http://127.0.0.1:8080/employee-manager, then employee-manager is the context path or context root of the application. Default context path By default, the name of WAR becomes the context path of the application. Thus, if the name of your WAR is temperature-converter.war, then your application will be accessed at URL http://127.0.0.1:8080/temperature-converter assuming that the server is running at ipRead More →

What is a WAR file A WAR file stands for Web Application Archive and is a bundle for distributing or hosting a java web application. It is used as a bundle of files required by the web application that is written in Java programming language. A war file may contain following file types: Application code in the form of class files Servlets(which are also class files), JSPs, Application’s deployment descriptor(web.xml), JAR files required by the application class files, Static files such as images and html files etc. A war file needs to be deployed in a web server or an application server so that theRead More →

What is a batch file A batch file is a file that you can create in windows to perform some tasks. This file contains windows commands and can be used to automate manual actions. Example, suppose you have a folder that contains some junk files and after every couple of days you need to clean those files. One way is to select all the files that need to be removed one by one and then delete them by pressing delete key. Sounds boring, isn’t it? Another much simpler way is to create a batch file with commands to select those files and remove them. NowRead More →

A URL consists of a root and some parameters that carry some data. These parameters are in the key-value pairs and separated by ‘&’ character. Also, the list of parameters and the actual URL are separated by a ‘?’ character. This list of parameters is called URL parameters or query parameters while the complete string after the ‘?’ character is called query string. Example, https://www.google.com?enc=en&auth_user=u&lan=fr Here, actual or root URL: https://www.google.com query parameters: enc=en, auth_user=u and lan=fr query string: ?enc=en&auth_user=u&lan=fr Though you can get url query string using javascript by calling window.location.search but what if you want each url(or query) parameter with its value separately. This post will listRead More →

If you create a shell script file on windows and copy it on linux for execution, you might get below error $’\r’: command not found This is because end of line character on windows is different than that on linux. End of line on windows is a combination of Carriage return and Line Feed characters(CR + LF) while that on linux is only Line Feed(LF). Thus, a script created on windows when executed on linux gives the above error. Solution There are 2 ways in which this problem can be solved. Method 1: Using dos2unix utility Install dos2unix program on the target linux system ifRead More →

Many times we know the port number and want to get the details of the process running on that port on windows. Reasons may be to find which program is using the port. the process name running on that port. to find the process id(PID) of the process using its port so that we can kill the process. Windows provides netstat command. This command has different options which can be used to extract port and process related information. Find process running on given port Use the below command if you know the port and want to get the PID of process running on it. netstatRead More →

When you are generating angular components either using Operating system terminal or embedded terminal in VS Code, you might have encountered this error as shown below. F:\angular\src> ng g c MyComponent Could not find an NgModule. Use the skip-import option to skip importing in NgModule. Solution 1 Check the current directory at which the terminal is currently pointing or the path in which you are running this command. Next, check if this folder contains a module or a file with .module.ts extension. In my case I was running this command from inside the path <project name>/src while app module was located inside <project name>/src/app folder.Read More →

What is a join In a real world application, data resides in multiple tables and often you need to fetch data from multiple tables in order to display meaningful information. Example, suppose there are two tables Employee: containing basic information about an employee such as his role, designation, department, managerid etc. Employee_Detail: containing personal information of an employee such as his name, address, blood group, phone number etc. Rows of both the tables are linked by a column employeeid in the second table which also happens to be the foreign key in the Employee_Detail table referencing the Employee table. Now when it is required to displayRead More →