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

前端 未结 11 2128
抹茶落季
抹茶落季 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:15

    I was able to resolve this issue in a similar way like Lukas Eder.

    String testXML = "REALLY LONG STRING...............................";
           textXML += "SECOND PART OF REALLY LONG STRING..........";
           textXML += "THIRD PART OF REALLY LONG STRING............";
    

    Just split it up and add it together;

提交回复
热议问题