Compiling a single .java file

Hi,
is it possible to compile a single java class without having to rebuild the complete
application ? If this is not a feature is it going to be available in SP3 ?
Thanks
Mark

Just put your java classes in a Java project under your application and
then compile only that project.
/Steen
Mark wrote:
Hi,
is it possible to compile a single java class without having to rebuild the complete
application ? If this is not a feature is it going to be available in SP3 ?
Thanks
Mark

Similar Messages

  • 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

  • How to compile dunamically genrated java files through java program?

    Hi, I have a requirement where i generate java files from WSDL dynamically using wsdl2java jaxbri. I need to compile these files dynamically on the fly and jar it. Everything should happen through java program. Bcos everything is dynamic here, no information is known (like dir, file names ...) until the runtime. Everything is user fed.
    the directories may contain other directories with java files. its recursive
    i tried com.sun.tools.javac.Main.. but either its not scaling to my needs or i donno how to wok with this.
    is there any option to compile the java files as they are created thru JAXBRI (wsdl2java)?
    any help is appreciated..
    -s

    my requirement is :
    i create java files from wsdl2java (axis).. i need to compile all the java files.. directories with in the directories (recursive)...
    as bcos the the java files have inter-dependencies they have to be compiled as a bunch something like (java *.java). I donno how to do this in javac.Main tool
    Once all these files are compiled i need to create a jar out of them
    Any help is appreciated!

  • Compiling / Running a Java file in JSP

    Hi,
    ok, I have a jsp page, which we will call page 1. Once I go to that page, I all I want it to do is compile a certain file.java, and then run the file.java. The user doesn't actually know that this is going on in the background. Page 1 automatically redirects the user to page 2 (also a jsp page).
    The java program that I created (that was previously compiled and ran) creates a special javascript file. After running the file.java in page #1, the java file creates a javascript file that will be used in page 2 to display a tree node (group of information).
    so, right now, I'm trying to figure out how to write the jsp code that will tell how to compile and run a java file. I was thinking about using javabeans before, but I think you HAVE to actually display the contents of the java file into the jsp (I think). Anyhow, thanks for the help!

    sorry about being ambiguous before. What I mean by
    running a java file was that I already created a java
    file. I don't want to hava my java statements inside
    the jsp file. I just want the jsp file have a command
    in it that would call a java file, tell the java file
    to compile and run. All the jsp file would do
    (hopefully) is just give commands for a seperate java
    file to compile and run. Thanks again for any help!Ok, so this other java file has some entry-point method, like main(), right? So call it...
    <%
    YourJavaClass.main(appropriateArgumentsGoHere);
    %>
    or better yet, it's an object you can use:
    <%
    YourJavaClass x = new YourJavaClass();
    x.callSomeMethodHere(withAppropriateArgumentsHere);
    x.callAnotherMethodMaybe();
    %>
    You don't need the jsp file to "compile" this java file, you'd already have compiled it beforehand, and it's class bytecode needs to be in your classpath (on the server side) of course.

  • Is it possible to compile & run other java files from one file

    hi friends,
    i need to run 2,3 java sourse files(first.java,second.java etc) from one file.i tried the Runtime.getRunTime().exec( cmd) but here cmd must be a executable file
    what is need is to compile and run the files (first.java,second.java) from one other source file
    pls. help me in this matter,
    with warm regards,
    Vishal

    Sure:public class Test {
       public static void main(String[] args) {
          try {
             Runtime r = Runtime.getRuntime();
             r.exec("javac Test2.java");
          } catch (Exception e) {
    public class Test2 {
       public static void main(String[] args) {
          System.out.println("Hello World!");
    }Note that Test and Test2 are in two seperate files.

  • Error: code too large for try statement, when compiling a big java file.

    Hi,
    I have a big java file ( around 16000 lines). When compiling it, I got following error message:
    MyMain.java:15233: code too large for try statement
    } catch ( Throwable t ) {
    In MyMain.java, I just repeat following statements about 1000 times.
    try {
    if ( year >= 2002 ) {
    System.out.println( "year: Evaluation version is not valid" );
    } else {
    System.out.println( "year: Evaluation version is still valid" );
    } catch ( Throwable t ) {
    if ( year >= 2002 ) {
    System.out.println( "year: Evaluation version is not valid" );
    } else {
    System.out.println( "year: Evaluation version is still valid" );
    I tried 1.3 and 1.4 javac compiler, there was some error.
    How to make compiler to compile this code?
    Thanks,

    Hi,
    I have a big java file ( around 16000 lines). When
    compiling it, I got following error message:
    MyMain.java:15233: code too large for try statement
    } catch ( Throwable t ) {
    I tried 1.3 and 1.4 javac compiler, there was some
    error.
    How to make compiler to compile this code?
    You don't. Each method has an absolute limit on the number of byte codes. You have reached that limit. The limit is part of the specification and JVMs will refuse to run classes that exceed the limit. So even if you could compile it, it wouldn't run.
    It is quite common for code generators to generate large monolithic blocks of code. Presumably this is how you got to this spot. Modify the code generator to break it into smaller blocks.
    If you did it manually then you did it wrong. And you will have to manually break it into smaller blocks. (And re-examine your design since it is probably wrong.)

  • Error in compilation satge of java files

    Hi all
    Whenever i m trying to compile java files i m getting this error .I have no idea how to go about fixing this issue. Can any one help me out with this.
    Error occurred during initialization of VM
    Could not reserve enough space for object heap

    Well i could go ahead and solve the issue by bringing down the memory allocation at the minimum and maximum level during the compilation stage.
    I got the tip from the forum itself where a similar problem had been reported and there this tip was provided.
    Earlier in my case i was allocating 1GB of memory for compilation but due to some issue that much space was not being detected on the server. When i pruned that down to 512mb the compilation went ahead without any trouble.
    Thanks kelly for geting in involved in geting to know the issue .

  • Why a single .java file can't have multiple public classes defined in it?

    A public class must be saved in a .java file with the same name, why?

    Tejaswi.Khijwania wrote:
    A public class must be saved in a .java file with the same name, why?This is what the JLS states (7.6 Top Level Type Declarations),
    When packages are stored in a file system (7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:
    * The type is referred to by code in other compilation units of the package in which the type is declared.
    * The type is declared public (and therefore is potentially accessible from code in other packages).
    This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
    As you can see a host system (development system) may enforce this restriction. It doesn't have to.

  • Problem compiling a simple java file

    Hi,
    When I try to compile the following simple java file
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HowdyServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    out.println("<html>");
    out.println("<body>");
    out.println("<center><h1>Hi</h1></center>");
    out.println("</body>");
    out.println("</html>");
    at the command prompt as follows
    C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac -classpath
    "C:\Program Files\Java\j2re1.4.2_03\lib\ext\QTJava.zip" *.java
    Or
    C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac *.java
    Or
    C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac HowdyServlet.java
    I get the following errors and I cannot compile this java file -
    HowdyServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HowdyServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HowdyServlet.java:5: cannot find symbol
    symbol: class HttpServlet
    public class HowdyServlet extends HttpServlet {
    ^
    HowdyServlet.java:6: cannot find symbol
    symbol : class HttpServletRequest
    location: class HowdyServlet
    public void doGet(HttpServletRequest request,
    ^
    HowdyServlet.java:7: cannot find symbol
    symbol : class HttpServletResponse
    location: class HowdyServlet
    HttpServletResponse response)
    ^
    HowdyServlet.java:8: cannot find symbol
    symbol : class ServletException
    location: class HowdyServlet
    throws IOException, ServletException {
    ^
    6 errors
    I have installed the latest JEE 5 SDK on Win XP Home. I have the following variable set as follows,
    CLASSPATH = .;C:\Program Files\Java\j2re1.4.2_03\lib\ext\QTJava.zip
    PATH = C:\Sun\AppServer\jdk\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\QuickTime\QTSystem;C:\Sun\AppServer\lib\ant\bin
    ANT_HOME = C:\Sun\AppServer\lib\ant
    I have spent hours scratching my head but don?t have a clue. I was wondering if you have any idea as why I might be getting these errors.
    Thank you for your time.
    Green

    Hello, did you read the answers?
    You have to put j2ee.jar or servlet-api.jar in your classpath. Those JAR files are included in the Java EE package somewhere. Remove the QTJava.zip junk from the classpath.
    If you don't know what the classpath is and how to set it, read this:
    Setting the class path
    How Classes are Found
    And I'll repeat what the others say: if you are very new to Java, then Java EE will probably be way over your head. First learn the language and the standard API. If you understand that well, start with Java EE. Or do you already know what servlets are, and that you need a servlet container to run them, and how to deploy them etc.?

  • Compiling all possible java files

    Hi,
    I have a project in which not all files/packages compiles but a set of packages compiles always.
    Say set of classes which might not compile as 'A' and set of classes which will always compile as 'B'
    On frequent basis i need to get update. And I am only concerned about set 'B' but when i compiles my project using ant
    compilation fails as 'A' compilation fails and because of that it doesn't go further to compile 'B'.
    So how to get eclipse like functionality to compile all possible files?
    what i have is
    ================================
    <javac debug="${debug}" deprecation="${deprication}"
                   optimize="${optimize}" destdir="${build.home}/WEB-INF/classes"
                   listfiles="${listfiles}" target="${jdk.compliance}"
                   verbose="${verbose}" srcdir="${src.home}"
                   memoryMaximumSize="512M" fork="true"
                   source="${src.compliance}">
                   <classpath refid="compile.path"/>
                   <include name="**/*.java"/>
                   <exclude name="HBM/**"/>
                   <compilerarg value="-Xlint:unchecked"/>
    ===================================
    I do not wish to write all the classes specifically that compiles in ant script.
    Thanks in Advance

    Try with failonerror option in your javac.
            <javac debug="${debug}" deprecation="${deprication}" optimize="${optimize}" destdir="${build.home}/WEB-INF/classes" listfiles="${listfiles}" target="${jdk.compliance}" verbose="${verbose}" srcdir="${src.home}" memoryMaximumSize="512M" fork="true" source="${src.compliance}" {color:#0000ff}*failonerror="false"*{color}>
                <classpath refid="compile.path" />
                <include name="*/.java" />
                <exclude name="HBM/**" />
                <compilerarg value="-Xlint:unchecked" />Regards,
    Prashanth.

  • Some compiling problem with java files in JSP

    I wrote a file "ProductManager.java" to use the class of Product to do certain functions which are executed in a jsp, however, there are some curious errors.
    C:\Tomcat\webapps\examples\WEB-INF\classes\com\wrox\begjsp\arrayexample3>javac P
    roductManager.java
    ProductManager.java:5: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    private Product[] productList = new Product[3];
    ^
    ProductManager.java:20: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    public Product[] getProductList(){
    ^
    ProductManager.java:28: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    public Product getProductDetails(int prodid) {
    ^
    ProductManager.java:5: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    private Product[] productList = new Product[3];
    ^
    ProductManager.java:13: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    productList[0] = new Product(1,"Wrox Press Beginning JSP",49.99);
    ^
    ProductManager.java:14: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    productList[1] = new Product(2,"Wrox Press Professional JSP",59.99);
    ^
    ProductManager.java:15: cannot resolve symbol
    symbol : class Product
    location: class com.wrox.begjsp.arrayexample3.ProductManager
    productList[2] = new Product(3,"Wrox Press Beginning Java",39.99);
    ^
    7 errors
    Here is the source code:
    Product.java
    package com.wrox.begjsp.arrayexample3;
    public class Product {
    private int productId;
    private String productName;
    private double productPrice;
    public Product(int prodid, String prodname, double prodprice) {
    productId = prodid;
    productName = prodname;
    productPrice = prodprice;
    public int getProductId(){
    return productId;
    public void setProductId(int ProductId){
    this.productId = ProductId;
    public String getProductName(){
    return productName;
    public void setProductName(String ProductName){
    this.productName = ProductName;
    public double getProductPrice(){ return productPrice; }
    public void setProductPrice(double productPrice){
    this.productPrice = productPrice;
    ProductManager.java
    package com.wrox.begjsp.arrayexample3;
    public class ProductManager{
    private Product[] productList = new Product[3];
    private int productCount;
    public ProductManager() {
    initializeProductList();
    private void initializeProductList() {
    productList[0] = new Product(1,"Wrox Press Beginning JSP",49.99);
    productList[1] = new Product(2,"Wrox Press Professional JSP",59.99);
    productList[2] = new Product(3,"Wrox Press Beginning Java",39.99);
    public Product[] getProductList(){
    return productList;
    public int getProductCount(){
    return productList.length;
    public Product getProductDetails(int prodid) {
    int ProductIndex = -1;
    for(int i=0;i<this.getProductCount();i++) {
    if (prodid == productList.getProductId()) {
    ProductIndex = i;
    break;
    if (ProductIndex != -1) {
    return productList[ProductIndex];
    } else {
    return null;
    Please tell me how to debug it to make it works, thx

    add C:\Tomcat\webapps\examples\WEB-INF\classes to your classpath.
    You can do this through the control panel or by:
    set CLASSPATH=%CLASSPATH%;C:\Tomcat\webapps\examples\WEB-INF\classes

  • Java Mapping - Not able to compile .Java file

    Hi Experts,
    I am working with a sample scenario which involves Java Mapping. For this I created MappingClass.java file, After compiling the .Java file .Jar file would be used for Java Mapping by using Imported Archives.
    After compiling the MappingClass.java file, I am getting the errors as below.
    --> Java errors after compilation
    C:\j2sdk1.4.2_13\bin>javac MappingClass.java
    MappingClass.java:4: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    MappingClass.java:5: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    --> End of java errors
    In the MappingClass.java file, I had given followed imports.
    import java.util.*;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    Could some one please guide me to resolve this issue.
    Thanks in advance.
    ..Sree

    Hi
    I had copied " aii_map_api.jar " file in my Java Class path folder.. i.e " C:\j2sdk1.4.2_08\bin "     AND    " C:\j2sdk1.4.2_08\lib " folders too.. and even in C:\ i.e Root Drive also.
    After trying to Compile my java file (ex : MappingClass.java), still I am getting the errors.
    Errors shown as below.
    --> Errors
    C:\mytest>javac MappingClass.java
    MappingClass.java:2: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    MappingClass.java:3: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
                                   ^
    MappingClass.java:6: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class MappingClass
        private static AbstractTrace trace = null;
                       ^
    MappingClass.java:12: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class MappingClass
            trace = (AbstractTrace)inputparam.get(
                     ^
    MappingClass.java:13: cannot resolve symbol
    symbol  : variable StreamTransformationConstants
    location: class MappingClass
                       StreamTransformationConstants.MAPPING_TRACE );
                       ^
    5 errors
    --> End of Errors
    Could some one please guide me to resolve this issue.
    Thanks in advance.
    ..Sree

  • Oracle EBS R12 - how to compile jsp and keep .java file

    Hello.
    When I compile the jsp file, it will create the _pagename.class file into $COMMON_TOP/_pages directory. Some of the time it also keep _pagename.java file in there.
    How can force the compiler to keep the java file always.  I am using following command which creates _pagename.class file. 
    perl $FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'ptcResponse.jsp' --flush
    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.

    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    This is an expected behaviour.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.
    The "perl ojspCompile.pl" command doesn't offer this -- Issue "perl ojspCompile.pl" and you will see what options are available.
    Your option is to keep/save the java files in a different directory.
    Thanks,
    Hussein

  • How to compile Java files using Ant in Eclipse

    Hi All ,
    I would like to compile all Java files using Ant in Eclipse.Since am very new to Ant and Eclipse can someone help me to create a build.xml file and let me know how to compile all the java files.
    For ex , I have placed my java files inside the path C:\HEC\Terab.Initially the Terab folder holds 7 jar files which i had decompiled using JD compiler and placed the unzipped 7 folders (which contains the java files ).Now i have imported the HEC project into Eclipse using New ->Project ->Java Project.after importig it throwed me an error saying missing jar files.again i copied the jar files and placed inside Terab folder with other 7 folder.
    Now How i can compile the java files and convert in to class files.Then after compiling the files i will again need to jar all the 7 folder.
    Please tell me the steps i need to follow.How to write an build.xml file ? where i should keep it ? only one build.xml file is enough or should i write 7 build.xml file for each folder ? Please help me out...
    Thanks & Regards
    Kar1983

    put it another way, what I am trying to do is to compile David Brackeen's ch 18 code from his book. The java sourse files can be downloaded here:
    http://www.brackeen.com/javagamebook/
    my question is that how would I complie all of these file so that I can get the program in ch18src\src\com\brackeen\javagamebook\test\ to run?

  • Java application compiles java files in memory

    how can I use java application program (that may call method runtime exec or some other techniques) to compile the other java files that were already loaded in memory. (I can not copy those target files to the hard disk with extension java, then compile for security reason).

    And once they are compiled, where do you plan to put the compiled .class files? Same security problem, right? Perhaps you planned to load and use them "from memory" somehow? This would be a different security problem. Perhaps you need to rethink what you are doing.

Maybe you are looking for