UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

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

I want to Learn java. How do I start?
Start with Complete Reference book.
A
Which is better, PHP or Python? Why?
Python . Simple syntax,More readable,General purpose programming language
Kartheek
0 0
5
Sir tell me some tips to code in java?
If you know C / C++ already, just try how will you able to achieve same examples in java. I prefer try to understand the fundamental of java and create small programs, then make the connectivity among them. Slowly build an application.
Nitinkumar
What is difference between throw and throws in Java programming?
throw keyword is used to throw Exception from any method or static block in Java while throws keyword, used in method declaration, denoted which Exception can possible be thrown by this method
Vinodha

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

Ask a Question

Related Lessons

Facebook Analytics
Assume how the Facebook application will store the millions of customer's record in real-time: facebook = { 'jose': { 'name': 'jose', 'age': 33, 'hobby': , # cricket,football 'mobile': 1111111111, 'email':...

A Tip for the beginners.
The world of programming languages right now is too dense, and too big for any beginner. But at the same time, because of so many options available, it's easier too. You can start with any language that...

Puzzle Game coding
import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.Font;import java.awt.FontMetrics;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.RenderingHints;import...

Priority in TestNG
public class Priority { @Test (priority=1)public void login() {System.out.println("login");} @Testpublic void email1() {System.out.println("email1");} @Test (priority=-2)public void email2() {System.out.println("email2");} //I...
S

Sarthak C.

0 0
0

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
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more