How java runs in command prompt and why java runs on it

how java runs in command prompt and why java runs on it

command prompt was used before the development of IDEs like RAD,eclipse etc.
its still used for better understanding of the compilation and errors.
type the java file and save the file(source file) in the bin folder of ur jdk environment with extension .java. the source file must be the one that has the main method declared.
in the cmd prompt screen , set the path of bin folder.
eg:C:/program files/jdk(some version)/bin/...
for compilation,type:
javac (source file_name).java and press enter
for running the file:
java source file_name

Similar Messages

  • How to run a command prompt " command " through java code

    hi all,
    There is a command
    "java -jar selenium-server.jar -interactive"
    which i am running through command prompt after going to D:\MyFolder\Examples .
    i want to execute this command using java code .please help

    This has already been answered in your other two threads on this topic - http://forum.java.sun.com/thread.jspa?threadID=5221221&messageID=9898287#9898287 and http://forum.java.sun.com/thread.jspa?threadID=5221223&messageID=9898290#9898290.
    For some reason you don't want to read the reference that tells you exactly how to do what you want and how to avoid the pitfalls - http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .

  • How to use addKeyListener in a program running using command prompt

    Does anyone have any idea how to add the addKeyListener to a program running using command prompt.
    Let me explain how the program run.
    The program is start and accept call from other program. But from time to time, I need to issue some command by pressing the keyboard, let say, ESC is closed the program, F1 is showing the stated. F2.... (This is all need to run in the command prompt windows)
    My problem is this program does not have any gui interface, so how can it be added?
    i do it this way
    public void key(){          
    addKeyListener(this);
    But it have compile error.
    mainServerImpl.java:87: cannot resolve symbol
    symbol : method addKeyListener (mainServerImpl)
    location: class mainServerImpl
    addKeyListener(this);
    I did implement KeyListener. But just don't know how to solve this error.
    can anyone tell me how to solve it or point me a source that can help.
    Thank in advance!
    Regards,
    Tai Tan

    Write your own Thread, to do this:
    public class KeyThread extends Thread {
       public void run {
          while(true) {
             int i = System.in.read();
             if(i == 123) {
                break; // to stop the thread
    // in your main:
    Thread keyThread = new KeyThread();
    keyThread.start(); // calls run() of the thread

  • Running command prompt externally from Java

    Hi,
    Does anyone know how to make a Java program that opens up the command prompt and runs certain commands? Thanks,
    Adam

    Read this before you use it:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Running eclipse java project on command prompt

    Hi all,
    I have one simple java project and that is very well running in eclipse. I have added some external JARs to that project. It performs this job- it creates connection to server, and listens to the signals from server.
    My question is - how do I run that java project on command prompt?*
    I want to run that using ANT or simply I want to make a JAR file so I can execute JAR on command prompt. I created JAR, but it doesn't contain external jar which I added to the project. So I was not able to run that project.
    Can you please tell me any of the method - using ANT or by making JAR?
    Also can you be little bit more explanatory in reply?
    Thanks

    I want to make a JAR file so I can execute JAR on command prompt.This is very likely a good way to proceed. It is explained in great detail in Sun's Tutorial in the section on [Packaging Programs in JAR Files|http://java.sun.com/docs/books/tutorial/deployment/jar/index.html].
    I created JAR, but it doesn't contain external jar which I added to the project. So I was not able to run that project.Yes - the jar file you create has to know about the classes and other resources in that external jar. Otherwise, at runtime, the program will not be able to get at the stuff it needs. Usually you don't include that other jar (or its contents) in the jar file you are creating. Instead you provide your jar file with a manifest that describes the other jar's location. Details are also in the tutorial.
    One thing to note is that Sun's tutorial provides a lot of explanatory, conceptual, material. To that end it keeps the context simple and transparent by describing the steps as they would be carried out by someone working at the command line. The Eclipse documentation and forums might provide a more click-this-drag-that "explanation". If you do follow the method in the Tutorial and get stuck, post a description of the actual commands you used and their outcome.

  • How can we write the code for opening the command prompt and closing the

    how can we write the code in java for opening the command prompt and closing the cmd prompt from eclipse (cmd prompt should close when click on the turminate button in eclipse)

    rakeshsikha wrote:
    how can we write the code for opening the command prompt and closing theBy typing in Eclipse (which you seemingly have)?

  • HELP FOR RUN PHOTOSHOP IN COMMAND PROMPT AND OPEN FILE

    HELLO
    i have problem for run photoshop in cmd(command prompt) and
    open a file immediate
    for example:
    D:\Program Files\Adobe\Photoshop CS>Photoshop.exe -open -f:\1.jpg
    but these not answer
    I need parameter open in photoshop
    please help me
    thanks

    I would right click on 1.jpg. Select Open with... Select Choose default program... Pick Photoshop and make sure you check "always use the selected program to open this kind of file."
    D:\1.jpg
    Would then open photoshop.

  • Is it possible to run a command prompt(or DOS Command) through flash and run a Activex(.OCX) file from flash

    Hi all
        Is it possible to run a command prompt(or DOS Command) through flash.If it possible please guide me to do that throug AS 3.0.
       and
    Is it Possible to run a activex (.OCX) file from flash. If it is so please guide me the way to do it
    Thanks and Advance
    Sankar.M.S

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

  • Is it possible to run a command prompt(or DOS Command)  and Activex File(.OCX)

    Hi all
    Is it possible to run a command prompt(or DOS Command) through flash.If it possible please guide me to do that throug as 2.0. and is it possible to run a Activex File(.OCX) through flash.
    Thanks and Regards
    Sankar.M.S

    Or create a desktop shortcut (in Windows) or an application launcher ( in Linux GUI).

  • How to clean up my mac and make it run faster

    I want to know how to clean up my mac and make it run faster.. seems very bogged down lately and doesnt do stuff very fast anymore..

    macworld.com/mac-troubleshooting-what-to-do-when-your -computer-is-too-slow.
    Basically... Make sure you have enough Free Hard Drive space for your Mac to Perform as expected...
    This is what Apple has to say.
    http://support.apple.com/kb/PH10798
    More Info Here...
    ds store  >  Why is my computer slow?
    Thomas A Reed  >  Mac Performance Guide
    To keep your Mac Happy... See Here...
    http://support.apple.com/kb/HT1147
    http://www.thexlab.com/faqs/maintainingmacosx.html
    Mac OS X: About background maintenance tasks

  • How to execute a Command Prompt command from J2SE code executing on Windows

    How to execute a Command Prompt command from J2SE code executing on Windows??
    Please help me

    [http://java.sun.com/docs/books/tutorial/getStarted/]
    ~

  • SignTool.exe verify /pa returns exit code 1 from the code but works fine while running from command prompt

    Hi,
    I am using SignTool.exe from a new Process() to verify a codesigned assembly and it returns the exit code 1 whereas it returns exit code 0 while i run the same from Visual Studio Command prompt. Please let me know your thoughts...
    Here is my code snippet from VS2012 ultimate on Win7 PC.
    p = new Process();
                p.StartInfo.FileName = "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\SignTool.exe";
                string args = @"verify";
                p.StartInfo.Arguments =  args + " "+ "/pa " + "/v "+ name;
                p.Start();
                p.WaitForExit();
                pexitcode = p.ExitCode;
    //name = "C:\\Users\\v-maparn\\Documents\\Visual Studio 2012\\Projects\\CodesignVerification\\CodesignVerification\\bin\\Release\\Microsoft.IT.Core.dll"
    Thanks,
    Mani

    Hi Amy,
    Thanks for your reply. I am receiving the exit code 1 by the Process even though the SignTool is able to successfully verify the assembly. I ran the below command from command prompt and received no errors or warnings. I assume the exit code should be 0.
    I have also verified that this assembly has digital signature embedded as you can see from the output.
    output:
    C:\Windows\system32>signtool.exe verify /pa /v "C:\Users\v-maparn\Documents\Visu
    al Studio 2012\Projects\CodesignVerification\CodesignVerification\bin\Release\Mi
    crosoft.IT.Security.UI.SystemSecurityManagement.SSMUIWebHost.dll"
    Verifying: C:\Users\v-maparn\Documents\Visual Studio 2012\Projects\CodesignVerif
    ication\CodesignVerification\bin\Release\Microsoft.IT.Security.UI.SystemSecurity
    Management.SSMUIWebHost.dll
    Signature Index: 0 (Primary Signature)
    Hash of file (sha1): 1B58113B218260837A6B850561538A804B034F2A
    Signing Certificate Chain:
        Issued to: Microsoft Root Certificate Authority
        Issued by: Microsoft Root Certificate Authority
        Expires:   Sun May 09 15:28:13 2021
        SHA1 hash: CDD4EEAE6000AC7F40C3802C171E30148030C072
            Issued to: Microsoft Code Signing PCA
            Issued by: Microsoft Root Certificate Authority
            Expires:   Mon Aug 31 14:29:32 2020
            SHA1 hash: 3CAF9BA2DB5570CAF76942FF99101B993888E257
                Issued to: Microsoft Corporation
                Issued by: Microsoft Code Signing PCA
                Expires:   Thu Apr 24 14:33:39 2014
                SHA1 hash: 108E2BA23632620C427C570B6D9DB51AC31387FE
    The signature is timestamped: Mon Dec 30 02:58:12 2013
    Timestamp Verified by:
        Issued to: Microsoft Root Certificate Authority
        Issued by: Microsoft Root Certificate Authority
        Expires:   Sun May 09 15:28:13 2021
        SHA1 hash: CDD4EEAE6000AC7F40C3802C171E30148030C072
            Issued to: Microsoft Time-Stamp PCA
            Issued by: Microsoft Root Certificate Authority
            Expires:   Sat Apr 03 05:03:09 2021
            SHA1 hash: 375FCB825C3DC3752A02E34EB70993B4997191EF
                Issued to: Microsoft Time-Stamp Service
                Issued by: Microsoft Time-Stamp PCA
                Expires:   Wed Feb 11 14:11:31 2015
                SHA1 hash: D967AB4CF991F11DA6E318C880F1AF1A9C8D2C7C
    Successfully verified: C:\Users\v-maparn\Documents\Visual Studio 2012\Projects\C
    odesignVerification\CodesignVerification\bin\Release\Microsoft.IT.Security.UI.Sy
    stemSecurityManagement.SSMUIWebHost.dll
    Number of files successfully Verified: 1
    Number of warnings: 0
    Number of errors: 0
    C:\Windows\system32>
    Thanks,
    Mani

  • Using Java in windows command prompt

    Hi,
    I don't know if I have been searching correctly, but I haven't found a solution to my problem through common search engines.
    I'm programming in java using vim (accessed through windows command prompt), and I've created classes, everything compiles fine.
    However, I wanted to test my classes my creating instances of them (i.e. objects) through the same windows command line (command prompt). I know you can achieve this by using interaction panes through third party programs such as Dr.Java and eclipse, but I was wondering if this can be done using the command line.
    Thanks
    Jaime

    Thanks Paulcw for your quick reply! :D
    I'm guessing I didn't word my question properly.
    Neither of my classes have a main method in them, so when I am trying to create instances (objects) of them, I would like to as if my command line was the main.
    For example:
    Class1 c = new Class1(parameters);
    c.moveRight();
    etc.
    I'd like to be able to use my classes methods from the command line, I think what I'm looking for is a batch, but I'm not sure.
    Thanks again,
    Jaime

  • I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    You need iTunes 10.0 or greater to update your phone...iTunes isn't confused at all. If you're on a Mac, you'll need OS X 10.5.8 or greater to update iTunes to 10.0 or greater.

  • I installed iOS 7 and it deleted some of my contacts, as expected, so I just resaved them all. There's one particular number that will save but in my messages, it shows up as the number instead of the name saved. How do I fix it? And why is it doing that?

    I installed iOS 7 and it deleted some of my contacts, as expected, so I just resaved them all. There's one particular number that will save but in my messages, it shows up as the number instead of the name saved. How do I fix it? And why is it doing that?

    I had this problem too, I fixed it by going to my settings and under general at the bottom there is a reset option, go there. One of the options should be reset network settings, select that one. I’m not sure why it happens but that worked for me; hope you have the same luck!

Maybe you are looking for

  • To download the Output of ALV to Excel file with Marco

    Hello Masters , I m working on a ALV report in which either we can see the output or can download the ouptput and format that file before sending by mail.. the following steps are currently used to download and format the ALV output . 1. Save file fo

  • Application sound

    how do you put sound and music on an application (not applet). where should i store the music files also.

  • Can't  delete or re-deploy a HFM applicarion in EPMA

    Hi, I have a problem, that after successful deployment of HFM application I can't delete or re-deploy that application. "Delete" and "deploy" buttons are inactive. Application status - Deployed. Application is registered in Shared Services applicatio

  • Trouble creating a favorite in Adobe Audition 6.5

    I'm trying to create a favorite in Adobe Audition 6.5 but I keep getting an error message that a favorite is already in the process of being created and that I need to stop recording the current one and start again.   So I got to "Favorites" and then

  • Access SAP database table from different SAP server

    Hi, May i know is that possible to access the SAP database table from server A to server B without write a program on server A? Is it possible for direct access the SAP database table. Best regards, Gan