Very inexperienced Sun Java coder , Help !!!! I  get NullPointerException

In Sun JKD1.5.0
programs
CalculatorInterface.java
Client.java ==> c[4]
Account.java ==> a[3]
CalculatorInterface ==> c[4] objects ==> a[3] objects
I have in CalculatorInterface.java
public class CalculatorInterface
// reference to class Client
private static final int maxClients = 4;
// constructor for client[] object array
private static client[] c = new client[maxClients];
private static int total,atotal;
private static int noClients;
etc
etc
public static void main (String[] args)
parameter definitions
code lines
c[noClients] = new client();
/ creates a new instance of client contained in c[]
total = noClients;
code lines
method calls
noClients++; // next c[]
termination
} // end of Main
CalculatorInterface Methods including
void WhatIsLeft()
... code ...
....code...
c[total].getAccount(atotal).setAmount_IS_Surplus(c[total].calcWeeklySurplus(salaryYrly,weeklyExpenses,isRes));
... code...
The line of code returns a NullPointerException and crashes the program !!! >_<
is not successfully calling methods in Account.java ..... ?????
=== === === === === === > AND : I have in Client.java
public class client
// references to object Account a[]
private static final int maxAccounts = 3;
private Account[] a = new Account[maxAccounts]; //? This references a[] to client
Client Methods including
public Account getAccount(int num)
return a[num]; // will be num = 0 or 1 or 2
} // end client
=== === ==== ===> AND in Account.java
public class Account
Account methods
SO ..... what's the fix ?
HELP !!!!! I know not what to do to fix this glitch.

And now I take the chance to ask someone...
Where is that forum to discuss about the
forums?
deleted
Damn! <sarcasm> I love you Sun. </sarcasm>

