Limitations of public string declarations

Is there anylimit for declaring number of public string in a java file.
I have declared some 3300 Public String in a .java file as shown below
public class JbnIntlLabel implements Serializable {
public Properties prop = new Properties();
//start of new 2 series labels
public String Text_2A= null;
public String securityname_2A = null;
public String eqtTool_2A = null;
3300 such declarations.
once i try to create a extra string and trying to compile..,its giving the below error
/devusr8/web61/WebLogicServer/weblogic61/config/NewWeb61Domain/applications/demo/WEB
-INF/src/com/apollo/services/bean > demo.sh JbnIntlLabel.java
An exception has occurred in the compiler (1.3.1-rc2). Please file a bug at the Java Devel
oper Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and the
following diagnostic in your report. Thank you.
java.lang.StackOverflowError
at com.sun.tools.javac.v8.code.ClassWriter.writeFields(ClassWriter.java:588)
at
Can anybody help me out..
Thanks and regards
vijay
Tata Consultancy Services.
Mumbai -India

Is there anylimit for declaring number of public
string in a java file.
I have declared some 3300 Public String in a .java
file as shown below
public class JbnIntlLabel implements Serializable {
public Properties prop = new Properties();
//start of new 2 series labels
public String Text_2A= null;
public String securityname_2A = null;
public String eqtTool_2A = null;
3300 such declarations.
once i try to create a extra string and trying to
compile..,its giving the below errorThese are member variables.
The Java language (Java Language Specification) does not limit them.
The JVM however does (Java Vitual Machine Specification.) However you are no where close to that limit.
(Note that I do not consider this a great design. Unless you have profiled this under load I would simply keep the values in a hash table and use a named argument to retrieve each value.)
>
/devusr8/web61/WebLogicServer/weblogic61/config/NewWeb6
Domain/applications/demo/WEB
-INF/src/com/apollo/services/bean > demo.sh
JbnIntlLabel.java
An exception has occurred in the compiler (1.3.1-rc2).
Please file a bug at the Java Devel
oper Connection
(http://java.sun.com/cgi-bin/bugreport.cgi). Include
your program and the
following diagnostic in your report. Thank you.
java.lang.StackOverflowError
at
com.sun.tools.javac.v8.code.ClassWriter.writeFields(Cla
sWriter.java:588)As pointed out this is a compile time error. When you deploy something to a container it needs to create wrappers to support it.
So it compiles code. And the compiler is most likely written in java. So I would guess that your container server needs to have its stack space increased. This might be the server itself or it might be a property within the server depending on how it actually works. (And I have no idea which it would be.)

Similar Messages

  • Difference between public void, private void and public string

    Hi everyone,
    My 1st question is how do you know when to use public void, private void and public string? I am mightily cofuse with this.
    2ndly, Can anybody explain to me on following code snippet:
    Traceback B0;//the starting point  of Traceback
    // Traceback objects
    abstract class Traceback {
      int i, j;                     // absolute coordinates
    // Traceback2 objects for simple gap costs
    class Traceback2 extends Traceback {
      public Traceback2(int i, int j)
      { this.i = i; this.j = j; }
    }And using the code above is the following allowed:
    B[0] = new Traceback2(i-1, 0);
    Any replies much appreciated. Thank you.

    1)
    public and private are access modifiers,
    void and String return type declarations.
    2)
    It's called "inheritance", and "bad design" as well.
    You should read the tutorials, you know?

  • Difference in String declaration

