[help] Java Exercise

I'm using the Java: How to program(Deitel ed.6 Chapter3) book and when i try to compile the source code, I get some error message.
public class GradeBookTest
     public static void main( String[] args )
          GradeBook gradeBook1 = new GradeBook("CS101 Introduction to Java Programming");
          GradeBook gradeBook2 = new GradeBook("CS102 DataStructures in Java");
          System.out.println("gradeBook1 course name is: %s\n", gradeBook1.getCourseName());                                         
          System.out.println("gradeBook2 course name is: %s\n ",gradeBook2.getCourseName());                                         
public class GradeBook
     private String courseName;
     public Gradebook(String name)
          courseName = name;
     public void setCourseName( String name )
          courseName = name;
     public String getCourseName()
          return courseName;
     public void displayMessage()
          System.out.printf("Welcome to the grade book for\n%s!\n", getCourseName());
}using the command prompt
I tried
javac GradeBook.java GradeBookTest.java
the error message i get is something like this
>
GradeBook:7:invalid method declaration; return type required
public GradeBook(String name)
^
thank you for your help

constructor for GradeBook must be exactly
public GradeBook(String)
// not Gradebook(String)

Similar Messages

  • Java exercises and solutions

    Hi all,
    Iam newbie to this forum and java too.Iam doing studying on java as beginner.I would like to do more programming exercises in order to understand more on java language.Iam looking for the site or link where I could get exercises and solutions.Can anyone help me?.
    Thank you in advance
    Udd

    > I have > searched through google didn't get good
    materials.
    Thanking again for your help
    The first hit I got from
    [url=http://www.google.com/search?num=20&hl=en&safe=of
    f&q=%22java+exercises%22&spell=1]Google when
    searching for "java exercises" is this page:http://www.cafeaulait.org/books/jdr/exercises/
    The answers to the exercises are also available there.
    Of Course it's a matter of personal taste.
    However to my mind the best 'exercise' based tutorials are the MageLang
    ones you can find on this site , once you figure out how to download them.
    http://java.sun.com/developer/onlineTraining/GUI/
    http://java.sun.com/developer/onlineTraining/index.html

  • Looking for JAVA EXERCISES

    hello frndz,
    I m new newbie to java, i wuld like to know , if there are any online sites available
    that provide java exercises (for java newbies like me ) ?

    Why not study Sun's tutorials on Java? Here they are: http://java.sun.com/docs/books/tutorial/index.html
    They're all online and there are quite some questions you can answer and
    exercises too ...
    kind regards,
    Jos

  • Help, Java newbie a little over my head with LDAP

    I'm actually a network admin but I've been dabling in Java for a little while now.
    I am trying to write an app that will allow me to insert and remove attributes to entries in Active Directory.
    I have found some sample code which I have altered to make a "proof of concept" before I start on the actuall app I want.
    The problem I am having is writing into the AD. I can query entries with no error but when I try a modification I get an "DSA is unwilling to perform" LDAPException. I am pretty sure it's not a permissions issue but from reading stuff on here I am begnining to think that it may have something to do with SSL connections. There is commented out code below where I experimented with this but I was unable to connect the the AD when this was in. "unable to connect to the directory server error".
    If anyone can offer me any advice I would be most grateful.
    package LDAPTest;
    import netscape.ldap.*;
    import java.util.*;
    import com.novell.service.ndssdk.jndi.ldap.ssl.*;
    // Simple program to experiment with searching LDAP
    public class FilterSearch
    public static void main(String[] args)
    if(args.length != 6)
    System.out.println("Usage: java FilterSearch " +
    "<host> <port> "+
    "<authdn> <password> "+
    "<basedn> <filter> ");
    System.exit(1);
    String host = args[0];
    int port = Integer.parseInt(args[1]);
    String authid = args[2];
    String authpw = args[3];
    String base = args[4];
    String filter = args[5];
    String[] ATTRS = {"memberOf"};
    int status = -1;
    //SSL experiment that would not connect to the AD server.
    //LDAPConnection ld = new LDAPConnection(new LDAPSSLSocketFactory("com.novell.service.ndssdk.jndi.ldap.ssl.LdapSecureSocketFactory"));
    LDAPConnection ld = new LDAPConnection();
    System.out.println("done connection");
    try
    //Connect to server and authenticate
    ld.connect(host, port,authid,authpw);
    System.out.println("Search filter = " +filter);
    LDAPSearchResults res = ld.search(base, ld.SCOPE_SUB, filter, null, false);
    //Loop on results until complete
    while(res.hasMoreElements())
    try
    //Next Directory entry
    LDAPEntry entry = res.next();
    prettyPrint(entry, ATTRS, ld);
    status=0;
    catch(LDAPReferralException e)
    System.out.println(e);
    continue;
    catch(LDAPException e)
    System.out.println(e.toString() );
    continue;
    LDAPAttribute atrib = new LDAPAttribute("memberOf", "CN=Tight VNC,OU=Staging Transmitter Channels,DC=marimba,DC=local");
    LDAPModification mod = new LDAPModification(LDAPModification.ADD, atrib);
    System.out.println(ld.isAuthenticated());
    try{
    // This is the code the throws the Exception DSA is unwilling to perform.
    ld.modify("CN=smstest0005,CN=MarimbaComputers,CN=Computers,DC=marimba,DC=local", mod);}
    catch(LDAPException e){
    System.out.println(e);}
    catch(LDAPException e)
    System.out.println(e.toString() );
    //Done, so disconnect
    if((ld!=null) && (ld.isConnected()))
    try
    ld.disconnect();
    catch(LDAPException e)
    System.out.println(e.toString());
    System.exit(status);
    public static void prettyPrint(LDAPEntry entry, String[] attrs, LDAPConnection ld)
    System.out.println("DN: " + entry.getDN());
    //Use array to pick attributes. We could have
    //enumerated them all user LDAPEntry.getAttributes
    //but this gives us control of the display order
    for(int i = 0; i < attrs.length; i++)
    LDAPAttribute attr = entry.getAttribute( attrs);
    if (attr == null )
    System.out.println(attrs[i] + " not present");
    continue;
    Enumeration enumVals = attr.getStringValues();
    //Enumerate on values for this attribute
    boolean hasVals = false;
    while ((enumVals!=null) && enumVals.hasMoreElements())
    String val = (String)enumVals.nextElement();
    System.out.println(attrs[i] + ": " + val);
    hasVals=true;
    if(!hasVals)
    System.out.println(attrs[i] + " has no values");
    System.out.println("----------------------");

    OK, I have learned a little about JNDI today and have attempted to implement this using JNDI instead.
    I am now getting the OperationNotSupportedException when attempting to add an attribute to an item in Active Directory.
    here's the code, can anybody who has managed to add data into AD help with this?
    cheers.
    package JNDI;
    import javax.naming.*;
    import javax.naming.directory.*;
    import java.util.*;
    class Getattr
    public static void main(String[] args)
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://hostname:389/");
    env.put(Context.SECURITY_PRINCIPAL, args[0]);
    env.put(Context.SECURITY_CREDENTIALS, args[1]);
    try {
    // Create the initial directory context
    DirContext ctx = new InitialDirContext(env);
    // Ask for all attributes of the object
    Attributes attrs = ctx.getAttributes("CN=smstest0005,CN=MarimbaComputers,CN=Computers,DC=marimba,DC=local");
    for (NamingEnumeration ae = attrs.getAll(); ae.hasMore();)
    Attribute attr = (Attribute)ae.next();
    System.out.println("attribute: " + attr.getID());
    /* Print each value */
    for (NamingEnumeration e = attr.getAll(); e.hasMore();System.out.println("value: " + e.next()));
    // Specify the changes to make
    ModificationItem mod[] = new ModificationItem[1];
    mod[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE,
    new BasicAttribute("memberOf", "CN=Tight VNC,OU=Staging Transmitter Channels,DC=marimba,DC=local"));
    ctx.modifyAttributes("CN=smstest0005,CN=MarimbaComputers,CN=Computers,DC=marimba,DC=local", mod);
    // Find the surname attribute ("memberOf") and print it
    //System.out.println("memberOf: " + attrs.get("memberOf").get());
    } catch (NamingException e) {
    System.err.println("Problem getting attribute:" + e);

  • Help java vendingMachine code runs doesn't work Why please help

    import java.util.*;
    public class Vend
         double costALL = 40.00;
         int invALL = 3;
         String nameALL = "ALLURE OF DARKNESS";
         double costJUD = 90.75;
         int invJUD = 2;
         String nameJUD = "JUDGMENT DRAGON ";
         double costCHA = 75.50;
         int invCHA = 3;
         String nameCHA = "CHARGE OF THE LIGHT BIRGADE";
         double costCRU = 399.99;
         int invCRU = 1;
         String nameCRU = "CRUSH CARD)";
         double costGORZ = 245.29;
         int invGORZ = 1;
         String nameGORZ = "GORZ THE EMISSARY OF DARKNESS";
         double costDAD = 220.00;
         int invDAD = 2;
         String nameDAD = "DARK ARMED DRAGON";
         double savedDeckpts = 100.00;
         double input = 0.00;
         double change = 0;
         int choice = 0;
         public static void main(String[] args)
              Vend machine = new Vend();
         public Vend()
              System.out.println(" Hello Duelist, my name is Yusie Fudo.This is the one and only Specific Rare Yu-Gi-Oh! card vending.Each card in this vending machine is sealed in a special card container.These cards are up to date with the currnet ban list and pack release's.");
              System.out.println(" in order to get cards, you will be asked to pay using your Deck Points, which are stored on your Acadmey Duel Disc");
              System.out.println("Please insert Deck Points equal to the card(s) you would like to purchase or just insert 1,703.87 Deck points");
              Scanner input = new Scanner(System.in);
              double insert = input.nextDouble();
              savedDeckpts = savedDeckpts + insert;
              change = insert - change;
              while(choice != 7 && insert > 0)
                   System.out.println(" You still have " + change + " Deck Points");
                   System.out.println("Press 1 if you would like the card ALLURE OF DARKNESS from the PhanTom of DarkNess booster pack(40.00 Dp)");
                   System.out.println("Press 2 if you would like the card JUDGMENT DRAGON from the Light Of DesTruction booster pack(90.75 Dp)");
                   System.out.println("Press 3 if you would like the card CHARGE OF THE LIGHT BIRGADE from The DuelistGeneSis booster pack(75.50 Dp)");
                   System.out.println("Press 4 if you would like the card CRUSH CARD from the limited edition GoLD series booster pack(399.99 Dp)");
                   System.out.println("Press 5 if you would like the card GORZ THE EMISSARY OF DARKNESS from the Dark LeGends booster pack(245.29 Dp)");
                   System.out.println("Press 6 if you would like the card DARK ARMED DRAGON from the PhanTom of DarkNess booster pack(220.00 Dp)");
                   System.out.println("Press 7 if you would like to have your Deck points added back to your Duel Disc");
                   System.out.println("Press 8 if you would like to check how many cards are left in the machine");
                   System.out.println("(*note you need exodius the ulitimate forbbiden one's card code inorder to use option 8)");
                   choice = input.nextInt();
                   if(choice == 1 && choice <= 8 && choice >= 1 && insert >= 40.00)
                        System.out.println("Congrats Duelist you have chosen to buy the card ALLURE OF DARKNESS from the PhanTom of DarkNess booster pack");
                        invALL = invALL - 1;
                        change = change - costALL;      
                   else if(insert < 40.00 && choice == 1)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 2 && choice <= 8 && choice >= 1 && insert >= 90.75)
                        System.out.println("Congrats Duelist you have chosen to buy the card JUDGMENT DRAGON from the Light Of DesTruction booster pack");
                        invJUD = invJUD - 1;
                        change = change - costJUD;      
                   else if(insert < 40.00 && choice == 2)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 3 && choice <= 8 && choice >= 1 && insert >= 75.50)
                        System.out.println("Congrats Duelist you have chosen to buy the card CHARGE OF THE LIGHT BIRGADE from The DuelistGeneSis booster pack");
                        invCHA = invCHA - 1;
                        change = change - costCHA;      
                   else if(insert < 40.00 && choice == 3)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 4 && choice <= 8 && choice >= 1 && insert >= 399.99)
                        System.out.println("Congrats Duelist you have chosen to buy the card CRUSH CARD from the limited edition GoLD series booster pack");
                        invCRU = invCRU - 1;
                        change = change - costCRU;      
                   else if(insert < 40.00 && choice == 4)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 5 && choice <= 8 && choice >= 1 && insert >= 245.29)
                        System.out.println("Congrats Duelist you have chosen to buy the card GORZ THE EMISSARY OF DARKNESS from the Dark LeGends booster pack");
                        invGORZ = invGORZ - 1;
                        change = change - costGORZ;      
                   else if(insert < 40.00 && choice == 5)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                        if(choice == 6 && choice <= 8 && choice >= 1 && insert >= 220.00)
                        System.out.println("Congrats Duelist you have chosen to buy the DARK ARMED DRAGON from the PhanTom of DarkNess booster pack");
                        invDAD = invDAD - 1;
                        change = change - costDAD;      
                   else if(insert < 40.00 && choice == 6)
                        System.out.println("not correct amount of Deck Points.Please chose another card(s)");
                   if(choice == 7 && choice <= 8 && choice >= 1 )
                        System.out.println(" You have chosen to have your Deck Points added back to your Duel Disc");
                        System.out.println("You have revceived " + change + " Deck Points back");
                        change = change * 0;
                   if(choice == 8 && choice <= 8 && choice >= 1)
                        System.out.println("You have selected to see how many of what cards are left");
                        password();
              public void password()
              System.out.println("Please input ExodiusCardCode at this time");
              Scanner pass = new Scanner(System.in);
              String password = pass.next();
              if(password.equals("blackout"))
                   System.out.println("There are " + invALL + "ALLURE OF DARKNESS ");
                   System.out.println("There are " + invJUD + "JUDGMENT DRAGON ");
                   System.out.println("There are " + invCHA + "CHARGE OF THE LIGHT BIRGADE ");
                   System.out.println("There are " + invCRU + "CRUSH CARD ");
                   System.out.println("There are " + invGORZ + "GORZ THE EMISSARY OF DARKNESS ");
                   System.out.println("There are " + invDAD + "DARK ARMED DRAGON ");
                   System.out.println("The machine has DP" + savedDeckpts + " Inside");
    }

    hi my name is exodiamaster3.14 my code runs but when it runs it tells me
    System.out.println(" Hello Duelist, my name is Yusie Fudo.This is the one and only Specific Rare Yu-Gi-Oh! card vending.Each card in this vending machine is sealed in a special card container.These cards are up to date with the currnet ban list and pack release's.");
              System.out.println(" in order to get cards, you will be asked to pay using your Deck Points, which are stored on your Acadmey Duel Disc");
              System.out.println("Please insert Deck Points equal to the card(s) you would like to purchase or just insert 1,703.87 Deck points");
    say i type in 500 it then gives me all my choices of what to buy. when you press 1-6 it just repeats it self on what you can chose.it does subtract the money but won't show that you bought it. and when you chose option 8 it does not show what is left in the machine. this is my problem please help b/c i am very stuck. thanks again.

  • Please help, java program terminating unexpectedly without reason

    ok, so I have a project I'm working on, here's its description:
    Create a new project named FML_Pig where F is your first initial, M is your middle initial, and L is your last initial. For example, if your name is Alfred Edward Neuman then you would name your project AEN_Pig. If necessary, add a new Java file to this project named FML_Pig.
    Add a java file to the project named FML_Dice.
    Design and implement a Dice class as follows. The Dice class has 2 twenty&#8209;sided dice with numbers on the faces (1 � 20) and 2 twenty-six-sided dice with letters on the faces (a � z).
    import java.util.Random;
    public class FML_Dice
    private static Random gen = new Random();
    private final static int NUM_SIDES = 20;
    private int die1, die2, numSnakeEyes, numVowels, totalPoints;
    private char die3, die4;
    Part 1
    Add a rollDice() method to your FML_Dice class that sets die1 and die2 to a random number between 1 and 20 and it sets die3 and die4 to a random character between �a� and �z�.
    Helpful Hint:
    dice3 = (char)(�a� + gen.nextInt(26)); // sets dice3 to a random char between �a� and �z�.
    Part 2
    Write a constructor that sets die1 and die2 to a random number between 1 and 20 and it sets die3 and die4 to a random character. Your constructor can simply call rollDice() to do this. It should also initialize numSnakeEyes, numVowels, and totalPoints to 0 (after you roll the dice).
    Part 3
    Write methods getDie1(), getDie2(), getDie3(), and getDie4() that returns the value of the respective die. Write a method numSnakes() that returns the number of snake eyes that have been rolled. Write a method numVowels() that returns the number of vowels that have been rolled. Write a method totalPts() that returns the totalPoints.
    Part 4
    Write a toString() method that overwrites the default toString() method. It should return a String representation of the value of all 4 die. For example, 17 2 h w.
    Part 5
    Write a method updateTotals that updates numVowels, numSnakeEyes, and totalPoints based on the current values of die1, die2, die3, and die4. numVowels should be incremented by 1 if either die3 or die4 are a vowel. However, if both die3 and die4 are vowels, the totalPoints should be reset to 0 and numVowels should be reset to 0 also. numSnakeEyes should be incremented by 1 if either die1 or die2 have a face value of 1 (this is not truly a snake eyes, but it gives better odds for the game). totalPoints should be incremented by the sum of die1 and die2 multiplied by (numSnakeEyes + 1).
    Part 6
    Write a main program (use the one in FML_Pig.java) that plays a game of Pig. In this game, two people play against each other. Player1 begins by rolling the dice. The total of die1 and die2 is added to his total score. Player1�s turn continues until he/she rolls a total of 4 vowels then the turn switches to Player2. Whenever a turn switches to the other player, the number of vowels is reset to zero. Also, if at any time both die3 and die4 are vowels, the total score is reset to 0 and the turn switches to the other player. (So the turn switches to the other player whenever the total number of vowels reaches four or there are two vowels rolled at the same time.)
    If a player rolls snakeeyes (for our game, snakeeyes occurs whenever either of the dice have a face value of one � in reality, both die1 and die2 should have a face value of one but then snakeeyes would occur only once every 400 rolls), then his point values are doubled from that point on (all future rolls for the rest of the game, point values for this player are doubled). When a player rolls snake eyes again, point values are tripled for that roll and all future rolls. (Three snake eyes, quadrupled, etc.)
    (continued on the next page)
    Be sure to display the results of the roll for each turn.
    First player to get to 2000 points wins the game and gets to oink like a pig.
    Note: Both players need their own set of Dice since the Dice keeps track of the totalPoints, the number of snake eyes rolled so far, and the number of vowels rolled so far for that particular player. You can do this simply by declaring it that way in the main program:
    Dice player1 = new Dice();
    Dice player2 = new Dice();
    You may add additional methods and instance variables to the class as needed. For example, I would probably write a private helper method isVowel() that is passed a char argument ch and returns true if ch is a vowel.
    Also, you can have the computer play for both player 1 and player 2. Simply loop it until somebody wins. Print out the result for each turn including who rolled the dice (player 1 or player 2), what they rolled, how many snakeeyes do they have, how many points did they get for this turn, and how many total points do they have.
    When you are completely finished, hand in just the java files (FLM_Dice & FLM_Pig). If you happened to write any other classes, make sure they are named with the FML format, and turn these in as well. I do not need EasyReader or p.
    Oink! Oink!
    This pig won the game --------->
    so here's my code:
    this isn't my code but is required to compile my code: // package com.skylit.io;
    import java.io.*;
    *  @author Gary Litvin
    *  @version 1.2, 5/30/02
    *  Written as part of
    *  <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    *  (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    *   and
    *  <i>Java Methods AB: Data Structures</i>
    *  (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    *  EasyReader provides simple methods for reading the console and
    *  for opening and reading text files.  All exceptions are handled
    *  inside the class and are hidden from the user.
    *  <xmp>
    *  Example:
    *  =======
    *  EasyReader console = new EasyReader();
    *  System.out.print("Enter input file name: ");
    *  String fileName = console.readLine();
    *  EasyReader inFile = new EasyReader(fileName);
    *  if (inFile.bad())
    *    System.err.println("Can't open " + fileName);
    *    System.exit(1);
    *  String firstLine = inFile.readLine();
    *  if (!inFile.eof())   // or:  if (firstLine != null)
    *    System.out.println("The first line is : " + firstLine);
    *  System.out.print("Enter the maximum number of integers to read: ");
    *  int maxCount = console.readInt();
    *  int k, count = 0;
    *  while (count < maxCount && !inFile.eof())
    *    k = inFile.readInt();
    *    if (!inFile.eof())
    *      // process or store this number
    *      count++;
    *  inFile.close();    // optional
    *  System.out.println(count + " numbers read");
    *  </xmp>
    public class EasyReader
      protected String myFileName;
      protected BufferedReader myInFile;
      protected int myErrorFlags = 0;
      protected static final int OPENERROR = 0x0001;
      protected static final int CLOSEERROR = 0x0002;
      protected static final int READERROR = 0x0004;
      protected static final int EOF = 0x0100;
       *  Constructor.  Prepares console (System.in) for reading
      public EasyReader()
        myFileName = null;
        myErrorFlags = 0;
        myInFile = new BufferedReader(
                                new InputStreamReader(System.in), 128);
       *  Constructor.  opens a file for reading
       *  @param fileName the name or pathname of the file
      public EasyReader(String fileName)
        myFileName = fileName;
        myErrorFlags = 0;
        try
          myInFile = new BufferedReader(new FileReader(fileName), 1024);
        catch (FileNotFoundException e)
          myErrorFlags |= OPENERROR;
          myFileName = null;
       *  Closes the file
      public void close()
        if (myFileName == null)
          return;
        try
          myInFile.close();
        catch (IOException e)
          System.err.println("Error closing " + myFileName + "\n");
          myErrorFlags |= CLOSEERROR;
       *  Checks the status of the file
       *  @return true if en error occurred opening or reading the file,
       *  false otherwise
      public boolean bad()
        return myErrorFlags != 0;
       *  Checks the EOF status of the file
       *  @return true if EOF was encountered in the previous read
       *  operation, false otherwise
      public boolean eof()
        return (myErrorFlags & EOF) != 0;
      private boolean ready() throws IOException
        return myFileName == null || myInFile.ready();
       *  Reads the next character from a file (any character including
       *  a space or a newline character).
       *  @return character read or <code>null</code> character
       *  (Unicode 0) if trying to read beyond the EOF
      public char readChar()
        char ch = '\u0000';
        try
          if (ready())
             ch = (char)myInFile.read();
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        if (ch == '\u0000')
          myErrorFlags |= EOF;
        return ch;
       *  Reads from the current position in the file up to and including
       *  the next newline character.  The newline character is thrown away
       *  @return the read string (excluding the newline character) or
       *  null if trying to read beyond the EOF
      public String readLine()
        String s = null;
        try
          s = myInFile.readLine();
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        if (s == null)
          myErrorFlags |= EOF;
        return s;
       *  Skips whitespace and reads the next word (a string of consecutive
       *  non-whitespace characters (up to but excluding the next space,
       *  newline, etc.)
       *  @return the read string or null if trying to read beyond the EOF
      public String readWord()
        StringBuffer buffer = new StringBuffer(128);
        char ch = ' ';
        int count = 0;
        String s = null;
        try
          while (ready() && Character.isWhitespace(ch))
            ch = (char)myInFile.read();
          while (ready() && !Character.isWhitespace(ch))
            count++;
            buffer.append(ch);
            myInFile.mark(1);
            ch = (char)myInFile.read();
          if (count > 0)
            myInFile.reset();
            s = buffer.toString();
          else
            myErrorFlags |= EOF;
        catch (IOException e)
          if (myFileName != null)
            System.err.println("Error reading " + myFileName + "\n");
          myErrorFlags |= READERROR;
        return s;
       *  Reads the next integer (without validating its format)
       *  @return the integer read or 0 if trying to read beyond the EOF
      public int readInt()
        String s = readWord();
        if (s != null)
          return Integer.parseInt(s);
        else
          return 0;
       *  Reads the next double (without validating its format)
       *  @return the number read or 0 if trying to read beyond the EOF
      public double readDouble()
        String s = readWord();
        if (s != null)
          return Double.parseDouble(s);
          // in Java 1, use: return Double.valueOf(s).doubleValue();
        else
          return 0.0;
    }same with this:
    public class p
         public static void l(String S)
          { System.out.println(S);}
         public static void o(String S)
          {System.out.print(S);}
         public static void l(int i)
          { System.out.println(i);}
         public static void o(int i)
          {System.out.print(i);}
         public static void l(boolean b)
          { System.out.println(b);}
         public static void o(boolean b)
          {System.out.print(b);}
        public static void l(char c)
          { System.out.println(c);}
         public static void o(char c)
          {System.out.print(c);}     
         public static void l(double d)
          { System.out.println(d);}
         public static void o(double d)
          {System.out.print(d);} 
        public static void l(Object obj)
          { System.out.println(obj.toString());}
         public static void o(Object obj)
          {System.out.print(obj.toString());}
         public static void l()
          {System.out.println();}
    }       here's my code:
    import java.util.*;
    public class JMM_Pig
         public static void main(String[] args)
              int winner=0;
              int pts=0;
                   JMM_Dice player1=new JMM_Dice();
                   JMM_Dice player2=new JMM_Dice();
                   p.l("Player 1 rolls the dice...");
                   player1.rollDice();
                   player1.updateTotals();
                   boolean loop=true;
                   while(loop)
                   while(player1.numVowels()<=4)
                        p.l("Player 1 continues his turn...");
                        player1.rollDice();
                        player1.updateTotals();
                        p.l("Player 1 rolled a "+player1.getDie1()+" and a "+player1.getDie2()+" and a '"+player1.getDie3()+"' and a '"+player1.getDie4()+"'");
                        p.l("Player 1 rolled "+player1.currvowels()+" vowels.");
                        p.l("Player 1 has "+player1.totalvowels()+" total vowels.");
                        //if(player1.getMagic()==1)
                        //player1.totalPoints=(player1.totalPoints+player1.getDie1()+player1.getDie2())*player1.mult;
                        //pts=(player1.totalPts()+player1.getDie1()+player1.getDie2())*player1.getMult();
                        //player1.setTpts(pts);
                        //if(player1.getMagic()!=1)
                             //player1.totalPoints=player1.totalPoints+player1.getDie1()+player1.getDie2();
                        //pts=player1.totalPts()+player1.getDie1()+player1.getDie2();
                        //player1.setTpts(pts);
                        p.l("Player 1 has "+player1.numSnakes()+" snake eyes.");
                        p.l("Player 1 earned "+player1.ptsreturn()+" points this turn.");
                        p.l("Player 1 has "+player1.totalPts()+" total points.");
                        pts=0;
                        if(player1.totalPts()>=2000)
                             winner=1;
                             player1.setNv(4);loop=false;
                        if((player1.isavowel(player1.getadice()))&&player1.isavowel(player1.getadice2()))
                             player1.setTpts(0);player1.setNv(0);player1.setNv(4);
                   p.l("Player 1's turn has ended...");
                   player1.setNv(0);
                   p.l("Player 2 rolls the dice...");
                   player2.rollDice();
                   player2.setTpts(player2.totalPts()+player2.getDie1()+player2.getDie2());
                   while(player2.numVowels()<=4)
                        p.l("Player 2 continues his turn...");
                        player2.rollDice();
                        player2.updateTotals();
                        p.l("Player 2 rolled a "+player2.getDie1()+" and a "+player2.getDie2()+" and a '"+player2.getDie3()+"' and a '"+player2.getDie4()+"'");
                        p.l("Player 2 rolled "+player2.currvowels()+" vowels.");
                        p.l("Player 2 has "+player2.totalvowels()+" total vowels.");
                        //if(player1.getMagic()==1)
                        //player1.totalPoints=(player1.totalPoints+player1.getDie1()+player1.getDie2())*player1.mult;
                        //pts=(player1.totalPts()+player1.getDie1()+player1.getDie2())*player1.getMult();
                        //player1.setTpts(pts);
                        //if(player1.getMagic()!=1)
                             //player1.totalPoints=player1.totalPoints+player1.getDie1()+player1.getDie2();
                        //pts=player1.totalPts()+player1.getDie1()+player1.getDie2();
                        //player1.setTpts(pts);
                        p.l("Player 2 has "+player2.numSnakes()+" snake eyes.");
                        p.l("Player 2 earned "+player2.ptsreturn()+" points this turn.");
                        p.l("Player 2 has "+player2.totalPts()+" total points.");
                        pts=0;
                        if(player2.totalPts()>=2000)
                             winner=2;
                             player2.setNv(4);loop=false;
                        if((player2.isavowel(player2.getadice()))&&player2.isavowel(player2.getadice2()))
                             player2.setTpts(0);player2.setNv(0);player2.setNv(4);
                   p.l("Player 2's turn has ended...");
                   player2.setNv(0);
                   if(player1.totalPts()>=2000)
                        winner=1;
                        loop=false;
                   if(player2.totalPts()>=2000)
                        winner=2;
                        loop=false;
                   }  //main loop
                   if(winner==1)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 1 wins, oink oink!");
                   if(winner==2)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 2 wins, oink oink!");
    and dice class:
    import java.util.*;
    public class JMM_Dice {
         private static Random gen = new Random();
        private final static int NUM_SIDES = 21;
        private int die1, die2, numSnakeEyes, numVowels, totalPoints;
        private char die3, die4;
        private int dice=0;
           //dice=
           private int dice2=0;
           //dice2=;
           private String adice="";
           //adice=;
           private String adice2="";
           //adice2;
           private int magic=0;
           private int mult=0;
           private int currvowels=0;
           private int totalvowels=0;
      public static EasyReader key = new EasyReader();
      public JMM_Dice()
          dice=0;dice2=0;
           String alpha="abcdefghijklmnopqrstuvwxyz";
          adice="";adice2="";
           rollDice();
           numSnakeEyes=0;numVowels=0;totalPoints=0;
      public void setTpts(int tpts)
           this.totalPoints=tpts;
      public void setNv(int nv)
           this.numVowels=nv;
      public int getDie1()
           return dice;
      public int getDie2()
           return dice2;
      public String getDie3()
           return adice;
      public String getDie4()
           return adice2;
      public int numSnakes()
           return numSnakeEyes;
      public void setSnakes(int s)
           this.numSnakeEyes=s;
      public String getadice()
           return this.adice;
      public String getadice2()
           return this.adice2;
      public int numVowels()
           return numVowels;
      public int getMagic()
           return this.magic;
      public int getNv()
           return this.numVowels;
      public void setMagic(int mag)
           this.magic=mag;
      public int getMult()
           return this.mult;
      public void setMult(int m)
           this.mult=m;
      public int totalPts()
           return totalPoints;
      public String toString()
           return dice+""+dice2+""+adice+""+adice2;
      public boolean isavowel(String str)
           if(str.equals("a")||str.equals("e")||str.equals("i")||str.equals("o")||str.equals("u"))
                return true;
           else
                return false;
      public int ptsreturn()
           return dice+dice2;
      public int currvowels()
           int tmp=currvowels;
           currvowels=0;
           return tmp;
      public int totalvowels()
           return numVowels;
      public void updateTotals()
           if(adice.equalsIgnoreCase("a")||adice.equalsIgnoreCase("e")||adice.equalsIgnoreCase("i")||adice.equalsIgnoreCase("o")||adice.equalsIgnoreCase("u")||adice2.equalsIgnoreCase("a")||adice2.equalsIgnoreCase("e")||adice2.equalsIgnoreCase("i")||adice2.equalsIgnoreCase("o")||adice2.equalsIgnoreCase("u"))
                numVowels++;currvowels++;
           if((isavowel(adice))&&isavowel(adice2))
                totalPoints=0;numVowels=0;
           if(dice==1||dice2==1)
                numSnakeEyes++;
           int fd=dice;
           int sd=dice2;
           int sum=fd+sd;
           totalPoints+=sum*(numSnakeEyes+1);
      public void rollDice()
           dice=gen.nextInt(20)+1;
           dice2=gen.nextInt(20)+1;
           String alpha="abcdefghijklmnopqrstuvwxyz";
           adice=String.valueOf(alpha.charAt(gen.nextInt(26)));
           adice2=String.valueOf(alpha.charAt(gen.nextInt(26)));
      public static void sleep (int wait)
      {     long timeToQuit = System.currentTimeMillis() + wait;
           while (System.currentTimeMillis() < timeToQuit)
                ;   // take no action
    }the program works fine except it's supposed to terminate when one of the two AIs get a score of 2000, right now it terminates no matter what score the AIs get and no matter what I've tried to do it keeps doing that...can someone please tell me why it's terminating so oddly? Thanks! :)

    Here's how my code works in a nutshell, the main program starts with the boolean loop=true;
                   while(loop)
                   {then comes the loops for the two AIs, first the player 1 AI goes with this loop: while(player1.numVowels()<=4)
                   {there the player 1 roles the dice and it keeps going until player 1 gets a total of 2000 points at which time this is supposed to execute: if(player1.totalPts()>=2000)
                             winner=1;
                             player1.setNv(4);loop=false;
                        }, player1.setNv(4); sets numVowels to 4 so that the inner loop exits, loop=false exits the other loop and winner=1; specifies that player 1 won which is used outside of the loops here: if(winner==1)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 1 wins, oink oink!");
                   if(winner==2)
                        p.l("It ended with the following statistics...");
                        p.l("Player 1's score was: "+player1.totalPts()+" and Player 2's score was: "+player2.totalPts());
                        p.l("Player 1 had: "+player1.numSnakes()+" snake eye(s) and Player 2 had: "+player2.numSnakes()+" snake eye(s)");
                        p.l("Player 2 wins, oink oink!");
                   } the same thing happens for player 2 if player 1 didn't already get 2000 points...but the if statement despite everything pointing to the variables containing the right values don't seem to be working, as shown by the example program output I posted it just ends at any random number...hopefully this helps make figuring out what's wrong easier :) ...so can anyone please help me out? thanks! :)

  • Help : java.security.UnrecoverableKeyException: excess private key

    Hi,
    I require help for the exception "java.security.UnrecoverableKeyException: excess private key"
    When i am trying to generate digital signature using PKCS7 format using bouncyCastle API, it gives the "java.security.UnrecoverableKeyException: excess private key" exception.
    The full stack trace is as follows
    ------------------------------------------------------------------------java.security.UnrecoverableKeyException: excess private key
         at sun.security.provider.KeyProtector.recover(KeyProtector.java:311)
         at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:120)
         at java.security.KeyStore.getKey(KeyStore.java:289)
         at com.security.Security.generatePKCS7Signature(Security.java:122)
         at com.ibm._jsp._SendSecureDetail._jspService(_SendSecureDetail.java:2282)
         at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:93)
    I had tested the program under following scenarios...
    The Java Program for generating the digital signature independently worked successfully(without any change in policy files or java.security file) I have tested this independently on Sun's JDK 1.4, 1.6
    For IBM JDK 1.4 on Windows machine for WAS(Webshere Application Server) 6.0, The Program for generating the digital signature using PKCS7 works fine, but it required IBM Policy files(local_policy.jar, US_export_policy.jar) and updation in java.security file
    But the problem occurs in Solaris 5.10, WAS 6.0 where Sun JDK 1.4.2_6 is used.
    I copied the unlimited strength policy files for JDK 1.4.2 from Sun's site(because the WAS 6.0 is running on Sun's JDK intead of IBM JDK)...
    I changed the java.security file as follows(only changed content)
    security.provider.1=sun.security.provider.Sun
    security.provider.2=com.ibm.security.jgss.IBMJGSSProvider
    security.provider.3=com.ibm.crypto.fips.provider.IBMJCEFIPS
    security.provider.4=com.ibm.crypto.provider.IBMJCE
    security.provider.5=com.ibm.jsse2.IBMJSSEProvider2
    security.provider.6=com.ibm.jsse.IBMJSSEProvider
    security.provider.7=com.ibm.security.cert.IBMCertPath
    security.provider.8=com.ibm.security.cmskeystore.CMSProvider
    I have used PKCS12(PFX) file for digital signature
    which is same for all environment(i have described as above)
    I copied the PFX file from windows to solaris using WinSCP in binary format so the content of certificate won't get currupted.
    I can not change the certificate because it's given by the company and which is working in other enviroments absolutely fine(just i have described above)
    I have gone though the "http://forums.sun.com/thread.jspa?threadID=408066" and other URLs too. but none of them helped...
    So what could be the problem for such exception?????
    I am on this issue since last one month...
    I know very little about security.
    Thanks in advance
    PLEASE HELP ME(URGENT)
    Edited by: user10935179 on Sep 27, 2010 2:47 AM
    Edited by: user10935179 on Sep 27, 2010 2:54 AM

    user10935179 wrote:
    The Java Program for generating the digital signature independently worked successfully(without any change in policy files or java.security file) If the program was working fine without changing the java.security policy file, why have you changed it to put the IBM Providers ahead of the SunRsaSign provider?
    While I cannot be sure (because I don't have an IBM provider to test this), the error is more than likely related to the fact that the IBM Provider implementations for handling RSA keys internally are different from the SunRsaSign provider. Since you've now forced the IBM provider ahead of the original Sun provider, you're probably running into interpretation issues of the encoded objects inside the keystore.
    Change your java.security policy back to the default order, and put your IBM Providers at the end of the original list and run your application to see what happens.
    Arshad Noor
    StrongAuth, Inc.

  • Urgent!! Help Java 1.4 installation What is invaid or expired ticket?

    When I try to install Java 1.4 it says that I have an invalid or expired ticket. What does that mean? and How do I fix it? Please help. W

    Whose product is this? Cut & paste relevant information...

  • Need help (java.lang.RuntimeException: Unknown/unsupported charset:)

    Hi,
    Previously our application is running fine in
    iPlanet web server 4 and some times in Tomcat. Now we
    are migrating this application to weblogic 8.1 due to
    some load.
    After migrating to weblogic 8.1 we are getting some
    exception.
    The exception is:
    Servlet failed with Exception
    java.lang.RuntimeException: Unknown/unsupported
    charset: - java.io.UnsupportedEncodingException:
    Charset: '' not recognized, and there is no alias for
    it in the WebServerMBean
    at
    weblogic.servlet.jsp.JspParser.parse(JspParser.java:288)
    at
    weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:125)
    In my Jsp page we have top declarations like in the
    below:
    <%@ include file="header.jsp" %>
    <%@ page import="com.customer.customercare.servlet.*"
    %>
    <%@ page import="com.customer.customercare.types.*" %>
    <%@ page import="com.customer.customercare.search.*"
    %>
    <%@ page import="com.customer.customercare.utils.*" %>
    <%@ page import="com.customer.customercare.log.*"%>
    <%@ page import="java.util.Date" %>
    <%@ page import="com.customer.customercare.utils.*" %>
    <%@ page
    import="com.customer.customercare.servlet.handler.*"
    %>
    <%@ page import="java.sql.Timestamp"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.StringTokenizer"%>
    <%@ page import="java.util.Calendar"%>
    We are not using any charter sets in the above page
    directory but we are using that in a meta tag:
    <meta http-equiv="Content-Type" content="text/html;
    charset=ISO-8859-1">
    This might cause any problem?
    I tried charset=UTF-8, windows-1252 and UTF-16. But i
    am getting the same error.
    The thing is i am not getting this error from the JSP
    page. This jsp page calls a java class, that java
    class has a prepared statement. When the prepared
    statement is executed or before execution, this error is thrown on weblogic console. That
    error is not related to SQL.
    I think "charset" exception means it should come in JSP only. But i don't know why it is coming in the java class? i am confused?
    I don't know why exactly that error is coming...?
    My application is compiled in JDK1.3.1_08 and running
    in weblogic 8.1 which internally uses JDK1.4. Is this
    because of version problem?
    I am creating the .war file from the command prompt
    which path is set to JDK1.3.1_08...
    Can anybody help me out in this problem?
    Thanks and Regards,
    Chandu.

    Hi,
              For this issue,The CR was filed in weblogic 8.1 sp2
              go through the link, you will find CR information in link.
              http://e-docs.bea.com/wls/docs81/notes/resolved_sp02.html#1390392
              -----Anilkumar kari

  • Help Java runtime keeps popping up, after I have downloaded it?

    How do I get rid of the pop up from Jave Runtime to view this contact? on my Mac Pro, after updating to OS X Yosemite 10 10 1  How can I stop this  pop up window ? I have downloading it, the message keeps repeating? Help, Thanks

    Get and install this version of Java from Apple. It's likely that you use Facebook and the com.facebook.videochat plugin needs that version of Java.

  • Help:java.lang.ClassNotFoundException

    we have one application.We are calling ejb through applet.
    We have sybase EAServer3.6.1 and jaguar 3.6.1.Java code is in jdk118 and ejb1.0.
    Our architacture is: applet<->ejb<->server.
    Our ejb is deployed on server.That we are calling our ejb through applet.Whole code for applet and ejb is lying on server.When we run our application through browser from different m/c we are getting two errors.
    1)com.ms.security.SecurityExceptionEx.
    2)powersoft.powerj.jaguar.InitialContextException: javax.naming lookup failed for component: HelloEJBPackage/HelloEJB
    Exception: [Root exception is [Root exception is java.lang.ClassNotFoundException: java.rmi.Remote]javax.naming.NamingException]javax.naming.NamingException.
    When I set classpath on each m/c.
    i.e (c:/prog/sybase/shard/sun/jdk118/lib/classes.zip) my application is running fine it just gives warning for securiety not for lookup method failed.
    Our system is in production.We can not make setting for individual clients.We need our applet should take classes from server not from client m/c.
    Can anybody help me to solve this problem?

    If the client is created using powerj, pl cross verify the code for the lookup() in the client with component properties in the jaguar server.
    check the component properties , in the installed packages of the jaguarCTS , under jaguar manager of the sybase central java edition.
    kar

  • URGENT- PLEASE HELP: java.lang.threads and BC4J

    Hi,
    according to my issue "no def found for view" in the same titled thread I'm wondering how you would implement asynchronous calls of methods that use BC4J to update a couple of data.
    To be more precise:
    A requirement of our software is to start an update database job, which can take a couple of minutes/hours, from the web browser. Before it will be executed the logged-in user receives a notification that this batch job has been started.
    I dont't want to use JMS overhead and MD Beans for this simple requirement, therefore I implemented a class that extends java.lang.Thread and put all the update codings within the run method. After having called the start-method of the thread I get a JBO-25022(No XML file found) error when I try to set a new value for an attribute of the row. The row consists of attributes which belong to four entity objects that mus be updated.
    When calling the run method directly, everything works fine.
    My questions:
    * do you know any workaround how to make the xml files
    reachable?
    * how would you implement anschronous calls of long time-
    consuming jobs?
    * is this a bug of BC4J?
    Any help, tip, hint is really appreciated.
    Stefan

    Arno,
    many thanks for your reply:
    Here is an excerpt of the source code of my thread "Aenderungsdienst":
    public class Aenderungsdienst extends java.lang.Thread
    private SviAdministrationModuleImpl mSviModul;
    // Application module that contains view object
    // IKViewImpl
    public Aenderungsdienst(SviAdministrationModuleImpl aSviModul)
    mSviModul = aSviModul;
    public void run()
    ausfuehrenAenderungsdienst(mAenderungsdienstNr); <--error within this methode
    private int ausfuehrenAenderungsdienst(String aAenderungsdienstNr)
    int rAnzahlSaetze = 0;
    try
    IkViewImpl aenderungen = mSviModul.getIkView();
    aenderungen.suchenAenderungssaetze(aAenderungsdienstNr); <-- method within View Object Impl that executes a query with customized where-clauses
    if ((rAnzahlSaetze = aenderungen.getRowCount()) > 0)
    IkViewRowImpl ik = null;
    while (aenderungen.hasNext())
    ik = (IkViewRowImpl) aenderungen.next();
    ik.setBestandsstatus("B"); <-- error occurs here when setting the status of a current row in my rowset to "B"
    mSviModul.getTransaction().postChanges();
    mSviModul.getTransaction().commit();
    catch (Exception e)
    e.printStackTrace();
    mSviModul.getTransaction().rollback();
    //todo: Verarbeitungsprotokoll erstellen
    return rAnzahlSaetze;
    This thread will be called by the application module "sviAdministrationModuleImpl":
    public void ausfuehrenAenderungsdienst(String
    aAenderungsdienstNr)
    Aenderungsdienst aenderungsdienst = new
    Aenderungsdienst(this);
    aenderungsdienst.setAenderungsdienstNr
    (aAenderungsdienstNr);
    aenderungsdienst.start();
    Using the start() method of the thread causes this exception:
    [653] No xml file: /hvbg/svi/model/businessobjects/businessobjects.xml, metaobj = hvbg.svi.model.businessobjects.businessobjects
    [654] Cannot Load parent Package : hvbg.svi.model.businessobjects.businessobjects
    [655] Business Object Browsing may be unavailable
    [656] No xml file: /hvbg/svi/model/businessobjects/IK_Inlandsbankverb.xml, metaobj = hvbg.svi.model.businessobjects.IK_Inlandsbankverb
    09.03.2004 10:27:41 hvbg.common.businessobjects.HvbgEntityImpl setAttributeInternal
    SCHWERWIEGEND: Fehler beim Setzen des Attributs 1 im Entity Objekt: JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
    09.03.2004 10:27:42 hvbg.svi.model.dienste.Aenderungsdienst ausfuehrenAenderungsdienst
    SCHWERWIEGEND: Beim Ausführen des Aenderungsdienstes 618 trat während der DB-Aktualisierung ein schwerer Fehler auf:
    JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
    oracle.jbo.NoDefException: JBO-25002: Definition hvbg.svi.model.businessobjects.IK_Inlandsbankverb vom Typ Entitätszuordnung nicht gefunden.
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:328)
         at oracle.jbo.mom.DefinitionManager.findDefinitionObject(DefinitionManager.java:268)
         at oracle.jbo.server.MetaObjectManager.findMetaObject(MetaObjectManager.java:649)
         at oracle.jbo.server.EntityAssociation.findEntityAssociation(EntityAssociation.java:98)
         at oracle.jbo.server.AssociationDefImpl.resolveEntityAssociation(AssociationDefImpl.java:725)
         at oracle.jbo.server.AssociationDefImpl.getEntityAssociation(AssociationDefImpl.java:135)
         at oracle.jbo.server.AssociationDefImpl.hasContainer(AssociationDefImpl.java:546)
         at oracle.jbo.server.AssociationDefImpl.getContainer(AssociationDefImpl.java:468)
         at oracle.jbo.server.EntityImpl.getContainer(EntityImpl.java:1573)
         at oracle.jbo.server.EntityImpl.setValidated(EntityImpl.java:1649)
         at oracle.jbo.server.EntityImpl.setAttributeValueInternal(EntityImpl.java:2081)
         at oracle.jbo.server.EntityImpl.setAttributeValue(EntityImpl.java:1985)
         at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:1700)
         at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:946)
         at hvbg.common.businessobjects.HvbgEntityImpl.setAttributeInternal(HvbgEntityImpl.java:56)
         at hvbg.svi.model.businessobjects.IKImpl.setBestandsstatus(IKImpl.java:174)
         at hvbg.svi.model.businessobjects.IKImpl.setAttrInvokeAccessor(IKImpl.java:770)
         at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:859)
         at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:1108)
         at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:1019)
         at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1047)
         at hvbg.svi.model.dataviews.IkViewRowImpl.setBestandsstatus(IkViewRowImpl.java:264)
         at hvbg.svi.model.dienste.Aenderungsdienst.ausfuehrenAenderungsdienst(Aenderungsdienst.java:337)
         at hvbg.svi.model.dienste.Aenderungsdienst.run(Aenderungsdienst.java:290)
    Using run(), everything works perfectly.
    The view object IKView consists of four entity objects which are linked by associations. There exists an association between the entity objects ik and inlandbankverb. The xml-file for the association object is named "ik_inlandsbankverb.xml". It seems so that this definition could not be found when calling my thread in asynchronous (via start()-method call) mode.
    Is this a bug of JDeveloper?
    Thanks in advance,
    Stefan

  • Urgent Help:java.lang.ExceptionInInitializerError in JasperReports

    the following is the java code:
    Map params = new HashMap();
    params.put("order_type", "This is Test Print");
    JRXmlDataSource ds = new JRXmlDataSource(outXML, "/Order");
    InputStream is =Class.forName(                    "com.w3c.dom.Document").getResourceAsStream
    "/TestPrint.jasper");
    net.sf.jasperreports.engine.JasperPrint jp =
                   JasperFillManager.fillReport(is, params, ds);
    JasperExportManager.exportReportToPdf(jp);
    i reckon iam getting this error in the above highlighted code...
    i have all the necessary jars in weblogic's classpath!!
    just a thought...is this because of any mismatch in the jar version?
    on refreshing the page the cause becomes java.lang.NoClassDefFoundError
    ANY POINTERS TO WHY THIS IS HAPPENING???
    java.lang.ExceptionInInitializerError
    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getStaticText(JRFillObjectFactory.java:494)
    at net.sf.jasperreports.engine.base.JRBaseStaticText.getCopy(JRBaseStaticText.java:93)
    at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88)
    at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:77)
    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:374)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:386)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:582)
    at com.yantra.interop.services.flowcomponents.TestPrint1.testPrint(TestPrint1.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.yantra.interop.services.api.ApiHelper.invoke(ApiHelper.java:155)
    at com.yantra.interop.services.flowcomponents.ApiFlowComponent.execute(ApiFlowComponent.java:161)
    at com.yantra.interop.services.flowcomponents.ApiFlowComponent.send(ApiFlowComponent.java:200)
    at com.yantra.integration.adapter.FlowExecutor.execute(FlowExecutor.java:359)
    at com.yantra.integration.adapter.SynchronousIntegrationFlow.executeFlow(SynchronousIntegrationFlow.java:215)
    at com.yantra.interop.services.api.ApiRequestDispatcher.executeFlow(ApiRequestDispatcher.java:90)
    at com.yantra.interop.client.InteropHttpServlet.processRequest(InteropHttpServlet.java:156)
    at com.yantra.interop.client.InteropHttpServlet.doPost(InteropHttpServlet.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.getB64StrProp(PolicyRuntime.java:188)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.<init>(PolicyRuntime.java:91)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.<init>(MiscPolicyRuntime.java:132)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime$Factory.make(MiscPolicyRuntime.java:254)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.accessInstance(PolicyRuntime.java:225)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.preFilter(PolicyRuntime.java:127)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.preFilter(MiscPolicyRuntime.java:142)
    at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:277)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.<clinit>(JRFillTextElement.java:61)
    ... 38 more
    java.lang.ExceptionInInitializerError
    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getStaticText(JRFillObjectFactory.java:494)
    at net.sf.jasperreports.engine.base.JRBaseStaticText.getCopy(JRBaseStaticText.java:93)
    at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:88)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:88)
    at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:77)
    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:374)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:386)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:92)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:582)
    at com.yantra.interop.services.flowcomponents.TestPrint1.testPrint(TestPrint1.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.yantra.interop.services.api.ApiHelper.invoke(ApiHelper.java:155)
    at com.yantra.interop.services.flowcomponents.ApiFlowComponent.execute(ApiFlowComponent.java:161)
    at com.yantra.interop.services.flowcomponents.ApiFlowComponent.send(ApiFlowComponent.java:200)
    at com.yantra.integration.adapter.FlowExecutor.execute(FlowExecutor.java:359)
    at com.yantra.integration.adapter.SynchronousIntegrationFlow.executeFlow(SynchronousIntegrationFlow.java:215)
    at com.yantra.interop.services.api.ApiRequestDispatcher.executeFlow(ApiRequestDispatcher.java:90)
    at com.yantra.interop.client.InteropHttpServlet.processRequest(InteropHttpServlet.java:156)
    at com.yantra.interop.client.InteropHttpServlet.doPost(InteropHttpServlet.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.NullPointerException
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.getB64StrProp(PolicyRuntime.java:188)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.<init>(PolicyRuntime.java:91)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.<init>(MiscPolicyRuntime.java:132)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime$Factory.make(MiscPolicyRuntime.java:254)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.accessInstance(PolicyRuntime.java:225)
    at com.trend.iwss.jscan.appscan.runtime.PolicyRuntime.preFilter(PolicyRuntime.java:127)
    at com.trend.iwss.jscan.appscan.runtime.MiscPolicyRuntime.preFilter(MiscPolicyRuntime.java:142)
    at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:277)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:390)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.<clinit>(JRFillTextElement.java:61)
    ... 38 more

    Patrick-
    My best guess is that you did not include some required library in the
    runtime "required libraries" for your project. My first guess is that
    you missed the JDO library jar, since missing that would certainly
    result in an ExceptionInInitializerError when loading your persistent
    classes.
    You might also run the program in the debugger and see if you get a more
    telling stack trace.
    In article <bkuuef$9di$[email protected]>, Patrick Pracht wrote:
    Hello all,
    I am currently developing a webapp using Kodo-2.5.3, MySQL-DB, JBuilder9,
    Tomcat4.1.
    Everything worked as expected until I have been running the Metadata tool
    and Schematool from within JBuilder for a new class.
    After doing this , when I attempt to run the webapp from within JBuilder,
    the build process stops with the following message displayed in the
    build-panel of JBuilder: java.lang.ExceptionInInitializerError
    Since I have no further indication of what causes the problem (Filename,
    location, Stacktrace, etc.) I really don't know how to proceed. The only
    thing that I can see by looking at the kodo msg panel is, that Kodo did not
    parse all the persistent classes.
    Can anybody tell me how this problem could be tracked down?
    Is there any log-file I could have a look at?
    Thanks in advance for your help.
    regards
    Patrick
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • HELP: Java Install on RedHat ES3 Linux

    I get the following error evoking java after initial install of J2SDK on RedHat ES 3 (version 9):
    [root@bdln4002 ~]$java -version
    Fatal: Stack size too small. Use 'ulimit -s' to increase default stack size.
    Aborted
    I have adjusted the stack size via ulimit command and reloaded the kernel. I have extended the stack size to "unlimited" and still receive the same error. My current settings look like this:
    [root@bdln4002 ~]$ulimit -a
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    file size (blocks, -f) unlimited
    max locked memory (kbytes, -l) 4
    max memory size (kbytes, -m) unlimited
    open files (-n) 1024
    pipe size (512 bytes, -p) 8
    stack size (kbytes, -s) 10240
    cpu time (seconds, -t) unlimited
    max user processes (-u) 31488
    virtual memory (kbytes, -v) unlimited
    I have installed Java plenty of times in Solaris with out a fraction of this frustration. Any ideas where I am missing the boat? My searches are turning up nothing ... so assume I am complete linux idiot at this point.

    I've never heard of that error before. So I googled it and found this..
    http://www.mail-archive.com/[email protected]/msg15491.html
    Are you using a Blackdown jvm.. That isn't necessary for Linux any more. And the suggestion in this thread is to try using Java version 1.5. Honestly, I don't know enough about this subject to offer any thoughts of my own here.
    For general help with Linux you could try Linux Questions. There is a forum there specific for Red Hat users.
    http://www.linuxquestions.org
    Here are some links which offer information about installing Java on Linux. I don't remember the dates on these pages.
    http://home.bredband.no/gaulyk/java/index.html
    http://pipeline.lbl.gov/vgb2/help/java_linux_instructions.shtml
    http://www.cs.princeton.edu/introcs/21hello/linux.html
    http://www.linuxjournal.com/comments.php?op=Reply&pid=5780&sid=6290

  • [HELP]  java.lang.UnsupportedOperationException

    Hi,
    Please help as i am unable to run the application in the weblogic server 9.2 but it is working in Sun GlassFish Enterprise Server v3
    The stack errors as below:
    ####<Apr 19, 2010 11:58:14 AM SGT> <Error> <HTTP> <austin501> <wposServer1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1271649494147> <BEA-101020> <[weblogic.servlet.internal.WebAppServletContext@c2b6f8 - appName: 'webpos2', name: 'webpos2.war', context-path: '/webpos2'] Servlet failed with Exception
    java.lang.UnsupportedOperationException
         at javax.faces.application.Application.getResourceHandler(Application.java:286)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:307)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    >

    GlassFish Server V3 and WebLogic Server 9.2 are different in terms of the level of Java EE they support.
    I believe WLS 9.2 is J2EE 1.4 compatible whereas GlassFish v3 is Java EE 6 compatible.
    What version of JSF are you using in the application?
    WLS 9.2 shipped with JSF 1.1 -- if you are using a later version of JSF, then it's entirely possible that it relies on a later version of the servlet specifciation than that which WLS 9.2 (Servlet 2.4) provides. Which is giving you this error.
    GlassFish v3 ships with JSF 2.0, which relies on Servlet 2.5 as a minium.
    Without knowing more, it's hard to comment authoriatively. However, I'd feel relatively confident that if you used the latest version of WLS 10.3.x that is available, you shouldn't run into this specific issue as it's tested and ships with with JSF 1.2, and it should work equally as well with JSF 2.0 since it provides the necessary level of Java EE API support.
    -steve-

