Browsed by
Category: Java

Extracting .java from .jar and .class

Extracting .java from .jar and .class

Steps to be followed,  1. Type Hello world program. 2. Convert .java to .class file. 3. Convert .class to .jar file. 4. Convert .jar to .class 5. Convert .class to .java Step 1: Consider the below program, (hello world program) package mygod; public class Hello { public static void main(String[] args) { System.out.println(“God is there…!!”); } }  Step 2: Converting .java to .class javac Hello.java command. This command will generate Hello.class from Hello.java file. Step 3: Converting .class to .jar…

Read More Read More

672 total views, no views today

Tips to Clear OCJP 6 (SCJP) certification

Tips to Clear OCJP 6 (SCJP) certification

Tips to Clear OCJP 6 (SCJP) certification: Amazon.in Widgets Introduction about OCJP 6: OCJP (oracle certified Java Programmer) well known as SCJP (sun certified java programmer). SCJP 6 – 310-065 has now changed to OCJP 6 -1Z0-851. Only exam code has been changed, no changes in the syllabus rather than that drag and drop questions cancelled in the OCJP 6. you will have 60 questions and need to score 61 to get pass within 150 minutes. How to Start the…

Read More Read More

4,155 total views, 7 views today

HashMap with Entryset Example

HashMap with Entryset Example

package cool; import java.util.HashMap; import java.util.Map; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class hashmap { /** * @param args */ public static void main(String[] args) { HashMap<String, String> myMap = new HashMap<String, String>(); myMap.put("ind", "india"); myMap.put("tn", "tamilnadu"); myMap.put("blr","bangalore"); Set<Entry<String,String>> set = myMap.entrySet(); for (Map.Entry<String, String> me : set) { if(me.getKey().equalsIgnoreCase("tn")){ System.out.println(me.getValue()); } } } } 518 total views, no views today

518 total views, no views today

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/ref/FinalReference

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/ref/FinalReference

Solution: Step 1: Right click on the project and type Run as -> Run configurations Step 2: You can choose Java Application or you can remove the Bootstrap entries and simply run your android project.   Thanks for reading this post……!!! 479 total views, no views today

479 total views, no views today

Tomcat-Java Path Setting

Tomcat-Java Path Setting

Step 1: Right click on computer – > properties – > Advanced system settings – > Advanced – > Environment Variables – > User variables. Step 2: Create New and type as follows, variable: JAVA_HOME value : C:\Program Files\Java\jdk1.6.0 variable: JRE_HOME value : C:\Program Files\Java\jre1.6.0 variable: PATH value : C:\Program Files\Java\jre1.6.0;C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\Java\jre1.6.0\bin;C:\apache-tomcat-6.0.14\bin; variable: CLASSPATH value : c:\Program Files\Java\jdk1.6.0\jre\lib Step 3: If tomcat server doesnot start then remove the end semicolon in JRE_HOME and JAVA_HOME. Now start the server it will start successfully….

Read More Read More

1,122 total views, 2 views today

Ant (configuration and My First Ant)

Ant (configuration and My First Ant)

Step 1: Set the environment variables as follows, Start -> My Computer -> Rightclick on it and click properties -> Advanced System Settings-> Advanced -> Environmental variables -> create new on the user variables and type, 1. Variable Name: JAVA_HOME Variable value: jdk path.(say C:\Program Files\Java\jdk1.7.0) 2. Variable Name: ANT_HOME Variable Value: Ant path (say C:\Apache Ant 1.7.1) 3. Variable Name: Path Variable Value: Ant path;Jdk path (say C:\Apache Ant 1.7.1\bin;C:\Program Files\Java\jdk1.7.0\bin;) Note: In the JAVA_HOME and ANT_HOME path should be without bin, but in the path till the bin we have to…

Read More Read More

988 total views, no views today

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 563 total views, no views…

Read More Read More

563 total views, no 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

660 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

612 total views, no views today