Press enter to see results or esc to cancel.

Get GEO Location Coordinates of User

In this video I have shown how you can get the GEO Location Coordinates of the user using simple java script code. <!DOCTYPE html> <html> <body onload=”getLocation()”> <p>Your Location Details are Shown Below.</p> <p id=”demo”></p> <script> var x = document.getElementById(“demo”); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = “Geolocation is not …

Continue reading

Create Document file dynamically using java

In this project we are trying to create a Microsoft Word file using Apache POI api with JAVA. 1. Project Structure 2. Jars used in the project are, 1. poi-3.17.jar 2. poi-ooxml-3.17.jar 3. poi-ooxml-schemas-3.17.jar 4. xmlbeans-2.6.0.jar 5. Mysql connector jar 3. Generate_Document.java package com.chillyfacts.com; import java.io.File; import java.io.FileOutputStream; import org.apache.poi.xwpf.usermodel.VerticalAlign; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import …

Continue reading

Java Switch Statement source code

Java Switch statement executes if any of the cases in the switch is matched. Just like if-else-if ladder statement. Switch statements can be used only to String,int and enum parameters by default. 1.Java Switch with Integer Argument example. Java_Switch.java package com.chillyfacts.com; public class Java_Switch { public static void main(String[] args) { int i = 100; …

Continue reading

The goal you specified requires a project to execute but there is no POM in this directory

On executing the mvn generate the below error will come sometimes mvn archetype:generate -DgroupId = com.chillyfacts.helloworld -DartifactId = helloworld -DarchetypeArtifactId = maven-archetype-webapp -DinteractiveMode = false [INFO] Scanning for projects… [INFO] ———————————————————————— [INFO] BUILD FAILURE [INFO] ———————————————————————— [INFO] Total time: 0.147 s [INFO] Finished at: 2017-11-26T21:08:47+03:00 [INFO] Final Memory: 7M/116M [INFO] ———————————————————————— [ERROR] The goal you …

Continue reading

JAVA JSP file upload example source code

In this video I have shown how you can create a JSP file upload. This project is shown in Eclipse IDE. 1. Project Structure 2. The jar file used in the project are, 1.org.apache.commons.io.jar 2.commons-fileupload-1.3.1.jar 3. The servlet will upload the image to d:\uploaded_files folder FileUploadHandler.java package com.chilyfacts.com; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import …

Continue reading

Create Barcode in JSP page

How to Create and Shown bar code in JSP Page. I have shown this using Eclipse IDE. 1. Project Structure 2. The jar used in the project are, 1. barcode4j.jar 2. itextpdf-5.1.0.jar 3. Mysql connector jar 3. Create Barcode in Static way using below Servlet Create_Bar_Code.java package com.chillyfacts.com; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import …

Continue reading

JAVA Get current time from different time zones as String

How to get Current Time from Different time zones JavaTimeZoneTest.java package com.chillyfacts.com; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class JavaTimeZoneTest { public static void main(String[] args) { TimeZone timeZone = TimeZone.getTimeZone(“GMT”); SimpleDateFormat date_format=new SimpleDateFormat(“dd-MM-yyyy EEEE hh:mm:ss a”); date_format.setTimeZone(timeZone); Date date=new Date(); String current_date_time=date_format.format(date); System.out.println(“GMT-“+current_date_time); timeZone = TimeZone.getTimeZone(“Asia/Kolkata”); date_format.setTimeZone(timeZone); current_date_time=date_format.format(date); System.out.println(“Asia/Kolkata-“+current_date_time); timeZone = TimeZone.getTimeZone(“Australia/Perth”); date_format.setTimeZone(timeZone); …

Continue reading

Java SimpleDateFormat different date formats

How to get the current date and time as String value. SimpleDateFormat get date and time in different formats. Read the date as String value. SimpleDateFormats.java package com.chillyfacts.com; import java.text.SimpleDateFormat; import java.util.Date; public class SimpleDateFormats { public static void main(String[] args) { SimpleDateFormat date_format=new SimpleDateFormat(“dd-MM-yyyy EEEE hh:mm:ss a”); Date date=new Date(); String current_date_time=date_format.format(date); System.out.println(current_date_time); } …

Continue reading

java if statement source code-Simple Java Programs

In this video I have shown the four common different if statements with example source code. The four if statements are, 1. if statement 2. if-else statement 3. if-else-if ladder 4 .nested if statement Project Structure If_Statement.java package com.chillyfacts.com; public class If_Statement { public static void main(String[] args) { int i=15; System.out.println(i>10); if(i>10){ System.out.println(“i is …

Continue reading