Archive for the ‘Java Core’ Category

How to install multiple JVM in Linux

jvm
1.Verify your current java version #java -version java version "1.4.2" gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 2.Then use alternatives command to display existing java NOTE:alternatives command used to maintain symbolic links for determining default commands Full story

How to convert string date to sql date in java using java.util.Date

Java Logo
public class stringToSqlDate { public static void main(String args[]){ String strDate="17/12/2010"; java.util.Date dt=new java.util.Date(strDate); java.sql.Date sqlDate=new java.sql.Date(dt.getTime()); System.out.println(sqlDate); } Full story

How to read mpg file from jar file and copy that file in to a temp location

playing mpg in java
In the above example i want to read bailey.mpg from my jar File named Entrance_Guide.jar located in /root/NetBeansProjects/Entrance Guide/dist/Entrance_Guide.jar.The bailey.mpg file located in FlashFiles package. So to read that file from jar i used the below code. Full story

Cloning in java

Java cloning
Two types 1 Shallow Cloning - If a arrayList contained object to be cloned with listObject.clone() results shallow cloning only eg. List<String> listObj = new ArrayList<String>(); Object obj = listObj.clone(); 2 Deep cloning - Achieved by writing with ObjectOutputStream ( Serialization ) and deserialize that object to be a deep cloned object. Full story

Creating a tree dynamically in java

JTreeActionListener
The following code is used to create a Tree dynamically. Here getTreeStructure() function returns DefaultMutableTreeNode. Here i uses a MyRenderer class which extends DefaultTreeCellRenderer. DefaultTreeCellRenderer defines the requirements for an object responsible for "rendering" (displaying) a value. Full story

Compile and running java program using bat file and cron tab scheduler

java
For compile and running a bat file in command prompt open command prompt cd C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\fi_sh\WEB-INF\classes then step 1: set java home as below set JAVA_HOME="C:\Program Files\Java\jdk1.5.0" Full story
Copyright © 2012 CoreTimer.com|System Admin’s Reference. All rights reserved.

Switch to our mobile site