Maybe you are looking for

  • Adobe 6.0 Pro--PDFs created from multiple PDFs don't have bookmarks from structure?

    I'm working with my company's 6.0 Pro (old, I know, but what we've got is what we've got,) on a Windows 7 machine. I've read online that in 6.0, PDFs created from multiple PDFs, by defaut, should have bookmarks from structure that use the original fi

  • Oracle workbench

    Does "Oracle Migration Workbench Release 10.1.0.4.0" support mysql ? if so where can i find the plugin for non oracle database it shows only "IBM and Informix" on plugin when i create Repository i get "No plugins are installed. please install the plu

  • Which windows 7 or 8 run best on mac book pro with retina

    I need to run Windows on my Mac for School.  Which one is best to install, Windows 7 or *?

  • Adobe Premiere Pro CS4 Issue: *Changing Position Decreases Brightness*

    Okay, this just doesn't make any sense... Please help me wise ones. I have a new sequence with one video track and one clip. If I change the position of the clip, the luminance/brightness decreases! There are no effects applied to the clip and no oth

  • Satellite A105-S4547 boots itself using battery

    Hi I am new to this forum. Since having the 'password ' problem and resetting the bios I have two things wrong. 1 Touchpad dosent work, but I'am not really bothered about that as I use a mouse anyway. The bigger problem is that after shutting down, i