Similar Messages

  • Very new to java please help

    i'm very new to java and i'm getting an error in my application. i took 4 applications that compiled and worked separatly and i tried to combine them into one application. i'm getting the error: unreported exception java.io.IOException; must be caught or declared to be thrown, in lines 73,78,83,88,120,146,149,152,155 in the and it points at the keyboard.readLine() but everything i've tried just gives me more errors. please help anything and everything will be greatly appreciated. here it is, sorry about format i dunno how to straighten it in here:
    // ^ ^
    //               (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
         static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
         static PrintWriter screen = new PrintWriter(System.out, true);
         public static void main (String[] args) throws IOException
              double hoursa, minutesa, secondsa;
              String hours;
              System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
              System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // An application that finds the distance between two points when the points
    // are given by the user.
              double x1, x2, y1, y2, total, distance;
              String xa;
              System.out.print ("Please enter the 'x' coordinate of first point: ");
              xa = keyboard.readLine();
              x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
              String ya;
              System.out.print ("...also need the 'y' coordinate of first point: ");
              ya = keyboard.readLine();
              y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
              String xb;
              System.out.print ("...and the 'x' coordinate of the second point: ");
              xb = keyboard.readLine();
              x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
              String yb;
              System.out.print ("...don't forget the 'y' coordinate of the second point: ");
              yb = keyboard.readLine();
              y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
              total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
              distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
              System.out.print ("E=mc^2...oh and,");
              System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
              xb + "," + yb + ") is : " + distance);
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
              double radius,volume,area;
              String rad;
              System.out.print("Please enter the radius of a sphere: ");
              rad = keyboard.readLine();
              radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
              volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
              System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
              area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
              System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
              int pennies, nickels, dimes, quarters;
              double money1;
              screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
              int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
              screen.println("How many dimes?: ");
              int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
              screen.println("How many nickels?: ");
              int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
              screen.println("How many pennies?: ");
              int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
              NumberFormat money = NumberFormat.getCurrencyInstance();
              money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
              screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money

    Ok here is the working code as one long function:
    // ^ ^
    // (0)(0) A Happy Piggy Application
    // Problems: 2.6,2.8,2.9,2.12 (oo)
    // An application finds the total number of hours, minutes, & seconds, finds the distance
    // between two points, finds the volume and surface area of a sphere, and adds up the change
    // in a jar. First, the total hours, minutes, and seconds problem.
    import java.io.*;
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
    public class twoptsix
        static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
        static PrintWriter screen = new PrintWriter(System.out, true);
        public static void main (String[] args) throws IOException
    double hoursa, minutesa, secondsa;
    String hours;
    System.out.print ("Please enter a number of hours: ");
    hours = keyboard.readLine();
    hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
    String minutes;
    System.out.print ("Please enter a number of minutes: ");
    minutes=keyboard.readLine();
    minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
    String seconds;
    System.out.print ("Pretty please enter a number of seconds: ");
    seconds = keyboard.readLine();
    secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
    double allseconds;
    allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
    System.out.println ("You have: " + hours + " hours..."); //displays hours
    System.out.println ("" + minutes + " minutes..."); //displays minutes
    System.out.println ("and " + seconds + " seconds..."); //displays seconds
    System.out.println ("to get whatever you need to done!"); //witty attempt at humor
    System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
    // }  <----- MAIN FUNCTION USED TO END HERE!!!
    //but we want to keep going so remove the bracket!
    // An application that finds the distance between two points when the points
    // are given by the user.
    // {  <-- other function used to start here, but now it continues
    double x1, x2, y1, y2, total, distance;
    String xa;
    System.out.print ("Please enter the 'x' coordinate of first point: ");
    xa = keyboard.readLine();
    x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
    String ya;
    System.out.print ("...also need the 'y' coordinate of first point: ");
    ya = keyboard.readLine();
    y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
    String xb;
    System.out.print ("...and the 'x' coordinate of the second point: ");
    xb = keyboard.readLine();
    x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
    String yb;
    System.out.print ("...don't forget the 'y' coordinate of the second point: ");
    yb = keyboard.readLine();
    y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
    total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
    distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
    System.out.print ("E=mc^2...oh and,");
    System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
         xb + "," + yb + ") is : " + distance);
    //second function used to end here...
    //} <--- COMMENT OUT BRACKET SO WE CONTINUE
    // An application that takes the radius of a sphere and finds and prints
    // the spheres volume and surface area.
    //{ <--- ANOTHER ONE TO COMMENT OUT
    double radius,volume,area;
    String rad;
    System.out.print("Please enter the radius of a sphere: ");
    rad = keyboard.readLine();
    radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
    DecimalFormat fmt = new DecimalFormat ("0.####");
    volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
    System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
    area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
    System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
    // } <----- COMMENTED OUT FOR THE SAME REASON
    // An application that finds the total, in dollars and cents, of a number of quarters,
    // nickels, dimes, and pennies in your piggy bank.
    //{ <----AND ANOTHER
    int pennies, nickels, dimes, quarters;
    double money1;
    screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
    int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
    screen.println("How many dimes?: ");
    int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
    screen.println("How many nickels?: ");
    int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
    screen.println("How many pennies?: ");
    int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
    NumberFormat money = NumberFormat.getCurrencyInstance();
    money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
    screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money
    }P.S. To make the code formatted better put [ code ] before and [ /code ] after. It's not perfect, but a little better...

  • Search java code help

    I am writing a small Java program and need help using a simple search code. Here is the code
    public int indexOf(EltType e) {
            int i=0;
            for (i = currsize; i < currsize; i++){
                things[i] = e;
                e.equals(get(i));
            return -1;
        }Basically I want to search the array for e, and return its position, or -1 if e is not found. I know I have to use .equals(i) to compare e and get(i) but unsure where it goes.
    Here is the method that calls it:
    public void searchtester() {
            MyList<String> searchlist = new MyList<String>();
            searchlist.add("tangerine");
            searchlist.add("apple");
            searchlist.add("mango");
            searchlist.add("lime");
            searchlist.add("carrot");
            for (int i = 0; i<searchlist.size(); i++)
            System.out.println("searching for \"" + searchlist.get(i) + "\", result="
                + words.indexOf(searchlist.get(i)));
        }Please let me know what I am doing wrong.

    middle wrote:
    sorry kevinaworkman, not trying to ignore any advice, just very new to java so trying to figure this out. It's okay, I just know from experience that breaking it up into smaller pieces will save you a ton of headaches.
    Ok so I would imagine that loop:
    for (i = currsize; i < currsize; i++)would run onceTake a look at the tutorial on [the for statement|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html] . If i starts out equal to currsize, and is only ever incremented, when will it be less than currsize? But even assuming that the loop runs once, what good would that be? Wouldn't you want the loop to run as many times as there are elements in your array?
    things[i] = e;I'll give you a hint: if this line were executed, it would set the element at position i in the array equal to e. You want to check for equality, not set the whole array equal to e, right? Do you mean == in an if statement?
    e.equals(get(i));Again, if this line was executed, it would check for equality between e and whatever get(i) returns. But then what are you doing with that boolean?
    I want to see if i is equal to e then the result I want is the position of e and if i does not equal e then I want it to result in a -1, the issue is that it is giving me "-1" for all the results when I know that the first 3 items are in the list.You might want to step through your program with a debugger to see what's happening line by line. Or better yet, step through it with a piece of paper and a pencil. Go through the program as if you were the computer, following your program (and not the logic in your head you think the program does) exactly.
    Some other things you might want to consider: the [if statement|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html] , arrays , and the above mentioned for loop tutorials.

  • Also VERY frustrated:  No java-code executing within JSP

    Hi!
    I'm completely frustrated at last! It must be possible to install tomcat/apache correct but I'm not able to do so!
    New problem:
    I try to view a jsp with IE6 by selecting File\Open. If I choose the copy at '\tomcat\webapps\examples\WEB-INF\jspjbex4.jsp' suddenly Dreamweaver opens and show me the code of 'jbex4.jsp'. When I open a copy of jbex4.jsp located anywhere else on my computer the jsp is shown, but the problem is: No javabean-code is used although it is coded correctly.
    I guess the problem is with some classpath or something quite simillar. When I try to view the examples delivered by tomcat I've got the same problem: Whereever there should be output generated by java-code (e.g. by calling a method like <%= test.getDM() %>) there's nothing!!!!!
    So I checked if apache is working correctly. The test page is shown correctly. So the error must occure somewhere under tomcat. But when starting tomcat I receive no error message..
    Can anyone please help me?
    Thanx a lot!!!!!
    p.s. Yes, 'Normal' java-code is executed fine!

    With tomcat 1.3.3 you place the xml file with the context mapping in the conf folder under the tomcat install directory. You must give the xml file a name that starts with "apps-" followed by something unique, followed by ".xml". So for examle apps-testapp.xml is good. Inside the xml file place the code I gave you above then restart tomcat. Make sure to change the docBase value to the directory that contains your WEB_INF folder and change the path to whatever you want. If the path is set to "/" then you would use the url http://www.yourdomain.com/yourjsp.jsp. If the path is set to "/TestApp" then you use the URL http://www.yourdomain.com/TestApp/yourjsp.jsp.
    For newer version of tomcat I am not sure exactly where the context mapping goes. Instead of in an apps-xyz.xml file it might go in tomcats server.xml file which should also be in the conf directory in the tomcat install directory.
    Each webapp has its own config file which should be at /WEB-INF/web.xml. Look on google or something about that. All your classes go in /WEB-INF/classes/package.name/class.class.
    Put your class files into packages!
    for you you should put your bean at /WEB-INF/classes/testpackage/JspTest.class.
    In the code for JspTest.java place "package testpackage;" at the top then recompile. In your JSP file use <jsp:useBean id="ex4" scope="session" class="testpackage.JspTest" />
    -S-

  • Sun Java Roadmap Help

    I am a product manager in Intel IT department. we use Sun Java in our client envionment. and we are doing planning for Vista and IE7 rollout. where can we get some roadmap information for Sun Java to support 64 bit IE7 and 64 bit Vista? and is the Sun Java roadmap information published anywhere?

    And now I take the chance to ask someone...
    Where is that forum to discuss about the
    forums?
    deleted
    Damn! <sarcasm> I love you Sun. </sarcasm>

  • Urgent java code help needed

    i need java code for writing following lines in a file
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
    Moreover i need code for reading word by word html file.
    PLease reply as soon as possible.
    iwapsms

    for the html-part there are several html-parser, that bould whole parsetrees, which you can traverse (walk) through as you whish. just check google for it (something like: java html parser).
    if that xml you have there is in String-form, just use a Filewriter
    BufferedWriter writer = new BufferedWriter (new FileWriter (new File ("FilePath/filename.xml")));
    writer.write (xmlString);
    writer.close();however, if you have to juggle xml tags, content and attributes a lot, i'd recomend jdom to construct the xml and saxParser to write it.
    again jsut google for it.

  • First individual java project, help to get started

    Hi first of let me introduce myself,
    I am Koos, 16.75 years old and from Holland. At school we are learning or suppossed to learn java language, that's how I got interested in java, anyway it isn't going that great so far.
    But I already created my first assignment a tool which counts the letters in a word, in a JFrame of course to make it look better.
    I use Eclipse to program java (what is in you opinion the best program to program in java?) and have of course installed the JDK.
    Now to get to the point, I want to contribute to a site I often visit to make a java calculation applet.
    The main Idea is to make a new window where calculations are done by multiple inputs and outputs. It's doing some simple maths such as percentage, division and multiplication.
    I would like to implement different data (different currency (Eur,Usd,Gbp) and pairs(EurChf,EurGbp GbpChf and UsdCad), and then all options possible,
    from [this tool|http://www.goforex.net/pip-calculator.htm] , could that be possible to automate or is it better to manually put in?
    I will update in an hour or so with a formula, if you would like, I already have the principal in excel so I could upload that if you'd like that.
    Regards,
    Koos

    Hi I have written the part for the window and the input fields but the fields don't show up what's wrong in the code?
    import javax.swing.*;
    public class Window extends JFrame {
         public static void main(String[] args){
              new Window();
         public Window() {
         JFrame frame = new JFrame("Fapturbo LRR calculator");
              this.setSize(500, 400);
              this.setVisible(true);
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel area = new content;
              this.setContentPane(content);
              this.setVisible(true);
              this.setLocationRelativeTo(null)
    class content extends JPanel {
         private JLabel Lotsriskreduction,equity,priceEURGBP,priceEURCHF,priceUSDCAD,priceGBPCHF;
         private JButton Calculate;
         private int inputLRR,inputEQ,inputP1,inputP2,inputP3,inputP4;
         private JTextField input1;
         public content() {
              this.setLayout(null);
              input1 = new JTextField();
              this.add(input1);
              input1.setBounds(24, 80, 210, 20);
              /// Here comes the calculation folowing the formula I posted before including their outputs/
              //in the same kind of field as the input.
              Calculate = new JButton("Calculate");
              Calculation kh = new Calculation();
    }regards,
    Koos

  • Java code help needed for If-elseif statement

    HI All,
    Apologies for posting such a trivial thing but I am a novice in Java.
    All I need is to code an If elseIF statement.
    I tried the code below
    String w = "SAPA";
    String x = "SAPB";
    if (a==w) ;
    {Channel channel = LookupService.getChannel("BS_PROD","CC_RFC_LOOKUP");}
    else if (a==x)
    { Channel channel = LookupService.getChannel("BS_PROD","CC_RFC_LOOKUP_ECQ"); }
    It came back with the error
    Source code has syntax error:  D:/usr/sap/XRD/DVEBMGS02/j2ee/cluster/server0/./temp/classpath_resolver/Map695b77619ad011dd8d0b001a4b52813a/source/com/sap/xi/tf/_MM_TRANSMISSION_CHECK_TO_GENIUS_.java:324: 'else' without 'if' else if (a==x) ^ 1 error
    Appreciate if you could let me know the correct code.
    Many thanks
    Shirin

    HI Aamir,
    After I removed the semi-colon iIt came back with the following error
    Source code has syntax error:  D:/usr/sap/XRD/DVEBMGS02/j2ee/cluster/server0/./temp/classpath_resolver/Map1d9b43e09ad111dd84b7001a4b52813a/source/com/sap/xi/tf/_MM_TRANSMISSION_CHECK_TO_GENIUS_.java:328: cannot resolve symbol symbol : variable channel location: class com.sap.xi.tf._MM_TRANSMISSION_CHECK_TO_GENIUS_ accessor = LookupService.getRfcAccessor(channel); ^ 1 error
    Just for reference my entire Jave UDF looks like this:
    //write your code here
    String w = "SAPA";
    String x = "SAPB";
      String content = "";
    MappingTrace importanttrace;
    importanttrace = container.getTrace() ;
    //Filling the string with our RFC-XML (With Values)
    String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:ZIFMS_GET_NEXT_NUMBER xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><I_NR_RANGE_NR>01</I_NR_RANGE_NR><I_OBJECT>ZIFMS_INT</I_OBJECT></ns0:ZIFMS_GET_NEXT_NUMBER>";
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    try
    //1. Determine a channel (Business System, Communication channel)
    if (a==w)
    {Channel channel = LookupService.getChannel("BS_PROD","CC_RFC_LOOKUP");}
    else if (a==x)
    { Channel channel = LookupService.getChannel("BS_PROD","CC_RFC_LOOKUP_ECQ"); }
    //2. Get a RFC accesor for a channel.
    accessor = LookupService.getRfcAccessor(channel);
    //3. Create a xml input stream representing the FM request message.
    InputStream inputstream = new ByteArrayInputStream(m.getBytes());
    //4. Create xml Payload
    XmlPayload payload = LookupService.getXmlPayload(inputstream);
    //5. Execute Lookup
    Payload result = accessor.call(payload);
    InputStream in = result.getContent();
    //This are the extra step which i dont know what it mean
    //out = new ByteArrayOutputStream(1024);
    //byte[] buffer = new byte1024;
    //for (int read = in.read(buffer); read > 0; read = in.read(buffer))
    //out.write(buffer,0,read);
    //content = out.toString();
    try {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(in);
    NodeList list = document.getElementsByTagName( "E_NUMBER" );
    Node node = list.item(0);
    if (node != null)
    node = node.getFirstChild();
    if (node != null)
    content = node.getNodeValue();
    } catch (Exception e) {
    importanttrace.addWarning("Error while closing accesor" + e.getMessage());
    catch (LookupException e)
    importanttrace.addWarning("Error While lookup" + e.getMessage());
    //This exception is not to be catch at this step as there is no try step before this
    //catch (IOException e)
    //importanttrace.addWarning("Error" + e.getMessage());
    finally
    if(out!=null)
    try{
    out.close();
    } catch (IOException e) {
    importanttrace.addWarning("Error while closing system" + e.getMessage());
    //7. close the accessor in order to free resources
    if (accessor!=null) {
    try{
    accessor.close();
    } catch (Exception e) {
    importanttrace.addWarning("Error while closing accesor" + e.getMessage());
    return content;

  • Very new in Java pls help!!!!!!

    hello,
    i just started to learn java and trying to do my first program, but dont know why i cant do that! it asking me to set my PATH in sdk bin folder with jdk and i dont know how to do that, couse i install it in diferent folders! im trying to set c:\jdk1.6\bin;%PATH% but writing "environment variable c:jdk1.6\bin;C:\windows\system32;C:\windows;C:\windowasystem32\wbem;C;\program files\cyberlink\power2Go\C:\sun\SDK\bin not defined" help me please!!!

    - Right click 'my computer', select 'properties'.
    - Click the 'advanced' tab.
    - click the 'environmental variables' button
    Here you will find the PATH environmental variable, most likely under system variables. Add the path to the JDK bin directory here.
    Note: If you have a command prompt open while you are doing this, open a new one as the old one will not see the changes you make. To make sure the PATH is valid, open a command prompt and type:
    echo %PATH%

  • Java Code Help-Palindromes

    Sorry to trouble anyone, but I need help with coding a program dealing with Palindromes. I have some of the code already down, but I'm having trouble having the program recognize certain words as Palindromes (e.g. Racecar, madam, etc.). Note that this program is also case-sensitive. So I was just wondering if anyone had any code that could fix this maybe? If you do, it'd be appreciated. Thanks

    public static void main(String[] args)
              String strPalin = null;
              if(args[0] != null)
                   strPalin = args[0];
              byte[] b = strPalin.getBytes();
              int strlen = b.length;
              int i = (strlen - 1);
              int j = 0;
              byte[] c = new byte[strlen];
              while(i>-1)
                   c[j] = b;
                   i--;
                   j++;
              String strrev = new String(c);
              if(strrev.equals(strPalin))
                   System.out.println("Oops its a Palindrome:" +strPalin);
              }else{
                   System.out.println("its not a Palindrome: " +strPalin);
    hi,
    plz check it out , it may serve ur requirement i think .
    keep mail to [email protected]

  • Need Java code Help

    Hi All,
    I need your hlep...
    I have a javamapping where it should read the webservice response and transform into the target structure..
    Webservice response is
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:MT_WS_Response xmlns:ns1="http://RFC_Lookup/XI">
    <row>
    <ID>001</ID>
    <KEY>Matnr</KEY>
    <VALUE>34567</VALUE>
    </row>
    <row>
    <ID>002</ID>
    <KEY>Matnr</KEY>
    <VALUE>34567</VALUE>
    </row>
    <row>
    <ID>003</ID>
    <KEY>Matn33</KEY>
    <VALUE>34567</VALUE>
    </row>
    </ns1:MT_WS_Response>
    I should read the above structure and output it into a payload string variable ...
    i have declared variables also
    public void execute(InputStream in, OutputStream out)
              try
                   trace.addInfo("Start of Extraction");
                   OutputStream temp = new ByteArrayOutputStream(1024);
                   byte[] buffer = new byte[1024];
                    for (int read = in.read(buffer); read > 0; read = in.read(buffer))
                         temp.write(buffer, 0, read);
                   String Payload = temp.toString();
                   final String STARTTAG = "<row>";
                   final String ENDTAG = "</row>";
                   int Y_FILENAME_START  = Payload.indexOf(STARTTAG);
                   int Y_FILENAME_END = Payload.indexOf(ENDTAG);
                   int spos = Y_FILENAME_START+STARTTAG.length();
                   <b>if ( ( Y_FILENAME_END > spos) && (Y_FILENAME_END > 0 ) )</b>               {
                        Payload = Payload.substring(Y_FILENAME_START+STARTTAG.length() , Y_FILENAME_END);
                        trace.addInfo("Sucessfully Extracted");
    Please suggest whether how can i read multiple rows .. as i am ABAPER i am unable to do it in Java..
    I think the bold one reads only single row ... please suggest for reading multiple rows...
    Thanks and Regards,
    sridhar reddy
    Message was edited by:
            sridhar reddy kondam

    Please tell us what is the expected target structure.
    Also, avoid to treat xml like strings. Use parsing methods (SAX, DOM). It is way easier, and they are mainly the reason why you should use java mappings over ABAP mappings.
    Regards,
    Henrique.

  • Sick and tired of all the problems with itunes gift card codes.HELP me get this thing to exectp the stupid code!!!

    Stop this insanity!! These gift card problems need to be sorted out or we are done with itunes all together.

    Stop this insanity!!
    You're not talking directly to Apple folks here, nord. We're a user-to-user troubleshooting forum.
    If you want to guarantee that an Apple person hears you, you could try using the iTunes product feedback form. Here's a link to that:
    http://www.apple.com/feedback/itunesapp.html
    Just checking (while you're here) ... have you contacted the iTunes Store about your particular gift card issue, as per the following document?
    iTunes Store: Invalid, inactive, or illegible codes
    ... or are you having a different sort of trouble with your gift card?

  • Java code help

    I have a class L1 in which I am creating an instance of another class Nav
    like
    Nav nav = new Nav(class.L2);
    the argument in this Nav, shoukd be a class name how can I pass a classname as a argument. is it class.L2 or how?
    In the Nav constructor I want to create a new instance of the class argument that was passed. How can I do this is there a way to do so? Thanks.

    Try with:
    Nav nav = new Nav(L2);
    // this will call the constructor that looks like:
    Nav(Class cl) { ... }

  • How to get the filters of Webi document/Report using Java code in XI SDK.

    Hi All,
       I have a requirement where i have to extrcat filters from the Webi Document.using java SDK.
    I am trying to find the class called "filterable"but not able to use in my java code and will get always
    "java.lang.ClassCastException  com.businessobjects.wp.om.OMDocument cannot be cast to com.businessobjects.rebean.wi.Filterable"
    I am using the below java code like
    ReportElement re=document.getStructure()
    FilterContainer flt=((Filterable) re).getFilter()
    I am stuck and need this in uregent.
    Please help.

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • Please help me in compiling the enclosed java code

    Iam trying to compile the below mentioned java code and iam getting this error: I have Weblogic 6.1 + sp2 installed on my machine. Please help !
    The error is :
    C:\bea\jdk131>javac Browser.java
    Browser.java:17: cannot resolve symbol
    symbol : class JIconButton
    location: class Browser
    private JIconButton homeButton;
    ^
    Browser.java:25: cannot resolve symbol
    symbol : class ExitListener
    location: class Browser
    addWindowListener(new ExitListener());
    ^
    Browser.java:26: cannot resolve symbol
    symbol : variable WindowUtilities
    location: class Browser
    WindowUtilities.setNativeLookAndFeel();
    ^
    Browser.java:30: cannot resolve symbol
    symbol : class JIconButton
    location: class Browser
    homeButton = new JIconButton("home.gif");
    ^
    4 errors
    THE CODE IS HERE :
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Browser extends JFrame implements HyperlinkListener,
    ActionListener {
    public static void main(String[] args) {
    if (args.length == 0)
    new Browser("http://www.apl.jhu.edu/~hall/");
    else
    new Browser(args[0]);
    private JIconButton homeButton;
    private JTextField urlField;
    private JEditorPane htmlPane;
    private String initialURL;
    public Browser(String initialURL) {
    super("Simple Swing Browser");
    this.initialURL = initialURL;
    addWindowListener(new ExitListener());
    WindowUtilities.setNativeLookAndFeel();
    JPanel topPanel = new JPanel();
    topPanel.setBackground(Color.lightGray);
    homeButton = new JIconButton("home.gif");
    homeButton.addActionListener(this);
    JLabel urlLabel = new JLabel("URL:");
    urlField = new JTextField(30);
    urlField.setText(initialURL);
    urlField.addActionListener(this);
    topPanel.add(homeButton);
    topPanel.add(urlLabel);
    topPanel.add(urlField);
    getContentPane().add(topPanel, BorderLayout.NORTH);
    try {
    htmlPane = new JEditorPane(initialURL);
    htmlPane.setEditable(false);
    htmlPane.addHyperlinkListener(this);
    JScrollPane scrollPane = new JScrollPane(htmlPane);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    } catch(IOException ioe) {
    warnUser("Can't build HTML pane for " + initialURL
    + ": " + ioe);
    Dimension screenSize = getToolkit().getScreenSize();
    int width = screenSize.width * 8 / 10;
    int height = screenSize.height * 8 / 10;
    setBounds(width/8, height/8, width, height);
    setVisible(true);
    public void actionPerformed(ActionEvent event) {
    String url;
    if (event.getSource() == urlField)
    url = urlField.getText();
    else // Clicked "home" button instead of entering URL
    url = initialURL;
    try {
    htmlPane.setPage(new URL(url));
    urlField.setText(url);
    } catch(IOException ioe) {
    warnUser("Can't follow link to " + url + ": " + ioe);
    public void hyperlinkUpdate(HyperlinkEvent event) {
    if (event.getEventType() ==
    HyperlinkEvent.EventType.ACTIVATED) {
    try {
    htmlPane.setPage(event.getURL());
    urlField.setText(event.getURL().toExternalForm());
    } catch(IOException ioe) {
    warnUser("Can't follow link to "
    + event.getURL().toExternalForm() + ": " + ioe);
    private void warnUser(String message) {
    JOptionPane.showMessageDialog(this, message, "Error",
    JOptionPane.ERROR_MESSAGE);

    I got this code from this forum concerning MONITORING some application. Iam working on writing something which can monitor the availabilty of my application on the browser. Iam not familiar with swings so i got confused with compiling this code.
    Please let me know if you know some code that can help me monitor my web based application.
    Thanks in advance.

Maybe you are looking for

  • TypeError: Error #1009: Cannot access a property or method of a null object reference.

    Hi all, I am new to ActionScript and Flash, and I am getting this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at jessicaclucas_fla::MainTimeline/stopResumescroll() I have several different clips in on

  • Installing XL reporter

    HI all, How would i install the xl reporter? i'm using SAP B1 2005 A SP01 PL:36 Anyone can help me? Thanks. Harith

  • Macbook Air Ethernet USB Adapter an Energy Hog??

    Hey to all, Recently picked up a MBA and am very happy with it. The only problem I've had is if I connect the USB Ethernet adapter (to get wireline ethernet at a few places where there is no wireless) my battery times are DRAMATICALLY reduced (by lik

  • Ttatsc: cannot open display 'unix:10'

    Hi, in integrated an winxp-"server" (winxp, windows-rdp-application) into SGD v4.40.917 running on fedora-core8. If i log in to SGD and start the application, i got the Error message shown below. If i connect via "ssh -X" to the SGD server and run rd

  • Integrating OM/PA to use as target group hierarchy for web survey

    Hi there, I am planning to use the existing PA and OM structure from R/3 system to be use as the Recipients(Target Group Hierarchy)of the Web Survey/Questionnaire. Need anyone's advice on how to go about the connection (betw. R/3 and SEM) whether to