How to compile and run package programs in Java

Hi,
I want to know how to compile and run the package programs in Java using -d. instead of creating the package folder manually.
eg:
package Test;
class test1
public void disp()
//Any code;
I want to compile this without creating the folder ' Test ' manually. that is if we use -d with javac the Test folder will be created automatically. I need the format of -d
could anyone please help me.
Thanks in Advance ,
Ambika

My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
I've given my pgm and the thing I've got when I compiled it.
Test.java
package com.cert;
public class Test
     public void display()
          System.out.println("Hai");
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
sed
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
Plz help me.
thanks in advance
Ambika

Similar Messages

  • How to  compile and run javacard program

    how to compile and run javacard program "HelloWorld"

    1. Where is save Servlet program?
    2. How to set classpath?
    3. how compile and run?
    http://www.coreservlets.com

  • How to compile and Run servlet Program

    Hi,
    pls help me the following doubt
    i am using Tomacat 4.1 server.
    1. Where is save Servlet program?
    2. How to set classpath?
    3. how compile and run?
    bye
    Mathi

    1. Where is save Servlet program?
    2. How to set classpath?
    3. how compile and run?
    http://www.coreservlets.com

  • How to compile and run a .java file from another java program

    hello,
    can any one tell me how to compile and run a *.java* file from another java program which is not in same directory?

    Well a smarter way of implementing this is by using a solution provided by Java Itself.
    If you are using J2SE 6.0+ there is an in built solution provided along with JDK itself and inorder to go ahead with solution the below are set of API which you;d be using it for compiling Java Programs (Files)
    http://java.sun.com/javase/6/docs/api/javax/tools/package-summary.html
    How do i do that ??
    Check out the below articles which would help you of how to do that
    http://www.ibm.com/developerworks/java/library/j-jcomp/index.html
    http://www.javabeat.net/javabeat/java6/articles/java_6_0_compiler_api_1.php
    http://books.google.com/books?id=WVbpv8SQpkEC&pg=PA155&lpg=PA155&dq=%22javax+tools%22+compiling+java+file&source=web&ots=XOt0siYe-f&sig=HH27ovuwvJgklIf8omTykUmy-eM
    Now once we are done with compilation.In order to run a Specific class all you ought to do is create an object and its specific methods of a specified class included in the CLASSPATH which you can manage it easily by usage little bit reflections.
    Hope that might help :)
    REGARDS,
    RaHuL

  • How to compile and run java program at command console

    hi there
    can anyone tell me how to compile and run a java program at command console? I have installed JRE 1.3.1, and also have installed JBuilder 5 if it helps.

    try this
    System.out.println("Enter your Name : ");
    BufferedReader console = new BufferedReader( new InputStreamReader( System.in ) );
    String s = console.readLine();
    System.out.println("Hello : "+ s+" !" );

  • Compile and run a program with Terminal

    Hello, I used TextWrangler to create a .c file on my desktop. I want to compile and run the program using Terminal. However, I am new to programming and I am not sure how to achieve this. I have Xcode with Command Line Tools downloaded. I have the file "6_19.c" on my desktop currently. Any help would be appreciated.

    Your Desktop probably isn't in your execution path, so you might want to start by moving "6_19.c" from your Desktop to your Home folder. After that, in Terminal, just do
    gcc -o 6_19 6_19.c
    The general format is
    gcc -o <name you want the compiled program to have> <name of the source>.c
    Do not put any .extension on the end of the name you want the compiled program to have. Also note that after "gcc" there's a space, then a dash and the next character is a lower case letter 'o', not a numerical zero. There's a space between the name of the compiled program and the name of the source.
    To run the program, at your terminal prompt type
    ./6_19
    The general format is dot forward slash <name of the compiled program>
    There's no spaces at all.
    Good luck.

  • How to compile and run java files on a mac using command line?

    can someone tell me or link me to some article on how to compile and run java files from command line on a mac? I have mac OS X leopard

    What do you mean by "where to put them" ? What do you want to put anywhere ?
    Have you read Peter's comment in brackets ? Perhaps you have a classpath problem ?
    Edited by: Michael_Knight on Aug 31, 2008 4:23 AM

  • Help on How to compile and execute awt programs

    can any1 say how to compile and execute awt programs
    Edited by: 863765 on Jul 18, 2011 3:29 AM

    EJP wrote:
    The answer is the same for anycode.Oh, but it's not. If he starts with MyClass.java, and we tell him
    javac MyClass.java
    java -cp . MyClassthen that advice won't work when he creates MyClass2. The poor guy will be left lost and alone, with no clue how to proceed! {noformat};-){noformat}

  • How to compile and run a java program?

    I am getting this error message, what to do?
    Exception in thread "main" java.lang.NoClassDefFoundError:
    Thanks for you help.
    Ajay

    Hello,
    I believe that this error is caused because when you
    compile and run a java program, you have to use the
    same name that is next to public class. For example,
    the program name is next to the word public class.
    For example, if a program began like this:
    public class Concat
    then the name of the program in this case is Concat
    and when you compile it you type: javac Concat.java
    when you run it type: java Concat
    depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
    Also depending on if you set your class path you might
    have to type the above like this: jdk1.2.1\bin\javac
    Concat.java to compile, and to run you would have to
    type jdk1.2.1\bin\java Concat where you would replace
    Concat with the name of your program and replace
    jdk1.2.1 with the name of your version of java, that
    is again if you do not have your classpath set. Hope
    this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
    Also, make sure you did not forget to put:
    public static void main(String[ ] args)
    on the line underneath the line where it says "public
    class Concat" where Concat is the name of your
    program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
    OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line.

  • How to compile and run PRO*C programs in Linux

    Hi all,
    This is my first post in this forum.
    I have Oracle 9i installed in linux platform .
    How can i compile and run Pro*C programs in linux.(i mean any commands or procedure to run these programs)
    please help me in this regard.
    Thanks in advance,
    Trinath Somanchi,
    Hyderabad .

    (1) How to compile the Pro*c program U got to have a makefile to compile a Pro*c program. It helps u in compiling and creating an excutable. Once U have created a makefile , just call "make" and it will do the compilation and create the executable as well.
    For a sample makefile visit
    http://asktom.oracle.com/~tkyte/proc_makefile/
    (2) How to run the Pro*c program ? and Once U have created an executable, U shall call that directly as any other linux command. Make sure U have the permissions to run the executable. If not give the permissions using chmod 777 executable
    (3)How to get the output of the program ?Question 2 and 3 are the same. I mean running and getting a output are the same

  • How to compile and run a matlab program?

    Hi,
    I have a college matlab code that i want to compile and run and take an output of. Can anyone guide me with this in xcode?
    Neerav

    Hi,
    I already googled it and went through that website before posting here and as you can see the software is paid. And thats exactly why I asked in my original post as to whether there is a way to do it with xcode.
    And the idea that xcode might be of any help too came after some experimentation. I double clicked the .m file and it opened in xcode. So I guess there must be a way to compile and run it too.
    Thanks for you recommendation anyway.
    Neerav Kothari

  • How to Compile and run Smart Card Application

    hi
    any one can help me reagrding Javacard API. i download the JavaCard Development Kit from sun and install on my machine but i didn't get all java files and class files of JavaCard API. where i obtain those files so my application get compile and run.
    pls help me i m new in this technology.
    Thanks in Advance.

    My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
    I've given my pgm and the thing I've got when I compiled it.
    Test.java
    package com.cert;
    public class Test
         public void display()
              System.out.println("Hai");
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files
    -cp <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
    Plz help me.
    thanks in advance
    Ambika

  • How to compile and run servlets in Eclipse?

    Does somebody known how can I compile and run servlets in Eclipse IDE? I've added and configured Tomcat's plugin. I've created a project with my example servlets source, and I don't know what farther. How do I have compile it without main method? I must add web.xml file from Tomcat's directory into projects in Eclipse and modify it?
    THX Chudzik

    Try googling for "eclipse servlet", surely someone has written instructions.

  • How to compile and run the servelt

    how to the compile and run the servlet programmes and how should i deploy them
    and is there any site for the tomcat server free download

    your first question is too general. you'll need a tutorial a Hello World on a servlet...google it.
    for the second one go to [http://tomcat.apache.org]

  • How to compile and publish after modified a .java file?

    Hello,
    I am a newbie to Business Object. I am now working on a server that installed BusinessObjects Enterprise, to develop and run BO reports. I need to edit some java codes of the InfowView. I found that there are some .java, .class, .jar files under the installed folder. I know that it is a struts framework and I can find which .java file to edit, but I don't know how to compile and publish the codes. Is it necessary to install any development tool to do it?
    Regards,
    Philip

    Since you are using CSV, you can read a line at a time and then use String.split() on it. One you have it split, you upload to your DB using JDBC or if your in the MS world and cannot get a JDBC driver, then use the JDBC/ODBC bridge.

Maybe you are looking for

  • Photoshop crashes when I try and save for web and devices. Making the image size smaller does not help.

    I'm trying to make a lopping .gif from an animation that I made. It's 147 total frames. It's crashed about 6 times now every time I either try and Save for Web or even just save the document on my desktop so in case it crashes I can reopen PS and rec

  • Apple's education program

    Hi everybody I am a long time PC user that is fed up with windows. I have decided to buy a Macbook pro 13.3" 2.53Ghz version for medical school. I like the long battery, portability and durability that apple promises. My question is about the educati

  • How to display name and display name of the role during request

    Hi, Is it possibe to display Role Name and Role Display Name on the "Select Roles" page during ROle Request for Others? In the "Roles Available" I can only see "Role Display Name". I was trying to look at "AssignRolesDataSet.xml" but was unable set w

  • Macbook pro dvd drive

    This morning I inserted a Cd into my dvd/cd drive in my macbook pro and it read the disc but when I ejected it a small screw came out too had to remove the screw before the disc would come out Before ths happened the cd drive would make an unusual so

  • Error whiel activating cross system object lock

    Hi , when I am trying to activate the cross system object lock functionality for developement system in tcode /TMWFLOW/CMSCONF  from our solman system , it showing the following error 'Error RFC destination SM_SMDCLNT000_TRUSTED: You are not authoriz