Java “constant string too long” compile error. Only happens using Ant, not when using Eclipse

前端 未结 11 2126
抹茶落季
抹茶落季 2020-12-01 15:25

I have a few really long strings in one class for initializing user information. When I compile in Eclipse, I don\'t get any errors or warnings, and the resulting .jar runs

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 16:10

    Did you try this? Never tried it myself, but here is the relevant section:

    Using the ant javac adapter The Eclipse compiler can be used inside an Ant script using the javac adapter. In order to use the Eclipse compiler, you simply need to define the build.compiler property in your script. Here is a small example.

     
     
    
    
    
    
    
    
    
    
        
            
              
            
                
    
    
    

    I would really consider making your classes standards compatible. I believe the official limit is 65535, and the fact that Eclipse is more lenient is something that could change on you at the most inconvenient of times, and either way constantly having to get the project compiled with Eclipse can really start to limit you in too many ways.

提交回复
热议问题