Wednesday, December 24, 2008
How to do I sum and print two numbers in Java Program
Tuesday, December 23, 2008
Storing java command output to text file.
The command is:
commandprompt>java GenerateLog >> UserFile.txt
here in the above example, java GenerateLog is the command to execute GenerateLog java file, and output will be dislayed on the console. But by providing the ">> UserFile.txt" at the end of it , the output will be directed to the file called UserFile.txt
By using the above command, a text file named UserFile will be stored in most probably c drive or in the current location
You can easily find this file.
Comment will be highly appreciated...
How do I configure User tools in editplus to compile and run java file
(Copy paste as it is)

First Java Program Example
Thursday, December 18, 2008
Example to setup first JMX MBean in WebSphere Application Server
Sharing with you all for your help, the link which provides details of setting up JMX with the examples.
http://www.ibm.com/developerworks/websphere/techjournal/0304_williamson/williamson.html
How to set Java Path to run Java Program
Please read my earlier post about How to install Java before setting the Java Path to compile java file.
Once you are done with Java Installation,Right click on the My Computer Icon of your desktop or if you dont have My Computer icon on your desktop then right click on the My Computer in File Explorer.
-> Select the Properties Item
-> Select the Advanced Tab
-> Click Envirnment Variables Button
-> Find path under System Variable section, select it and click edit button
-> It will open a pop up window , append %Java Installation Dir%\bin (make sure that before adding this value, you are placing a semicolon (;) and then appending the value. Semi colon is used as a separator between two different location in the Path Variable.) at the end in the Value field.
Note : %Java Installation Dir% means the folder where you have installed the java,but the path you have given upto bin folder under installed folder as it contains javac.exe (java compiler) and java.exe (executs Java )
Save your changes.
How to verify:
1.Open a command prompt
2. type java -version and press enter
if you are able to see some text on command prompt as
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
Means Java is installed properly and your pc environment path is set to compile and run a java program.
If you are unable to get the above mentioned text, please verify whether you set the Environment variable properly as well as check the location you provided.
I hope it will help you to understand how to set path in computer to run java program.
How to install Java on my machine
Before running any Java program you need to have the Java installed on your machine. Normally beginners gets confused with different terminologies used in Java such as jdk,j2se,jre,jvm etc..
JDK - Java Development Kit/ J2SE( Java 2 Standard Edition)
JRE - Java Runtime Envrionment
JVM - Java Virtual Machine
All the above three are different , but if you install JDK, you will get JRE and JVM, if you install JRE , you will get JVM by defualt.
I tried to clear the concept so that before installing it may be bit less troublesome while installing Java for the first time.
About installing.. If you are installing Java on your machine for the purpose of writing code then you have to install the Java Development kit (jdk) , latest version will be good.
You can download JDK(1.5) from this location :
http://java.sun.com/javase/downloads/index_jdk5.jsp
After downloading , just double click on the exe file, which you have downloaded .
It will ask for the location where to install the software( by default it takes C:\Program Files), its upto your choice where you want to install it.I normally install in a separate folder as some times during the path setup on my machine , i was forced to modify the folder name C:\Program FIles to C:\Progra~1 as due to space in the folder name, PC unable to find the installed location.
Thats it.. wait till the installation is complete.