Monday, December 26, 2011

How to run Java program using command prompt in Windows 7

How to run Java program using command prompt in Windows 7?

Step 1: Install JDK (Java Development Kit) version 1.6.0_24 will work properly to my knowledge, if u have any other version working good then no issues. This is a link to get JDK

Java Platform, Standard Edition Development Kit (JDK 6 Update 23).

Now the java will be installed in C:\ drive program files, u will get path say example C:\Program Files\Java\jdk1.6.0_23\bin

Step 2:

Now we have to add the Java interpreter and compiler to system environment variables by following procedure Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables -> PATH. Edit the path and prepend C:\Program Files\Java\jdk1.6.0_23\bin; to the beginning of the PATH variable and click OK for 3 times. You may also need to reboot for the environment variable change to take effect.

YUP!!!!!!!!! Ur system is ready to run java programs.

Step 3: Create a folder lie myjava, mywork, javaprog etc.., then write a short program like HelloWorld in a notepad and save as HelloWorld.java but not as *.txt file save it as Any file.

Example : public class HelloWorld

{

public static void main(String[] args)

{

System.out.println("Hello, World!");

}

}

Save the note pad with the same name of the public class. [ above program cannot be saved as helloworld, it will not run because java is case sensitive]

Step 4: open command prompt check for java version

C:\Users\Username>java –version {it will show version of java installed eg: java 1.6.0_24 and some stuff}

C:\Users\Username>javac –version {it will show version of java installed eg: javac 1.6.0_24}

Now change directory to folder u created and saved java file in it.

C:\Users\Username>cd\

C:\>

C:\cd myjava

C:\myjava>

C:\myjava>javac HelloWorld.java {compile the program)

If there r no errors then u won else read, think and resolve errors.

C:\myjava>java Helloworld {run the program}

Hello !!! World.

Note:

check and install exact version.

Edit environment variable path and restart the system to take effect.

Save program with class name bcoz it is case sensitive.

Installing and run perl on windows 7


Go to www.perl.org/get.html and download the Perl software suitable for your system requirements. My system is Windows 7 Home Premium (64 Bit), so i am selecting windows ActiveState Perl.
You will get http://www.activestate.com/activeperl/downloads in another tab. as shown below
I have downloaded Download ActivePerl 5.14.2 for Windows (64-bit, x64)
After saving run it by double clicking
Go on clicking NEXT
Both option should be selected it reduces the overhead of updating PATH manually.
Click on INSTALL then wait a while it will take some time to finish

for more information watch this you tube video
Start -->Control Panel --> System --> Advanced system Settings --> Environmental Variables --> System Variables --> PATH --> Edit --> Append C:\Perl64\bin --> OK --> OK (optional) RESTART the System to make path effective.
Open a notepad and type
$p = “I am Perl”;
Print $p;
Then save file as .pl and the type must be Any file”.”
Then open command prompt and goto the perl script location and type
perl .pl
I am Perl and this is ur output.