Programming Shortcut

Write, Run and execute Your programs with simple and esay way by Programming Shortcut

Wednesday, May 29, 2019

how to set path in java in windows 10

If you have decided to learn an object oriented programming language like Java, you might be exited and want to start right away. In this article I will show you how to make your first simple program and run it on your computer.

You need 3 things:

A compiler
A good self-study book or a course
Persistence
There are three editions of Java. SE, ME and EE. You want the SE which is Standard Edition. The others are Mobile Edition and Enterprise Edition.

After you have downloaded and installed the JDK, you need to make one small change in your PC settings. You want the compiler to be accessible from the command prompt.

To do that you have to add the location of the program files to the PATH variable.

1: Click Start → Control Panel → System ( assuming you use Windows 10)

2: Click Advanced → Environment Variables.

3: Find the location of the bin folder in your installation. You can do this by using the Explorer. It's a good idea to copy the path from there. It might be: "C:ProgramsJavajdk1.6.0_23bin"

4: Add the location to the PATH variable. You probably already have a PATH variable, so choose Edit for that one add a semicolon in the end and the location you copied in step 3

You can test if it is working by opening a command prompt and type JAVAC. This should make the compiler run. Since you did not give a file names as parameter, it just shows you the help file.

Now that you have the compiler working, it is time to make your first Java application. Open notepad or any other simple text editor and type in the following text exactly like shown here.

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

Then save the file as "HelloWorld.java" in the folder where you want to keep you Java projects. Make sure you don't save it with the.txt extension, even thou it is a text only file.

Go back to your command prompt and type:

javac HelloWorld.java

This will tell the Java compiler to translate the file you just made. If there is no errors you will now have a file called "HelloWorld.class". This is the byte code version of your program. It cannot be run as you would do with an executable program file. Instead you need the Java interpreter. You can test your program with the
command:

java Helloworld

Note that you don't need the.class extension. You should now get the output from your program:

Hello World!

Congratulations! You have now made and tested your first Java program. I recommend you also try to make a small change, to get a feel of how things work. Of course it is difficult now, as most of the code don't make much sense when you don't know Java yet. But you can change the text between the quotation marks to make the program print a different text.

Programming Shortcut is collections in java best programs with example, best c programs with example and best c++ programs with example, best way to learn java, c and c++

About Programming Shortcut

This is a programming learning website that can help you learn and when your write your programming code. And all programming code is compiled run programming code in the following programming language C, c++, Java, php and Javascript Languages. find your programming read, understand the programming then copy and past and run your program and save your golden time to typing the program becuse you learn more in leas time. All Programming is codeing is ease to understand the programming