how to run a java program

Asked by Last Modified  

20 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Training Centre

Two ways you can run a Java Program. 1- Through cmd prompt, 2- Through Eclipse. 1- cmd prompt (Write your program and save the file with .java extension. Now open your cmd prompt and give the java file location. (a)- Now type the command "javac yourfilename.java" and click on ENTER button. This will...
read more
Two ways you can run a Java Program. 1- Through cmd prompt, 2- Through Eclipse. 1- cmd prompt (Write your program and save the file with .java extension. Now open your cmd prompt and give the java file location. (a)- Now type the command "javac yourfilename.java" and click on ENTER button. This will compile the program and checks whether you have syntax error. (b)- Now type the next command "java className" and click on ENTER button. Now the program will run. 2- If you are running in Eclipse. Just click on the RUN button at the topmenu. read less
Comments

Java "name of your class which contains your main method" Example : java sample Note : you need to compile before you run your program (javac filename.java)
Comments

G Chandra babu

If you java beginer just user Notepad or EditPlus editor to write a java program just follow the bellow steps to compile and run a java program steps: 1. develop/ write java code that contain main method 2.save the program as "anyfilename.java"....Note*: you should save with extension of...
read more
If you java beginer just user Notepad or EditPlus editor to write a java program just follow the bellow steps to compile and run a java program steps: 1. develop/ write java code that contain main method 2.save the program as "anyfilename.java"....Note*: you should save with extension of file ".java" 3.open command prompt and change location of developed java program area 4.here just complie the java program using javacompile syntax for compiling: c:\>javac anyfilename.java (press enter) java compliler is successfully compiles the program 5.Now run the compiled program using "java interpretter program" sysntax for running a java program using "java interpretter program" c:\>java anyfilename (press enter) 6.now output of the program is shown on your console. Hope this article help you understand how to compile and run a java program. if you like the article please like read less
Comments

Software Developer, Expertise in Java/J2ee Technology.

In command prompt, go to java program file location : a.) Compile via command :- javac FileName.java b.) Run via command :- java ClassName Note : FileName is name of java file, which can contain one or more classes. ClassName is name of one of the class in file ie class which...
read more
In command prompt, go to java program file location : a.) Compile via command :- javac FileName.java b.) Run via command :- java ClassName Note : FileName is name of java file, which can contain one or more classes. ClassName is name of one of the class in file ie class which is needed to run ( usually class containing main() method ). read less
Comments

Computer Science Tutor

go to command prompt then write the following-- For compilation: javac filename.java then press enter For run: java classname then press enter
Comments

Hello Prem Kumar :-). Here is a complete detail of how to run Java Program with other information which is as follows: Java and the Windows Command Prompt ****************************************** This document instructs you on how to use the Windows Command Prompt with Java. These instructions...
read more
Hello Prem Kumar :-). Here is a complete detail of how to run Java Program with other information which is as follows: Java and the Windows Command Prompt ****************************************** This document instructs you on how to use the Windows Command Prompt with Java. These instructions are specialized to Windows 7, but are similar for Windows... more» read less
Comments

Java/J2EE, B.E./B.Tech/MCA SubjectsTraining

Simpler way is to use Eclipse editor you don't need to compile it.
Comments

under the installation folder for Java(inside Program Files) there are java binaries under the folder named bin, this folder has all the required binaries to execute, compile,create rmi stubs and skeletons etc commands.So firstly make sure that you modify the PATH variable of your computer to point to...
read more
under the installation folder for Java(inside Program Files) there are java binaries under the folder named bin, this folder has all the required binaries to execute, compile,create rmi stubs and skeletons etc commands.So firstly make sure that you modify the PATH variable of your computer to point to this bin folder, then open the command prompt take it to the folder location of your java program and run javac command followed by your file name with dot java extension...this will generate the necc class files and then run the java command followed by the name of your file without the dot java extension.The same thing can be done easily in Eclipse IDE the only difference is Eclipse does the javac and java command on your behalf. read less
Comments

Teacher

Either run it through cmd or use an IDE like Eclipse
Comments

Software Developer and Trainer with 10 years of experience

You can run a java program either using any IDE(Integrated Development Environment) like Eclipse or Netbeans or simply through the Command Prompt. As you seems to be beginner, I discuss only about running it in command prompt. First, type your java program in any plain text editor like notepad and...
read more
You can run a java program either using any IDE(Integrated Development Environment) like Eclipse or Netbeans or simply through the Command Prompt. As you seems to be beginner, I discuss only about running it in command prompt. First, type your java program in any plain text editor like notepad and save it in a folder. While saving, name the file by the class name that contains the main function in the program. Save it with .java extension. Before running the program, you have to install Java Development Kit (jdk). Also you need to set the java environment variable. Next, you have to compile your program. To do so, use the "javac" command. Type javac filename.java to compile. If you encounter any errors, clear it and recompile again. Once the compilation is successful, a filename.class file will be created in the same folder where you have stored your .java file. Now your program is ready to run. To run your program use "java" command. Type java classname (same as filename). Now your program will be executed. Hope this will help you . . . Wish you to execute successfully . . . read less
Comments

View 18 more Answers

Related Questions

How to stop session hijacking programmatically ?
HTTP is a stateless protocol. In order to track users, web applications rely on server side sessions. Two basic ways to link clients(usually browsers) to sessions are through URL rewriting and HTTP cookie....
Mnaohar S
What is an MVC and why is it important?
MVC (Model-View-Controller) is a software architectural pattern that separates an application into three interconnected components: 1. *Model*: Represents the data and business logic, managing data...
Kirti
0 0
5
Is JAVA training only for technical students or a non-technical student also may join?
Any Body can Learn Programming Language.It All depends upon the learning of basics and all.Basics actually makes the thing different.
Vikrant
0 0
6
hat is java
Java is high level programming language. Java is platform independent and robust.
Narendra
0 1
8

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Java Advantages
In this video, learn about Java and its advantages. Also, check out the difference between Java and C++, Java development kit, Java Run Time Environment (JRE) with a proper demonstration program for better clarity.

Class, Object and Methods in JAVA
Lesson-1: Class, Object and Methods of Java can be compared with body, heart and brain. Without these 3 things, Java does not exist. If you Google the above 3 items, you will find many definitions. But...

Easy way to remember Java keyword.
ACCESS MODIFIER ACCESS SPECIFIER abstract, assert, const, final, native, static, strictfp, super, synchronized, this, transient, void, volatile public, private, protected, default DATA...

Rohit Deshbhratar

1 0
0

Method Overloading vs Method Overriding
1. Method Overloading: Method overloading means a same method with same name can have different implementations/body by changing one of the follwing thing: 1) Number of Parameters 2) Order of Parameters 3)...

On the Job training is always best
On the job training always provides an opportunity to learn the best industry practices. While you work on real time you would encounter many challenges that will force you to learn many new things. Class...

Recommended Articles

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you