-4

I have source code for QR code generation using Java.

I don't know how to run Java in command prompt.

two jar files

E:\QR Code\lib\core-2.2.jar

E:\QR Code\lib\javase-2.2.jar

Java code path

E:\QR Code\src\com\javapapers\java\QRCode.java

Source code

http://javapapers.com/core-java/java-qr-code

Explain me how to run the java in command prompt

Regards Karthikeyan K

Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202
  • Did you [google](https://www.google.com/search?q=how+to+run+the+java+in+command+prompt&oq=how+to+run+the+java+in+command+prompt&aqs=chrome..69i57j0l5.439j0j7&sourceid=chrome&es_sm=93&ie=UTF-8)? – Codebender Jul 24 '15 at 09:33
  • possible duplicate of [Java - Build and run eclipse project from command line](http://stackoverflow.com/questions/5441565/java-build-and-run-eclipse-project-from-command-line) – Subodh Joshi Jul 24 '15 at 09:50
  • Anyone Know the Answer? – Karthikeyan Jul 25 '15 at 02:48

1 Answers1

0

To make sure that Windows can find the Java compiler and interpreter:

  1. Select Start -> Computer -> System Properties -> Advanced system settings Environment Variables -> System variables -> PATH. ...

  2. Prepend C:\Program Files\Java\jdk1.6.0_27\bin; to the beginning of the PATH variable.

    Click OK

Then open command prompt and check if Java path setup done by below command

java -version

If everything ok it will show you which Java version you have installed .

then you can run java program Like below a example

C:\test> javac HelloWorld.java

I have test folder and it have HelloWorld.java file inside it after this

C:\test> java HelloWorld

It will give you output in my file i have added below content

public class HelloWorld{
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202
  • I done those things. Please explaing all the steps?. Microsoft Windows Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\addcuser.MIN06100470LD01>java -version java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode) java version "1.8.0_51" Java(TM) SE Runtime Environment (build 1.8.0_51-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode) – Karthikeyan Jul 24 '15 at 09:32
  • Please dowload the code from that web and execute using command prompt. And send me the screen shot. http://javapapers.com/core-java/java-qr-code – Karthikeyan Jul 24 '15 at 09:37
  • Problem is i am new to java. – Karthikeyan Jul 24 '15 at 09:38
  • Its not a problem you are new..problem is that you did not tried anything from google? – Subodh Joshi Jul 24 '15 at 09:39
  • Boss this is simple example. Ok. I mentioned above example is have 2 . jar file that is the problem – Karthikeyan Jul 24 '15 at 09:40
  • Then you are not confirm what you have to ask? Because if u r making a new project then these 2 `jar` you have to put in `lib` folder of your project then you can use its classes. – Subodh Joshi Jul 24 '15 at 09:43
  • ya ya. I created the project and used class. Its working in eclipse. I want to run in command prompt. – Karthikeyan Jul 24 '15 at 09:45
  • http://stackoverflow.com/questions/6153057/how-to-run-a-java-project-in-command-line – Subodh Joshi Jul 24 '15 at 09:47
  • another option create jar file of your project and then run from command prompt `java -jar yourproject.JAR` – Subodh Joshi Jul 24 '15 at 09:49
  • Thanks for your help. I am working in SAP ERP. So can't run jar file directly. Please download and execute this code and send me the command prompt screenshot plz http://javapapers.com/core-java/java-qr-code – Karthikeyan Jul 24 '15 at 09:54
  • @Karthikeyan how will you learn ? It easy search and do it. I am not free sorry – Subodh Joshi Jul 24 '15 at 09:56
  • boss last 2 days I done the code in eclipse. still no idea in command pormpt. Please help me – Karthikeyan Jul 24 '15 at 09:58
  • you have already project in eclipse make its jar and run it http://stackoverflow.com/questions/5441565/java-build-and-run-eclipse-project-from-command-line – Subodh Joshi Jul 24 '15 at 10:16
  • We have interface in SAP to JAVA via command prompt. in that interface jar file not working. Already i tried .jar file. SAP ERP have some restriction. – Karthikeyan Jul 24 '15 at 10:35