How to compile & run using command prompt

Hi all,
I have a java application consisting of 3 packages & a jar file in the following hierarchy:
-Project
-classes
-src
-package1
-package2
-package3
-file.jar
The main class exists in package2 and uses classes within file.jar
I want the steps to compile and execute the project using command prompt in windows such that the generated classes will be saved in the classes directory
Can anyone help?
Thanx in advance

Hey,
If your source(*.java) files are in src folder and ur currnet directory is project
and you want all your class files to be classes folder then you can try this :
c:\project>javac -cp src\file.jar -d classes\ src\*.javaAssuming that your file.jar file is in src folder.
The above command will set the classpath to src\file.jar (-cp src\file.jar)
-d classes\ - will generate all your class files with package hierarchy if any into classes directory.
src\*.java - specifies the files to be compiled.
Hope this helps.

Similar Messages

  • 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

  • How to run ODI scenario using command prompt

    Hi expets
    Please let me know if we can run ODI scenario using command prompt or any way other than operator.
    Regards
    Janakiram

    Go to <ODI_HOME>/oracledi/bin in command prompt and invoke startscen command with teh below parameters.
    Edited by: Guru Sankar on Feb 28, 2011 4:19 PM

  • 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

  • Running a Program in JDeveloper using Command Prompt

    Hi,
    I downoladed Oracle JDeveloper 10g. I had written a simple java class called Echo. java. I want to run the file using command prompt. My JDK has the following path:
    F:\Sowmya
    My java file has the following path:
    F:\Sowmya\jdev\mywork\1\1\src\pkg1
    So, in order to compile the file, I gave the following command:
    F:\Sowmya\jdk\bin>javac F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo.java
    It worked and the Echo.class file was created.
    But, when I tried to run the file using the following command,
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    Iam getting the following error:
    Exception in thread "main" java.lang.NOClassDefFoundError: F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    This didnt work either:
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\classes\pkg1\Echo
    Iam getting the same error.
    Can any one please help me regarding this.
    Thank you,
    Sowmya.

    Yes, my class contains a main. It runs if I click run in JDeveloper. But, there is no output displayed. The following is the code:
    public class Echo {
    public static void main (String[] args) {
    for (String s: args) {
    System.out.println(s);
    }

  • 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 .

  • Uninstalling bulk dll's from gac folder at one time using command prompt

    Hi All,
    I need to unistall bulk dll's at a time from the GAC folder using command prompt ,can any one suggest how to do this.

    Hi,
    1. Create a batch file as "Uninstall.bat".
    2. Edit this file and copy the below statements in it:
    gacutil.exe /uf DLL1
    gacutil.exe /uf DLL2
    gacutil.exe /uf DLL3
    gacutil.exe /uf DLL4
    gacutil.exe /uf DLL5
    replace DLL1 to DLL5 with your actual DLL names, which you want to uninstall.
    3. Open Visual Studio Command Prompt as Administrator.
    4. Browse to the location where you have placed the above batch file.
    5. Run the batch file.
    Hope this will help.
    HTH,
    Sumit
    Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

  • Can i login to essbase console by using command prompt

    Hi All,
    Is thr any possiblity to login in to essbase console by using command prompt
    normally we login to console and will give credentails and login as same way can we do from command prompt??
    Thanks in advance
    Regards,
    SM

    Hello ,
    You can check the login through the Essbase command utility.
    go to command prompt . type - essmsh
    then you will be able to see MaxL prompt
    enter the command login username password;
    you can use this utility to load data , import export running calc etc...
    Thanks,
    KKT

  • Using command prompt with Java

    I am trying to use command prompt within a java program and I can't figure out how to enter commands from java. I know how to start up command prompt but can someone guide me on a way to actually enter commands into the command prompt? Thanks.

    The Java� Tutorial - Lesson: Basic I/O
    ~

  • 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).

  • Using command prompt for help generating

    Hi all!
    Can I use command prompt for generating webhelp instead of
    RoboHelp HTML environment?
    thank you

    See this recent post.
    Click
    here.

  • How to install Java to compile Sevlets at command prompt

    Please help me to compile my java servlets at command prompt.
    I have buyed a new leaptop with windows XP service pack 2
    I have downloaded Java EE 5 SDK Update 4 (with JDK 6u5) for Windows, English
    I setted my path and classpath variable for bin and lib folder..
    I could not able to compile my servlet programs
    I am getting errors for all my servlet package classes and servlet.http. packages.........

    Hi Jeff,
    Follow the steps ...
    First you install JDK, it can be 1.2, 1.3, 1.4.
    Lets say you install it in c:\jdk13\ then c:\jdk13 becomes your Java Home Path.
    Edit your autoexec.bat using any editor. And add the Following Lines.
    SET CLASSPATH=C:\JDK13\SRC.JAR;C:\JDK13\LIB\TOOLS.JAR;C:\JDK13\LIB\DT.JAR
    These are the Jar files that need to comile and execute your Java Programs.
    Next add the JDK Binary executables folder in the Windows Path.
    Add this line to the end of your Autoexec.bat
    PATH=%PATH%;C:\JDK13\BIN
    The %PATH% Variable will append the Bin path to the existing path.
    Dont worry about the Case of the statements but dont Leave Spaces after in between after the PATH= Words in any of the above statements.
    Its reccomended to Restart your PC for these commands to take effect.
    Then write a Java Class and compile it with javac yourClass.java and then run it with java yourClass
    Hope this is clear enough.
    Regards ,
    Max

  • Pass commands to running program using command prompt

    I have a program written in core java.
    This program do not contain any gui. As this program is to start using shell script , there will not be a command prompt open. Now , after program is started , i need to give the commands like \q for exit, \w to open some action etc .....
    How can i pass these commands to that already running program.
    I expect in the following way-
    Open a command prompt
    Select a specific path.
    when i type \w and enter then the running program should do some action.
    Can any one help me?
    Program will be running on Linux.

    Stop cross-posting:
    http://forum.java.sun.com/thread.jsp?thread=512664&forum=31&message=2438136
    http://forum.java.sun.com/thread.jsp?thread=512663&forum=54&message=2438134
    http://forum.java.sun.com/thread.jsp?thread=512267&forum=422&message=2435704
    MOD

  • How to print pdf file in SQL Server Reporting services report using command prompt?

    Is there a way to automatically print a SQL Server Reporting services report on command prompt? For eg: We can save a pdf file using rs.exe utility. I want to print a pdf using rs.exe utility. Is it possible? I don't want to install any 3rd party software.

    Thanks Simon for replying to my question.
    In oracle form, there is oracle command to print the report from command prompt with the help of rwrun.exe
    e.g: rwrun.exe   REPORT="D:\Test\REP_25\MLA.REP" DESNAME="testprinter" DESTYPE="PRINTER" P_FORMNAME="MLA.FMX" P_SPRACHE="E" P_SPRACHE_NR2="1" P_WHERE_BEDINGUNG="order by land_nr" USERID="test/test.world" PSV_NAME="PSV_DEMO" PSV_JOB_ID="PS$9583" RECURSIVE_LOAD="NO"
    BATCH="YES" NONBLOCKSQL="NO" ARRAYSIZE="1" PARAMFORM="NO" ERRFILE="c:\temp\psv16.tmp"<
    and to save the report we just need to change DESNAME="c:\temp\OC_100001349.pdf" DESTYPE="FILE" in above command instead of DESNAME="testprinter" DESTYPE="PRINTER".
    DESNAME and DESTYPE are the input parameters of the respective report.
    In SSRS, we can run the file from the command prompt and save it.
    rs -i "C:\Users\pujarswa\Documents\reports\new\LoadReport.rss" -s ww2004760:80/ReportServer_MSSQL -v fileName="C:\Users\pujarswa\Desktop\TipsReportLoad.pdf"
    -v reportPath="/TipsReport/LoadListTabular" -t -v format="PDF" -v LandNr=4 -u ap\swati -p test@# -e Exec2005
    But we cannot use same command for printing as you said we need to create another script for printing files.
    I have gone through the links but I dont want to use Adobe Acrobat Reader exe for printing because client it may not have Adobe Acrobat Reader on their machine.
    Also I want to pass a input parameter as type="Printer" to my report which will print directly for me and same I can acheive in command prompt passing type="Printer" fileName="C:\Users\pujarswa\Desktop\TipsReportLoad.pdf"

Maybe you are looking for