ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How To Run A Java Program In Command Prompt Windows 10

Updated on October 17, 2015
Source

Welcome to the world of programming new programmers and hub readers. To make some ground I am starting with ‘C’ language which changed the world of programming altogether. Before ‘C’ , many language has come, but the acceptance and popularity that ‘C’ has got is unimaginable.

C Programming Language Importance

It was invented by Dennis Richie in Bell Laboratory. Although many languages come after ‘C’ but ‘C’ is still used by number of companies and programmer. As the complexity of programming increased, C++ came with its object oriented programming feature. Object oriented programming means to see the all real world things like car, dog etc in terms of object.

As 1990 came, due to internet revolution C++ seems limited to the programmer because it can’t be used for website development. This has set the stage for JAVA.

Java Programming Language Origin

JAVA is first invented in 1991 by groups of programmer like Patrick naughton, Ed frank, Jonathan Payne. Later many people contributed to the development of language .JAVA is the first full object oriented programming language. JAVA is the programming language that is used in any platform whether it is window or Linux or Lion os x.

It is the programming language that is used in website programming, embedded programming and in mobile programming also. Android mobile operating system which is almost used in all the mobiles today, is based on the java platform. After that net. came from Microsoft which followed java object oriented feature.

Presently java and .net is the most popular programming language.Other software like PHP,Ruby on rail,joomla language are also there which are invented in later part of 2000.

In this tutorial, we are running program in Microsoft latest operating system window 10.For new users in Java world, first java program is very important. Here is the HelloWorld Java program for beginners.

1. First write this program in your notepad.

Writing Java Program In Notepad

class HelloWorld
{
  public static void main(String args[])
  {
     System.out.println("Hello World java");
  }//end of main
}

Java Program Detail

Now any program in JAVA starts with class. After class, There is name of class. public is specifier and static is used to run program right out of box. Void keyword is used as we are not returning anything from main function. String args is argument for the function main.

Buy Java the Complete Reference From Amazon

Java: The Complete Reference, Ninth Edition
Java: The Complete Reference, Ninth Edition
Java complete reference is the basic book for beginners in Java world.Many experts recommend.It teaches you java in very simple language with lot of examples.
 

2. Oracle company provides you with java toolkit named JDK 8.This toolkit contain all the jar files. Jar files is collection of 2 or more java programs. When these programs are bundled together, they are called jar files.

These are jar files are required for compiling and running any java program.It also contain the file called Javac and Java exe for compiling and running the program respectively.

Although there are number of book to learn java in the market,but for beginners the best book for learning java is "Java the complete refrence".All over the world ,it is most read book for java beginners.

3. First of all, we will compile this java program. So save your this program in C drive in folder named Test. Save this program with the name of class HelloWorld. So the file name will be HelloWorld.java c:\\First\Helloword.java.

4. Open your cmd(command prompt)window by typing in window 10 search box.

5.When it will open .Type c:>cd Test in cmd window

Source

Compiling The Java Program

6. Now type set path after First command like this c:\Test> set path=C:\Program Files (x86)\Java\jdk1.8.0_51\bin.;.Using set path we are pointing toward javac compiler which will compile our java program.By we don't have to change system properties.

Source

7.Now type like this in cmd c:\Test>javac HelloWorld.java and press enter.Programme will be compiled.

Source

Running The Program

8.After compilation .The file generated will be HelloWorld.class file which contain unrecognizable with 0,1 combination.It is called bytecode in java language.

Now type in like this in cmd window

c:\Test>java Helloworld

Source

9. After compilation and running the java program,our program will give the following output.

Core Java: Fundamentals
Core Java: Fundamentals
Core java volume 1 is in competition with complete reference java.It is the most basic book for java programmer.It builds your foundation in the very simple language.This the latest edition so you will get java update here.
 
Source

Here a video where you can see that how java program is run in window 7 and 8 operating system.Steps are same as in window 10 OS.

So now you learned that how to run java program in command window of Window 10 OS.Practice more to run every java program in this way. After that, you can shift to some good Java editor like eclipse or JBuilder where it is easy to write, compile and run the program. Happy programming to all.


Java Poll

Which Operating Sytem You Use Preferably To Run Java Program?

See results
working

This website uses cookies

As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://corp.maven.io/privacy-policy

Show Details
Necessary
HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
LoginThis is necessary to sign in to the HubPages Service.
Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
AkismetThis is used to detect comment spam. (Privacy Policy)
HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
Features
Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
MavenThis supports the Maven widget and search functionality. (Privacy Policy)
Marketing
Google AdSenseThis is an ad network. (Privacy Policy)
Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
Index ExchangeThis is an ad network. (Privacy Policy)
SovrnThis is an ad network. (Privacy Policy)
Facebook AdsThis is an ad network. (Privacy Policy)
Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
AppNexusThis is an ad network. (Privacy Policy)
OpenxThis is an ad network. (Privacy Policy)
Rubicon ProjectThis is an ad network. (Privacy Policy)
TripleLiftThis is an ad network. (Privacy Policy)
Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
Statistics
Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
ClickscoThis is a data management platform studying reader behavior (Privacy Policy)