  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: java mode only allows nested classes?  (Read 390 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            senior 
   
        
      
             | 
            
            
            
              
                
                java mode only allows nested classes? 
                «  on: Oct 16th, 2003, 11:48pm » | 
                
                
 
                 | 
               
             
             
            
            I've been playing around with java mode in p5, and it seems that any other classes I create have to be nested within the main class that extends BApplet. Is this right?      If I have something like:    Code:   import java.io.*;   import java.util.*;      public class bort extends BApplet {   }      public class krunk {   }     |  
  |         it causes a java.lang.ClassCastException.   Java should allow multiple classes in one file, and compile to multiple .classes, right? 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            fry 
 
 
        
      
             | 
            
            
            
              
                
                Re: java mode only allows nested classes? 
                « Reply #1 on: Oct 17th, 2003, 12:20am » | 
                
                
 
                 | 
               
             
             
            
            you have to remove the 'public' from the second one, since they'll both be going into the same source file. it's just a java-ism that it doesn't allow more than one 'public' class per .java file. 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            senior 
   
        
      
             | 
            
            
            
              
                
                Re: java mode only allows nested classes? 
                « Reply #2 on: Oct 17th, 2003, 5:22am » | 
                
                
 
                 | 
               
             
             
            
            I still get the same error even if I remove the "public". 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            fry 
 
 
        
      
             | 
            
            
            
              
                
                Re: java mode only allows nested classes? 
                « Reply #3 on: Oct 19th, 2003, 3:53am » | 
                
                
 
                 | 
               
             
             
            
            hm, looks like a preproc bug, so i'm moving this over to the bugs section.       i've tested around with it a bit and there seems to be a problem. 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            senior 
   
        
      
             | 
            
            
            
              
                
                Re: java mode only allows nested classes? 
                « Reply #4 on: Oct 20th, 2003, 4:42pm » | 
                
                
 
                 | 
               
             
             
            
            In 66, I now get a java.lang.InstantiationException, but only if my class is listed after the BApplet class. If I put my class above the BApplet class in the source, it works fine. Definitely a preProc/scanner problem. 
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
 
 |