Ant not always compiling inner classes

hello,
Every once in a while I get a troubled inner class. Ant doesn't always compile it (or maybe ant doesn't move it to the build directory). It's always the same inner classes... The compile will succeed, but when I run the program, it says that it's missing a class.
ant clean fixes the problem.
Any way I can stop this from happening?

Ant doesn't always compile it (or maybe ant doesn't move it to the build directory).Did you check which?

Similar Messages

  • Compiling inner classes

    Hi,
    I have an applet with inner classes (the applet is contained in a single .java file). When I compile the applet, a number of *$*.class files are created for the inner classes. However, a friend of mine compiles the same .java file and he gets a single .class file. He can't see any files corresponding to the inner classes. My compiler is version 1.4.0, his is 1.4.2. Can you suggest how my friend can generate the *$*.class files corresponding to the inner classes?
    Thanks for your help.
    Miguel
    PS If the .jar file does not contain the *$*.class files, then appletviewer can't find the inner classes.

    Let me try again. My friend gets a single .class file.
    If he invokes the applet like this:
    <APPLet CODE="myapplet.class" WIDTH=100 HEIGHT=100>
    he has no problems at all.Because all the necessary files are there. Including the inner class files. Why he doesn't see them is another problem.
    However, if he puts his class file in myjar.jar and
    invokes the applet like this:
    <APPLet CODE="myapplet.class"
    ARCHIVE="myjar.jar"
    WIDTH=100 HEIGHT=100>
    then his inner classes are not found by appletviewer.Because he didn't put the inner class files in the jar. Why he didn't put them is another problem.
    There is abosolutely no other explanation I can see.

  • Cannot compile inner classes

    I have java source files that were created in another IDE. Some of these source files contain inner classes. When I attempt to compile them in JDev9i, the inner classes are not output.
    Has anyone experienced this problem in JDev?

    When I compile the source files containing inner classes, JDev does not output any Outerclass$xxx.class files, and the compiler complains that (for example):
    D:\path_to_source\source.java
    -Error(50,3): class VCMailer FileOpen$1 not found in class VCMailer.VCMailer
    There are no compile errors other than not being able to find the inner class files. FYI, the same file, unaltered, compiles without a problem in my other IDE. Building or making makes no difference, and the problem occurs whether it's the individual file, the project, or the workspace.
    I've done a test, creating a new class within the same project with a simple structure such as:
    package VCMailer;
    public class test {
    public test() {
    class innerTest{
    public innerTest(){
    This source file properly outputs an inner class. Strange.
    Matthew

  • JDev Compiler Error? - Compiling inner classes

    This maybe just an interpretation of the language standard, but the compiler behavaviour is different from previous versions of JDeveloper and other Java IDE's, with no explanation found.
    Using JDeveloper 9.02.829 the following error is received.
    Error(13,9): class test$abc not found in class test.test
    when compiling the following class
    package test;
    public class test
    class abc { }
    public test()
    public void t ()
    abc a = new abc();
    The solution is to ensure the package name and class name are different (case sensitive) iff the class contains an inner class
    Whilst this can be done it can pose a problem porting older code into this release of JDeveloper, whilst no problem exists with other IDE's or older versions of the JDevloper IDE.
    The question is this a bug or a feature?

    This is a bug that got fixed a while back. The bug is with
    the fact that the class and the package have the same name.
    The bug is definitely fixed in 9.0.3 Preview Release which
    is currently available on OTN. 9.0.3 Production should be
    available anyday now.
    Michel

  • Problem Compiling Inner Class

    Can anyone tell me why the following won't compile?
    Error : variable f might not have been initialized return f.getName();
         public void createNodes(File root, DefaultMutableTreeNode node)
              File [] files = root.listFiles();
              for(int counter = 0; counter < files.length; ++ counter)
                   final File f = new File(files[counter].getPath())
                        public String toString()
                             return f.getName(); // Compiler error
                             //return ("ABC"); OKAY
                   if(f.isDirectory())
                        DefaultMutableTreeNode dirNode = new DefaultMutableTreeNode(f.getName());
                        node.add(dirNode);
                        dirNode.setAllowsChildren(true); // HANDLE EMPTY DIRECTORIES
                        createNodes(f, dirNode);
                   else
                        DefaultMutableTreeNode fileNode = new DefaultMutableTreeNode(f);
                        node.add(fileNode);
                        fileNode.setAllowsChildren(false);
         }

    I had coded the thing like:
        for (int i = 0; i < files.length; i++) {
          final File f = new File(files[1].getPath()) {   // Yes that's a one in there
            public String toString() {
              return getName();
          System.out.println(f);
        }... Then passed into it a directory that contained a class named similar to an anonomous class name, and it just happened to be the 2nd file listed (files[1] that is) ... and therefore I got a whole bunch of that class name.class down the page instead of the entire contents of the directory ... and, oh well, threw me off ... like I said I think I need some sleep.
    ~Bill

  • Why are protected fields not-accessible from sub-classed inner class?

    I ran across a situation at work where we have to sub-class an inner class from a third-party package. So, it looks something like this...
    package SomePackage;
    public class Outer {
       protected int x;
       public class Inner {
    package OtherPackage;
    public class NewOuter extends Outer {
       public class NewInner extends Outer.Inner {
    }Now the NewInner class needs to access protected variables in the Outer class, just like the Inner class does. But because NewOut/NewInner are in a different package I get the following error message.
    Variable x in class SomePackage.Outer not accessible from inner class NewOuter. NewInner.You can still access those protected variables from the NewOuter class though. So, I can write accessor methods in NewOuter for NewInner to use, but I am wondering why this is. I know that if NewOuter/NewInner are in the same package as Outer/Inner then everything works fine, but does not when they are in different packages.
    I have to use JDK1.1.8 for the project so I don't know if there would be a difference in JDK1.2+, but I would think that nothing has changed. Anyway, if you know why Java disallows access as I have detailed please let me know.

    Although I don't have the 1.1.8 JDK installed on my system, I was able to compile the following code with the 1.3.1_01 JDK and run it within a Java 1.1.4 environment (the JVM in the MSIE 5.5 browser). As long as you don't access any of the APIs that were introduced with 1.2+ or later, the classes generated by the JDK 1.2+ javac are compatible with the 1.1.4+ JVM.
    //// D:\testing\SomePackage\Outer.java ////package SomePackage ;
    public class Outer {
        protected int x ;
        public Outer(int xx) {
            x = xx ;
        public class Inner {
    }//// D:\testing\OtherPackage\NewOuter.java ////package OtherPackage;
    import SomePackage.* ;
    public class NewOuter extends Outer {
        public NewOuter(int xx) {
            super(xx) ;
        public class NewInner extends Outer.Inner {
            public int getIt() {
                return x ;
    }//// D:\testings\Test.java ////import OtherPackage.* ;
    import java.awt.* ;
    import java.applet.* ;
    public class Test extends Applet {
        public void init () {
            initComponents ();
        private void initComponents() {
            add(new Label("x = ")) ;
            int myx = new NewOuter(3288).new NewInner().getIt() ;
            TextField xfld = new TextField() ;
            xfld.setEditable(false) ;
            xfld.setText(Integer.toString(myx)) ;
            add(xfld) ;
    }//// d:\testing\build.cmd ////set classpath=.;D:\testing
    cd \testing\SomePackage
    javac Outer.java
    cd ..\OtherPackage
    javac NewOuter.java
    cd ..
    javac Test.java//// d:\testing\Test.html ////<HTML><HEAD></HEAD><BODY>
    <APPLET CODE="Test.class" CODEBASE="." WIDTH=200 HEIGHT=100></APPLET>
    </BODY></HTML>

  • Inner Class extending the outer class

    Could anyone explain this code to me? It can compile and run. Could anyone tell me what the class Main.Inner.Inner is? What members does it consists of? How the compiler manage to build such a class?
    public class Main {
        public static class Inner extends Main {
        public static void main(String[] args) {
            System.out.println("Hello, world.");
    }

    By the way, it's not really an inner class, because it's static. It's just a nested class.
    You might want to have a nested class extend its enclosing class if, maybe, you wanted to delegate to subclasses and didn't want to create a lot of extra source code files, which might make sense if the nested subclasses were really small.
    public abstract class Animal {
      public abstract void makeSound();
      private Animal() {} // can't be directly instantiated
      private static class Dog extends Animal {
        public void makeSound() { System.out.println("woof"); }
      private static class Cat extends Animal {
        public void makeSound() { System.out.println("meow"); }
      private static class Zebra extends Animal {
        public void makeSound() { System.out.println("i am a zebra"); }
      public static Animal get(String desc) {
        if ("fetches sticks".equals(desc)) {
          return new Dog();
        if ("hunts mice".equals(desc)) {
          return new Cat();
        if ("stripey horse".equals(desc)) {
          return new Zebra();
        return null;
    public class AnimalTest {
      public static void main(String... argv) {
        Animal a = Animal.get("fetches sticks");
        a.makeSound();
    }

  • Debugging Inner Class using jdb

    Hi
    I am using JDK 1.3.1 on solaris and observe that the java debugger does not stop at "Inner class" methods. Is there any way to make jdb (from command line) stop inside the "inner class"?

    I had the following code (similar to the example you gave) :
    package test;
    public class Outer {
      public Outer() {
        Inner i = new Inner();
      static public void main(String[] args) {
        Outer o = new Outer();
      public class Inner {
        public Inner() {
          System.out.println("Inner");
          Runnable Runner = new Runnable() {              
         public void run() {
           System.out.println("Runner");
          Runner.run();  
    }Which compiled into :
    Outer.class
    Outer$Inner.class
    Outer$1.class
    And to stop at the line System.out.println("Runner"); I could use stop at test.Outer$1:14 or stop in test.Outer$1.run(). So it seems that you need to look at the compiled .class name and use that.

  • Why inner classes cannot have static declarations ?

    Hi Friends,
    When i tried to make static declarations on a inner class which is non static, i am getting compilation error saying "inner classes cannot have static declarations". I want to know reason behind this implementation.
    Code which i have tried:
    public class TestOuter
    class TestInner{
    static int i =10;
    public static boolean validate(int a){
    if(a==0)
    System.out.println("Invalid data");
    return false;
    return true;
    public static void main(String a[]){
    boolean result = new TestOuter.TestInner.validate(0);
    System.out.println("Result="+result);
    Thanks,
    Shiju V.

    so I think if the
    outer class is not static , then Inner class can't be
    static as well. This is incorrect. An enclosed class can be indeed static while the outer is not, and vice versa.
    The difference between static/non static in regards to enclosed classes is that the static ones are 'top-level' and cannot access the members of the enclosing class.
    The effect of making an enclosed class static means there is only one instance of any variables, no matter how many instances of the outer class are created. In this situation how could the static inner class know which variables to access of its non static outer class. Of course the answer is that it could not know, and thus an static inner class cannot access instance variables of its enclosing class.
    Now, regarding non-static inner classes, and trying to give a valid answer to the original post:
    As with instance methods and variables, a non-static inner class is associated with an instance of its enclosing class and has direct access to that object's instance variables and methods.
    TestOuter outer = new TestOuter();
    TestOuter.TestInner inner = outer.new TestInner();Because an inner class is associated with an instance (inner class implicitly keeps a reference to the object of the enclosing class that created it), it cannot define any static members itself. Static members cannot access the this pointer.
    So, in an ordinary (non-static) inner class, the link to the outer class object is achieved with a special this reference. A static inner class does not have that special this reference, nor would a static method/variable of an ordinary (non-static) inner class.

  • Trying to serialize inner class and getting various errors.

    Hi, I'm working on a program that contains the inner class User. user implements serializable, and writes just fine. For some strange reason, though, after I read it, I keep getting NullPointerExceptions in my code.
    I also tried it using externalization. The User class is essentially built around a HashMap. I have the following methods:
    public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(mainMap);
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    mainMap = (Map) in.readObject();
    String test = (String) in.readObject();
    Whenever inputstream.readObject() is called, though, I get an InvalidClassException; "no valid constructor." The sad part is that I have the method:
    public User () {
    main = new HashMap();
    Does anyone know what the problem is??? Thanks a lot!

    Does anyone know what the problem is???The inner class is not a static inner class. Therefore your constructor User, is actually User(OuterClass). Solution - make the class static OR use read and/or write resolution to reconstruct the relationship.

  • How to create an object of inner class

    hi i don't know how to create an object of an inner class..
    i got something like
    class Abc{
    private class Abcd {
    like this and i want to create an object of Abcd so that i can use some of method
    there..
    i think i should create the outter class object first right? but not sure
    the syntax.. i tried something like
    Abc.Abcd justTry = new Abc.Abcd()
    something like this..but not work..
    help me plz. ...

    If the nested class (that's not technically an inner
    class you have there) is not static, then you can't
    refer to it with OuterClassName.InnerClassName any
    more than you can refer to any other member--method
    or variable--with ClassName.staticMember.
    You need an instance.
    It's been a while since I've created an instance of a
    non-static nested class from outside that clsas, but
    I think it's something like this: Outer outer = new Outer();
    outer.Inner inner = new outer.Inner();
    Actually, I think it is this:
      Outer outer = new Outer();
      outer.Inner inner = outer.new Inner();Can't test it now though, gotta go to Taco John's for TACO TUESDAY!!!!
    Gotta love them crunchy shell bean tacos!!!

  • Inner Classes Allowed in EJBs?

    Can I not put an inner class inside my enterprise java beans? If not, why not?
    javax.transaction.TransactionRolledbackException: try to access class com.blueorchid.ejbs.WorkflowtBean$Dummy from class com.blueorchid.ejbs.WorkflowtBean; nested exception is:
    java.lang.IllegalAccessError: try to access class blueorchid.ejbs.WorkflowtBean$Dummy from class blueorchid.ejbs.WorkflowtBean
    java.lang.IllegalAccessError: try to access class blueorchid.ejbs.WorkflowtBean$Dummy from class blueorchid.ejbs.WorkflowtBean

    Nevermind. My mistake was in not declaring my inner class, Dummy, as public. After I declared it as public I no longer received the IllegalAccessError. It appears that one can use inner classes in EJBs. This topic is closed.

  • Compiling Java Class in Workshop

    May I ask a dumm question: how to compile a java class in Workshop? Application
    Build or Project Build does not seem to do the work.
    Thanks.

    "Gerald Nunn" <[email protected]> wrote:
    "Jeff" <[email protected]> wrote in message
    news:406455b2$[email protected]..
    May I ask a dumm question: how to compile a java class in Workshop?Application
    Build or Project Build does not seem to do the work.Works fine for me, what type of project is the java file in?
    Gerald
    Thanks for the reply.
    It is a web project. My Java files are under the following folder tree:
    eSheetWeb\WEB-INF\classes
    I have run Build Project against eSheetWeb few times. No errors but java files
    just not getting compiled to class. Also is there a way to just compile without
    run the entire Build?

  • Static abstract inner classes

    Sorry to sound stupid, but why would a class be static? I've encountered an example of an abstract static inner class and I'm not sure why it's static. Static methods I understand -- they are methods of the class and not the instance. So then, can someone explain to me a static class?
    Thanks,
    Erik

    You have encountered a static nested class (not a static inner class - an inner class is a nested class that is not static).
    A static nested class is a nested class that does not require an instance of its enclosing class to exist in order that it can be instantiated. - It is mainly used for code organisation, and can be treated just like a top-level class.
    In practice, most nested classes (except perhaps event handlers), tend to be static.
    For an example of a static nested class from the core APIs, have a look at HasMap.Entry

  • Application & JApplet - Inner Classes

    Hi,
    I am having problems understanding the purpose of Inner Classes.
    1. Is purpose of inner class in an Application to take care of what init method
    takes care of in a JApplet. I believe init method in JApplet brings up the browser and
    xecutes statements in init()?
    2. Is it possible to write the enclosed Application without using an Inner Class?
    If so, can someone please show me how?
    3. Is it possible to write the enclosed JApplet using an inner Class?
    If so, can someone please show me how?
    Maybe if I see how an Application and JApplet are written with and without inner classes, this may help me understand.
    Thank you.
    //APPLICATION USING AN INNER CLASS
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //outerclass
    public class InnerTest extends JFrame
    private JTextField numField, sumField;
    private int sum = 0;
    public InnerTest()
    super("Inner Test");
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    ActionEventHandler handler = new ActionEventHandler();
    numField = new JTextField(10);
    sumField = new JTextField(10);
    numField.addActionListener(handler);
    c.add(numField);
    c.add(sumField);
    public static void main(String args[])
    InnerTest win = new InnerTest();
    win.setSize(400, 140);
    win.show();
    //Innerclass
    private class ActionEventHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    sum += Integer.parseInt(numField.getText()); // access to sum and numField
    numField.setText("");
    sumField.setText(Integer.toString(sum));
    JAPPLET
    Below is modification of above code to a JApplet
    without using inner class. I have CAPITALIZED MODIFICATIONS.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class InnerTest extends JAPPLET
    private JTextField numField, sumField;
    private int sum = 0;
    public VOID INIT()
    super("Inner Test");
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    ActionEventHandler handler = new ActionEventHandler();
    numField = new JTextField(10);
    sumField = new JTextField(10);
    numField.addActionListener(THIS);
    c.add(numField);
    c.add(sumField);
    public void actionPerformed(ActionEvent e)
    sum += Integer.parseInt(numField.getText()); // access to sum and numField
    numField.setText("");
    sumField.setText(Integer.toString(sum));

    1. Is purpose of inner class in an Application to
    take care of what init method
    takes care of in a JApplet. I believe init method in
    JApplet brings up the browser and
    xecutes statements in init()?No. The init() method of an applet is similar to the constructor for an application. It is used to initialize data for the applet, the same data you will initialize in the constructor of the application.
    >
    2. Is it possible to write the enclosed Application
    without using an Inner Class?Yes it is possible. The power of an inner class is that is has access even to private member variables of the enclosing class. In your case the event handler has access to the private variables: numField and sumField. If you do not use an inner class you have to pass a reference to your frame in the event handler's constructor and access the variables through that reference. But in this case you do not have access to private variables. So you must provide methods to access those variables or you must change theri visibility.
    ActionEventHandler handler = new ActionEventHandler(this);Provide accessor methods in InnerTest class:
    public String getTextString(){
         return numField.getText();
    public void setTextString(String text){
         numField.setText(text);
    }As for the applet it works just as your application in this case, you can use inner classes or not but with the same restrictions.
    I hope you can understand what I tried to explain.

Maybe you are looking for

  • Function-based index with OR in the wher-clause

    We have some problems with functin-based indexes and the or-condition in a where-clause. --We use Oracle 8i (8.1.7) create table TPERSON(ID number(10),NAME varchar2(20),...); create index I_NORMAL_TPERSON_NAME on TPERSON(NAME); create index I_FUNCTIO

  • ZPRS- Cost(data source H) condition type is not visible in CRM sales order

    Hi Colleagues, I created a sales order in ERP. In the sales order the condition type ZPRS- Cost(data source H) is available. I downloaded the this sales order to CRM i can able to see the ZPRS condition type in sales order. But when i create a new sa

  • NUMBER_GET_NEXT

    Hi i am  using the FM number_get_next. can u plss tell me waht are the essential things that i need to give to this function module. like waht should be passed in nr_range_nr                                             object quantity subobjecttoyear

  • How to run the 9I report from the forms menue 9i

    how to run the 9I report from the forms menue 9i. Shehzad Latif

  • Strange SQL behavior

    When we run a simple select query against our DB, it will hang. When a different query is run under a different session, both the first and the second query return almost instanteously. Has anyone seen this behavior? What did you do to fix the proble