    Hello All,
    Can any one please tell me whats the difference between following String declarations:
    a) String str = "abc";
    b) String str = new String( "abc" );
    Also please tell me which one is correct way of declaration and in which sence.
    Thanks in advance..........

    both are different
    the first one creates one String object and one reference variable. The second one creates two string objects, one in non-pool memory and the reference variable will refer to it., the second object is the literal that will be placed in the pool.

  • Public String[] split(String regex)

    How to change a Logical Operator "|" in regex expression to be treated as a regular character?
    Example:
    public class Temp {
    public static void main (String[] b) {
    String s = "zero|one|two";
    String mac[] = s.split("|");
    System.out.print(mac[2]); //"e" is printed
    Replace "|" with "@" and you will get "two" as output.

    thank you for a quick answer!
    I've changed the line to:
    String mac[] = s.split("\|");
    but i get an error message:
    Temp.java:4: illegal escape character
    String mac[] = s.split("\|");
    ^
    1 error

  • Shorten String declarations to one line

    I tried to shorten my declaration lines but get error. Please advise what I am doing wrong:
    I tried to shoten these declarations:
    String box = "";
    String circle = "";
    String rectangle = "";To:
    String box, circle, rectangle = "";
    Also tried:
    String (box, circle, rectangle) = "";

    String box= "", circle = "", rectangle = "";

  • Limiting length of Strings....

    Hello,
    I'm just starting to learn Java, and I'm trying to set up a 30 character limit on a String input from the user. I'm using TextIO for the input.
    Can anyone help me out with this?

    You can't (in a cross-platform way) prevent them entering more than your limit, you can however, check, after they've entered their string, that strings length.
    I hope this helps
    Talden

  • How to bind XML in Actionscript?

    I'm having difficulty working with binding in actionscript.  In MXML I can use the following line:
    <mx:Label x="117" y="40" text=" {stationXML.getItemAt(Station-1).CDL0.@value}" id="lblTest"/>
    However, in actionscript, I cannot seem to get the binding to work! I tried the following:
    BindingUtils.bindProperty(lblTest,"text",stationXML.getItemAt(Station-1).CDL0,"value");
    Any ideas how I can do this in Actionscript?  I need to do it in ActionScript becuase the "CDL0" value will need to be replaced at times with "CDL1", "CDL2", etc...

    I solved the issue, so if anyone else has the same problem, here's what I did (after much aggravation):
    The reason I didnt use MXML binding was because I wanted to be able to change it from "CDL0" to "CDL1" to "CDL3" without manually changing bindings.
    What I set in MXML for the text was:
    {stationXML.getItemAt(Station-1).child(cdlstr).@value}
    where 'cdlstr' was a public string declared (and set) elsewhere in the program.
    So I could make 'cdlstr' = "CDL0" or "CDL1" or even "CDL" + i (if I wanted to make life easy).  Just needed to remember to make 'cdlstr' a bindable variable or else it all falls apart.
    Hope it helps someone else.

  • Would like to declare a variable Public/Global in an IF statement

    Is there way to declare a variable as Public in an IF statement. My goal is to declare the variable as global (since this variable is used somewhere in the code and should not get initialized when there is loop back to the top of the code, hence using IF statement to control the initialization) based on the IF condition and then use it elsewhere in the code.
    I have it like this
    if (!sei_second_jsp.equals("1"))
    public int[] mecitem;
    public String[] sei_mfg_prod_cat;
    public String[] sei_part_number;
    public String[] sei_descrip;
    public String[] sei_price;
    public int[] sei_onhand;
    public int[] sei_demand;
    mecitem = new int[20000];
    sei_mfg_prod_cat = new String[20000];
    sei_part_number = new String[20000];
    sei_descrip = new String[20000];
    sei_price = new String[20000];
    sei_onhand = new int[20000];
    sei_demand = new int[20000];
    for (int i=0; i<=19999; i++)
    mecitem[i] = 0;
    sei_mfg_prod_cat[i] = " ";
    sei_part_number[i] = " ";
    sei_descrip[i] = " ";
    sei_price[i] = " ";
    sei_onhand[i] = 0;
    sei_demand[i] = 0;
    Your guess is right, I am using this code in JSP - since this is a Java related question, thought of posting it in JAVA forum.
    When I use the above code, I get the following error
    1809 }' expected. { 
    1811 Statement expected. public int[] mecitem;
    1827 Identifier expected. mecitem = new int[20000];
    1827 Can't specify array dimension in a declaration. mecitem = new int[20000];
    1827 Identifier expected. mecitem = new int[20000];
    1837 Can't specify array dimension in a declaration. sei_onhand = new int[20000];
    1837 Identifier expected. sei_onhand = new int[20000];
    1839 Can't specify array dimension in a declaration. sei_demand = new int[20000];
    1839 Identifier expected. sei_demand = new int[20000];
    3117 Class or interface declaration expected. }

    Please note the above code in the JSP is submitting to itself and I donot want it to get initialized if the IF statement is not successful..
    thnks a lot for your time.. !!!

  • Declaring constructor method public or private.  What's the point?

    My book declares the constructor method public. I tried declaring it private, and without any modifier out of curiousity. It runs exactly the same. What's the point of doing so?
    public class test
         public static void main( String[] args )
              test fun = new test();
              test fun2 = new test(2);     
              System.out.println( fun );
    //          System.out.println( test.toString() );
         public String toString()
              return "This is the toString";
         test()
              System.out.println( "This is the constructor method" );
         test( int x )
              System.out.println( "This is the constructor method: " +x );
    }

    yougene wrote:
    I'm new to OOP so maybe I'm not completely grasping the terminology. But this program works just fine with my class.
    public class test2
         public static void main( String[] args )
              test foo = new test();
    }It gives me the following output
    ----jGRASP exec: java test2
    This is the constructor method
    ----jGRASP: operation complete.The constructor method is executing from an outside class. I tried this with and without the private modifier on the constructor. Same result.Try compiling this.
    public class C1 {
      private C1() {
        System.out.println("C1 c'tor");
    public class C2 {
      public void foo() {
        C1 c1 = new C1();
    }

  • Class is public, should be declared in a file?

    So I'm running a program called BankAccount.java. When I tried to comile it (javac BankAccount.java) I get a message that says
    BankAccount.java:4:class InsufficientFundsException is public, should be declared in a file named InsufficientFundsException.java
    public class InsufficientFundsException extends Exception
    ^
    1 error
    In case you need to see it, my code is
    import java.util.*;
    import java.text.*;
    public class InsufficientFundsException extends Exception
    private int accountNumber;
    private int withdrawAmount;
    private int balanceAmount;
    private Date date;
    private DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
    private NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
    public InsufficientFundsException(int actNumb,
    int amount,
    int balance)
    date = new Date();
    accountNumber = actNumb;
    withdrawAmount = amount;
    balanceAmount = balance;
    public String toString()
    return getClass().getName() + " on " + df.format(date)
    + ". Withdraw of " + nf.format(withdrawAmount)
    + " rejected. Balance of account #" + accountNumber
    + " remains at " + nf.format(balanceAmount) ;
    }

    Actually I did. This is how it is right now
    BankAccount.java
    import java.util.*;
    import java.text.*;
    public String toString()
    return getClass().getName() + " on " + df.format(date)
    + ". Withdraw of " + nf.format(withdrawAmount)
    + " rejected. Balance of account #" + accountNumber
    + " remains at " + nf.format(balanceAmount) ;
    InsufficientFundsException.java
    public class InsufficientFundsException extends Exception
    private int accountNumber;
    private int withdrawAmount;
    private int balanceAmount;
    private Date date;
    private DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
    private NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
    public class InsufficientFundsException(int actNumb,
    int amount,
    int balance)
    date = new Date();
    accountNumber = actNumb;
    withdrawAmount = amount;
    balanceAmount = balance;
    So do I run the bank one first?

  • Compiler error - why is it still private when i declared it as public?

    import java.io.*;
    import java.util.*;
    public class Flight {
    static private int counter = 1;
         public String da, aa, flight_info, flight_stuff;
         public String st, et, h_et;
         public double price;
    public String taginf;
    public static String stand_t = "", h, m, a_or_p, m_t;
    public static String cMil, stand_h;
    public static String hs, ms;
    public static int hrs, mins, h_mil, m_mil, mil_time;
    public int compare, mt, ht, m_et;
    public int id;
         public void smaller(String dc, double pr)
         double pc;
         Object [] f_ra = flights.toArray();
         for (int i = 0; i < f_ra.length; i++)
         Flight fl = (Flight)f_ra;
              if (fl.da == dc)
                   pc = fl.price - Double.parseDouble(pr);
              else pc = pc;
         System.out.println("The old price was " + fl.price + "and the new price is " + pc);

    If you declare something private, it's private.If
    you declare it public, it's public.except for interfaces where members are implicitly
    made public.True.
    I amend my statement to:
    If you declare something private and it
    compiles, it's private. If you declare it public,
    it's public.plus you could declare something with default access modifier in an interface as in public interface Testable
           String car="Mazda";
    }and it would compile and still be implicitly public

  • Constant values (public static final String) are not shown??

    This has already been posted and no body answered. Any help is appreciated.
    In web service is it possible to expose the Constants used in the application. Let say for my web service I need to pass value for Operation, possible values for this are (add, delete, update). Is it possible expose these constant values(add, delete, update) visible to client application accesssing the web service.
    Server Side:
    public static final String ADD = "ADDOPP";
    public static final String DELETE = "DELETEOPP";
    public static final String UPDATE = "UPDATEOPP";
    client Side: mywebserviceport.setOperation( mywebservicePort.ADD );
    thanks
    vijay

    Sure, you can use JAX-WS and enums.
    For example on the server:
    @WebService
    public class echo {
    public enum Status {RED, YELLOW, GREEN}
    @WebMethod
    public Status echoStatus(Status status) {
    return status;
    on the client you get.
    @WebService(name = "Echo", wsdlLocation ="..." )
    public interface Echo {
    @WebMethod
    public Status echoStatus(
    @WebParam(name = "arg0", targetNamespace = "")
    Status arg0);
    @XmlEnum
    public enum Status {
    GREEN,
    RED,
    YELLOW;
    public String value() {
    return name();
    public static Status fromValue(String v) {
    return valueOf(v);
    }

  • Public Folder Item Age Limits

    Hello,
    I am looking for information on how to configure item retention for public folders/public folder mailboxes in Exchange 2013.
    I have migrated the public folder hierarchy successfully from Exchange 2010 to Exchange 2013.
    The public folder item retention used to be managed on a per folder basis using the "(LocalReplicaAgeLimit) Age limit for replicas days" parameter in Exchange 2010, and I found this worked quite well in removing items that had passed the configured
    expiry threshold.
    The folders that needed a different age limit setting were exempted from inheriting the public folder database defaults, and granted a specific value.
    These settings have not been carried over during the migration however, so now all public folders are inheriting the organization defaults for retention - which is $null.
    Now that the public folder hierarchy is on Exchange 2013 and is mailbox based, what is the recommended method for granular public folder item retention.
    I see that each folder the following settings can be configured Limits > Age Limits: Age limit for folder content (days) which looks like the setting I would need to configure, however, the technet text surrounding this parameter states:
    Cmdlet: Set-PublicFolder
    Parameter: AgeLimit
    The AgeLimit parameter
    specifies the overall age limit on the folder. Replicas of this public folder are automatically deleted when the age limit is exceeded.
    https://technet.microsoft.com/en-us/library/aa998596(v=exchg.150).aspx
    Does this mean the folder gets deleted once the limit has been reached - or just the items within?
    Now that public folders are mailbox based, what effect (if any) do retention tags/policies have on public folder mailboxes
    - can item retention be managed this way?
    Thanks
    Matt

    Hi Matt,
    The AgeLimit parameter in Set-PublicFolder cmdlet is based on folder level.
    The AgeLimit parameter in Set-Mailbox cmdlet is based on mailbox level.
    For more information on how to set retention policy for public folder, please refer following article:
    Limits for public folders
    https://technet.microsoft.com/en-us/library/dn594582(v=exchg.150).aspx
    Thanks
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Mavis Huang
    TechNet Community Support

  • Problems with string arrays

    Previous task was:
    Write a class "QuestionAnalyser" which has a method "turnAnswerToScore". This method takes a String parameter and returns an int. The int returned depends upon the parameter:
    parameter score
    "A" 1
    "B" 2
    "C" 3
    other 0
    Alright, here's the recent task:
    Write another method "turnAnswersToScore". This method takes an array of Strings as a parameter, works out the numerical score for each array entry, and adds the scores up, returning the total.
    That's my code:
    class QuestionAnalyser{
    public static int Score;
    public String[] Answer;
    public static void main(String[] args) {}
         public int turnAnswerToScore(String[] Answer)
    for (int i = 0; i < Answer.length;i++) {
    if (Answer.equals("A")) {
    Score = Score + 1; }
    else if (Answer[i].equals("B")) {
    Score = Score + 2;}
    else if (Answer[i].equals("C")) {
    Score = Score + 3;}
    else {
    Score = Score + 0;}
    return Score;
    this is the error message I get:
    The results of trying to compile your submission and run it against a set of test data was as follows:
    ----------Compilation output--------------------------------------
    javac QATest2.java
    QATest2.java:15: cannot resolve symbol
    symbol : method turnAnswersToScore (java.lang.String[])
    location: class QuestionAnalyser
    if(qa.turnAnswersToScore(task)!=total){
    ^
    What went wrong?
    Suggestions would be greatly appreciated!

    If I declare int score in the method i get this message
    The results of trying to compile your submission and run it against a set of test data was as follows:
    ----------Compilation output--------------------------------------
    javac QATest2.java
    ./QuestionAnalyser.java:20: variable score might not have been initialized
    score++; }
    ^
    ./QuestionAnalyser.java:23: variable score might not have been initialized
    score++;
    ^
    ./QuestionAnalyser.java:27: variable score might not have been initialized
    score++;
    ^
    ./QuestionAnalyser.java:34: variable score might not have been initialized
    return score;
    ^
    4 errors
    ----------Sorry expected answer was-------------------------------
    The method turnAnswersToScore is working OK - well done!
    ----------Your answer however was---------------------------------
    Exception in thread "main" java.lang.NoClassDefFoundError: QuestionAnalyser
         at QATest2.main(QATest2.java:4)
    This is the message I get from the submission page, but trying to compile it I get the same messages.
    The code looks like this, then
    class QuestionAnalyser{
    String[] answer;
    public static void main(String[] args) {}
         public int turnAnswersToScore(String[] answer)
    int score;
    for (int i = 0; i < answer.length; i++) {
    if (answer.equals("A")) {
    score++; }
    else if (answer[i].equals("B")) {
    score++;
    score++; }
    else if (answer[i].equals("C")) {
    score++;
    score++;
    score++; }
    else {}
    return score;
    When I leave 'public int score;' where it was before (right after the class declaration below the declaration of the string array) I get this but it compiles normally.
    The results of trying to compile your submission and run it against a set of test data was as follows:
    ----------Compilation output--------------------------------------
    javac QATest2.java
    ----------Sorry expected answer was-------------------------------
    The method turnAnswersToScore is working OK - well done!
    ----------Your answer however was---------------------------------
    wrong answer in turnAnswersToScore for
    BDCAADDCA
    Alright, even university students need to sleep :-)
    Good night.

  • Using Convert to handle NULL values for empty Strings ""

    After having had the problem with null values not being returned as nulls and reading some suggestion solution I added a converter to my application.
      <converter>
        <converter-id>NullStringConverter</converter-id>
        <converter-for-class>java.lang.String</converter-for-class>
        <converter-class>com.j2anywhere.addressbookserver.web.NullStringConverter</converter-class>
      </converter>
    ...I then implemented it as follows:
      public String getAsString(FacesContext context, UIComponent component, Object object)
        System.out.println("Converting to String : "+object);
        if (object == null)
          System.out.println("READING null");
          return "NULL";
        else
          if (((String)object).equals(""))
            System.out.println("READING null (Second Check)");
            return null;       
          else
            return object.toString();
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        System.out.println("Converting to Object: "+value+"-"+value.trim().length());
        if (value.trim().length()==0 || value.equals("NULL"))
          System.out.println("WRITING null");
          return null;
        else
          return value.toUpperCase();
    ...I can see that it is converting my values, however the object to which the inputText fields are bound are still set to empty strings ""
    <h:inputText size="50" value="#{addressBookController.contactDetails.information}" converter="NullStringConverter"/>Also when reading the object values any nulls are already converted to empty strings before ariving at the converter. It seems that there is a default converter handling string values.
    How can I resolve this problem as set nulls when the input value is an empty string other then checking every string in my class individually. I would really hate to pollute my object model with empty string tests.
    Thanks in advance
    Edited by: j2anywhere.com on Oct 19, 2008 9:06 AM

    I changed my converter as suggested :
      public Object getAsObject(FacesContext context, UIComponent component, String value)
        if (value == null || value.trim().length() == 0)
          if (component instanceof EditableValueHolder)
            System.out.println("SUBMITTED VALUE SET TO NULL");
            ((EditableValueHolder) component).setSubmittedValue(null);
          else
            System.out.println("COMPONENT :"+component.getClass().getName());
          System.out.println("Converting to Object: " + value + "< to " + null);
          return null;
        System.out.println("Converting to Object: " + value + "< to " + value);
        return value;
      }which produces the following output :
    SUBMITTED VALUE SET TO NULL
    Converting to Object: < to null
    Info : The INFO line however comes from my controller object where I print out the set value :
    package com.simple;
    import java.util.ArrayList;
    import java.util.List;
    public class Controller
      private String information;
      /** Creates a new instance of Controller */
      public Controller()
        System.out.println("Createing Controller");
        information = "Constructed";
      public String process()
        System.out.println("Info : "+getInformation());
        return "processed";
      public String reset()
        setInformation("Re-Constructed");
        System.out.println("Info : "+getInformation());
        return "processed";
      public String setNull()
        setInformation(null);
        System.out.println("Info : "+getInformation());
        return "processed";
      public String getInformation()
        return information;
      public void setInformation(String information)
        this.information = information;
    }I also changes my JSP / JSF page a little. Here is the updated version
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%--
        This file is an entry point for JavaServer Faces application.
    --%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
      </head>
      <body>
        <f:view>
          <h:form>
            <h:inputText id="value" value="#{Controller.information}"/>
            <hr/>
            <h:commandLink action="#{Controller.process}">
              <h:outputText id="clicker" value="Process"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.reset}">
              <h:outputText id="reset" value="Reset"/>
            </h:commandLink>             
            <hr/>
            <h:commandLink action="#{Controller.setNull}">
              <h:outputText id="setNull" value="Set Null"/>
            </h:commandLink>             
          </h:form>
        </f:view>
      </body>
    </html>The converter is declared for the String class in the faces configuration file. From the log message is appears to be invoked, however the object is not set to null.
    I tested this with JSF 1.2_04-b20-p03 as well as 1.2_09-b02-FCS.
    any other suggestions what could be causing this.

Maybe you are looking for