Browsed by
Category: Java

Replace function in java

Replace function in java

In the below program we are replacing “\\” (2 backslash) with (4 backslashes). Actually \(backslash) is used for escaping characters. Here we have to escape backslash only. so only 8 backslashes are used to get 4 backslashes. Program: package god; public class ReplaceFunction { public static void main(String[] args) { String naveen = "javadomain\\naveendra\\eversoftindia"; System.out.println(naveen); String cool="\\\\\\\\\\\\\\\\"; System.out.println("after replacements using replace function "+naveen.replace("\\", cool)); } }     Output: javadomain\naveendra\eversoftindia after replacements using replace function javadomain\\\\\\\\naveendra\\\\\\\\eversoftindia 837 total views, 2 views today

837 total views, 2 views today

Hudson project build

Hudson project build

Step 1: Download the hudson war file from the below link, http://hudson-ci.org/download/war/ Step 2: Open the command prompt and go to the location of hudson war file that you have downloaded and type “java -jar hudson.war”. hudson.war is the exact name of the file in your system or location. It may be hudson-2.2.war or hudson-2.0.war etc…….. After you run you have to get the output like below, If you see the error output like below then change the address of…

Read More Read More

918 total views, no views today

Perl path setting in windows 7

Perl path setting in windows 7

Step 1: Before path setting you can see the command prompt window like this, Step 2: setting path through system properties Right click on computer -> Properties -> Advanced system settings -> Advanced tab -> Environment variables -> System variables -> edit the path and add this, “C:\xampp\perl\bin” (location of perl bin) Step 3: Setting path through command prompt, Difference between step2 and step3 are, 1. Setting path through system properties is one time work. But setting path through command…

Read More Read More

881 total views, no views today

Perl Hello world CGI in xampp server

Perl Hello world CGI in xampp server

Download Xampp from http://www.apachefriends.org/en/xampp-windows.html Step 1: Create a file named javadomain.cgi and paste the below code, #!”C:\xampp\perl\bin\perl.exe” print “Content-type: text/html\n\n”; print “<H1>Hello World</H1>\n”; #!”C:\xampp\perl\bin\perl.exe” is the location of perl.exe. Step 2: Save this file in C:\xampp\htdocs Step 3: Open the xampp control panel. which is in c:\xampp. Step 4: Start the servers,   Step 5: Check whether the server is on and working fine by typing localhost in the browsers, if you didn’t get the above window, then once again open…

Read More Read More

2,867 total views, 1 views today

Perl Hello World

Perl Hello World

Step 1: Create a text file named HelloJAVADOMAINdotIN.pl and copy this below single line,   print “Hello JAVADOMAINdotIN\n”;   Step 2: Save this file in your perl directory bin folder. Ex: C:\xampp\perl\bin Step 3: Open the command prompt and run the file like this, “perl HelloJAVADOMAINdotIN.pl”  then you can see the output like this,     Thanks for reading this post………!!!   857 total views, 1 views today

857 total views, 1 views today

Java URLDecoder sample program

Java URLDecoder sample program

Program: package com.ngdeveloper.com; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; public class ComparePrintandSystem { static String intro="I am naveen kumar working @ www.ngdeveloper.com"; public static void main(String[] args) throws UnsupportedEncodingException { System.out.println("Input string is "+intro); String encodedurl = URLEncoder.encode(intro,"UTF-8"); System.out.println("After encoding the INPUT " +encodedurl); String decodedurl = URLDecoder.decode("After decoding the encoded input "+encodedurl,"UTF-8"); System.out.println(decodedurl); } }    Output: Input string is I am naveen kumar working @ www.ngdeveloper.com After encoding the INPUT I+am+naveen+kumar+working+%40+www.ngdeveloper.com After decoding the encoded input…

Read More Read More

827 total views, no views today

URLEncoder with sample program

URLEncoder with sample program

Sample program:   package com.ngdeveloper.com; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class ComparePrintandSystem { static String intro="I am naveen kumar working @ www.ngdeveloper.com"; public static void main(String[] args) throws UnsupportedEncodingException { System.out.println(URLEncoder.encode(intro,"UTF-8")); } }   Output: I+am+naveen+kumar+working+%40+www.ngdeveloper.com URLEncoder Rules: All the characters (a to z & A to Z) and numbers (0 to 9) remains same. Space is converted to “+” All the other characters are converted to hexadecimal values by prefixing with %. In the above sample program, %40 is the…

Read More Read More

826 total views, no views today

TxtWeb Hello World

TxtWeb Hello World

Step 1:  Download the eclipse,  http://www.eclipse.org/downloads/ Step 2:  Add the google plugin for txtweb in eclipse Step 3:  New -> other -> Web application project, and paste the below code, package com.agn.meaning; //Package name for the app import java.io.IOException; import javax.servlet.http.*; @SuppressWarnings(“serial”) public class MeaningServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType(“text/html”); // Remember to set your response to text/html for the app to work properly. resp.getWriter().println(“”+”Hello World”+””); // Whatever is inserted within the…

Read More Read More

1,519 total views, 2 views today

Installing Google Plugin in Eclipse

Installing Google Plugin in Eclipse

Installing Google Plugin in Eclipse: Google plugin can be helpful to work with appengine, android ADT’s and cloud deployments. Appengine is one of the best one to deploy Java J2EE web applications. Appengine gives daily free limits, so you can start using google appengine service to deploy J2EE web application either for learning or small start-ups or initiatives.   Step 1: Open your eclipse and follow the steps, Step 2:  Eclipse Juno 4.2: http://dl.google.com/eclipse/plugin/4.2 Eclipse Indigo 3.7: http://dl.google.com/eclipse/plugin/3.7 Eclipse Helios…

Read More Read More

736 total views, 1 views today