Correcting a bug in the JRE classes

I have run across a bug in the class java.text.DecimalFormat
I am using JSE 1.3.1_04, Windows XP professional o.s.
The bug resides in the following method:
public StringBuffer format(double number, StringBuffer
result, FieldPosition fieldPosition)
The following line of code within the abovementioned
method will produce a "hotspot divide by zero error",
if the variable named "number" contains a value of zero.
boolean isNegative = (number < 0.0) || (number == 0.0 &&
1/number < 0.0);
I would like to repair this bug "in place" (actually change the line of code in error), and return the fixed class to the java.text package. How can I do this? I have extracted the source from the src.jar file, made the change, and now I need to replace the older version of this class.
BTW, I have submitted a bug report, however, I cannot wait for the fix.

Anyways, here is my somewhat "hacked" version of DecimalFormat.java to bypass the problem. Just make sure the following program resides in a directory that precedes the "rt.jar" file in the classpath.
import java.text.FieldPosition;
* A convenenience class to override the default implementation of DecimalFormat.
* This is purely a "workaround" to avoid the "divide by zero" error that is occasionally
* issued by the HotSpot  compiler.  See #format(double value) method for details
* When (and if) there is a problem resolution in a future release, this program should be disabled
* @author Stuart Leonard
* @version 1.0
* @since 09/08/2002
class DecimalFormat
    private java.text.DecimalFormat decfmt;
    private String dft = "";
    private static final char       PATTERN_DIGIT              = '#';
     * The public constructor for this class.  Accepts a pattern to be used
     * by a java.text.DecimalFormat object
     * @param fmt The pattern to be used
    public DecimalFormat(String fmt)
        decfmt = new java.text.DecimalFormat(fmt);
        // check to see if last position of pattern is zero
        // if so, initialize a "zero balance" default pattern.
        if (fmt != null && fmt.length() > 0)
            StringBuffer strbuf = new StringBuffer(fmt);
            int endPos = strbuf.length()-1;
            if (strbuf.charAt(endPos) == '0')
                int begPos = endPos;
                for (int i = endPos; i>0; i--)
                    char chr = strbuf.charAt(i);
                    if (chr == PATTERN_DIGIT)
                        begPos = i+1;
                        break;
                dft = strbuf.substring(begPos, endPos+1);
     * An overridden implementation of #java.text.NumberFormat.format(double)
     * If value is zero, then initialize return value with a blank suppressed
     * "zero balance" value, as specified by the original format pattern.
     * @param value The incoming double value to be formatted by a string pattern
     * @return The incoming value represented as a string pattern
    public String format (double value)
        String formatted = dft;
        if (value != 0)
            formatted = decfmt.format(value);
        return formatted;   
     * An overridden implementation of #java.text.DecimalFormat.format(double, StringBuffer, FieldPosition)
     * If value is zero, then initialize return value with a blank suppressed
     * "zero balance" value, as specified by the original format pattern.
     * Formats a double to produce a string.
     * @param number    The double to format
     * @param toAppendTo    where the text is to be appended
     * @param fieldPosition    On input: an alignment field, if desired.
     * On output: the offsets of the alignment field.
     * @return The value passed in as the result parameter
     * @see java.text.FieldPosition
    public StringBuffer format(double number, StringBuffer result,
                               FieldPosition fieldPosition)
        StringBuffer strbuf = new StringBuffer();
        if (number != 0)
            strbuf = decfmt.format(number, result, fieldPosition);
        else   
            strbuf.append(dft);
        return strbuf;   
     * The default implementation of #java.text.NumberFormat.format(long)
     * This exists ONLY because of the "divide by zero" error that
     * is being issued by #java.text.DecimalFormat.format(double, String Buffer, FieldPosition)
     * @param value The incoming value to be formatted by a string pattern
     * @return The incoming value represented as a string pattern
    public String format (long value)
          return decfmt.format(value);
     * The default implementation of #java.text.DecimalFormat.format(long, StringBuffer, FieldPosition)
     * This exists ONLY because of the "divide by zero" error that
     * is being issued by #java.text.DecimalFormat.format(double, String Buffer, FieldPosition)
     * Format a long to produce a string.
     * @param number    The long to format
     * @param toAppendTo    where the text is to be appended
     * @param fieldPosition    On input: an alignment field, if desired.
     * On output: the offsets of the alignment field.
     * @return The value passed in as the result parameter
     * @see java.text.FieldPosition
    public StringBuffer format(long number, StringBuffer result,
                               FieldPosition fieldPosition)
        return decfmt.format(number, result, fieldPosition);

Similar Messages

  • Could not find the main class: SearchExcel.  Program will exit.  ????

    sekic0429{uabudd_milou}[w10/rbssw/2.0] pwd
    /tmp/MyJava/jexcelapi
    sekic0429{uabudd_milou}[w10/rbssw/2.0] printenv CLASSPATH
    /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib
    sekic0429{uabudd_milou}[w10/rbssw/2.0] ls
    build ExcelSearch.java index.html resources SearchExcel.java~ tutorial.html
    docs ExelSearch.java~ jxl.jar SearchExcel.class src workbook.dtd
    ExcelSearch.class formatworkbook.dtd jxlrwtest.xls SearchExcel.java TestSpecification.xls
    sekic0429{uabudd_milou}[w10/rbssw/2.0] javac -extdirs . ExcelSearch.java
    sekic0429{uabudd_milou}[w10/rbssw/2.0]
    sekic0429{uabudd_milou}[w10/rbssw/2.0] java ExcelSearch
    Exception in thread "main" java.lang.NoClassDefFoundError: ExcelSearch
    Caused by: java.lang.ClassNotFoundException: ExcelSearch
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: ExcelSearch. Program will exit.
    sekic0429{uabudd_milou}[w10/rbssw/2.0] cat ExcelSearch.java
    import java.io.File;
    import java.io.IOException;
    import java.util.Date;
    import jxl.*;
    import jxl.read.biff.BiffException;
    public class ExcelSearch
    public static void main(String[] args)
    try
    Workbook workbook = Workbook.getWorkbook(new File("TestSpecification.xls"));
    catch (IOException e)
    e.printStackTrace();
    catch (BiffException e)
    e.printStackTrace();
    Regards Peter, hope for answer

    r035198x wrote:
    Where is SearchExcel.class?Excellent question, though I think I spotted a problem with the cp supplied.
    Note the documentation for -cp state (in part)
    For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified.So instead of this..
    java -cp /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcel..try this..
    java -cp /tmp/MyJava/excelapi/*:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcelNotes:
    1) Adding the JRE classes to the classpath should not be necessary, but I left the rest of the cp unaltered to highlight the one specific difference I am suggesting.
    2) When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the indentation and formatting of the sample. To use them, select the sample text and click the CODE button.
    If that still fails, tell us more specifically where the SearchExcel class is by copy/pasting the output (within code tags) of the command..
    prompt>jar -tvf mysearchexcel.jarWhere, of course, you replace 'mysearchexcel.jar' with the actual Jar name it is supposed to be located in.
    Edit 1:
    Changed JavaDocs -> documentation.
    Edited by: AndrewThompson64 on Jan 11, 2010 7:12 PM

  • Use of swings- one class calling the gui class

    Hi,
    I have a class Manager and a class ManagerGUI.
    My ManagerGUI class looks somehting like this-
    public class ManagerGUI extends JFrame
    String name;
    JPanel namePanel;
    JTextField nameInput;
    JLabel nameLabel;
    Manager empAgent;
    ManagerGUI(Manager ea)
    super(ea.getLocalName());
    empAgent = ea;
    //make the name panel and add it to the topPanel.
    addListeners();
    getContentPane().add(topPanel, BorderLayout.CENTER);
    setResizable(false);
    }//end constructor.
    public void show()
    pack();
    super.setVisible(true);
    void addListeners()
    nameInput.addActionListener(new NameL());
    class NameL implements ActionListener
    public void actionPerformed(ActionEvent e)
    nameE = nameInput.getText();
    }//end class ManagerGUI.
    I have tried to seperate it out so that any changes can be easily implemented (although it perhaps is a long way of doing things).
    Now I have a class Manager that wants to call the GUI and then process the information got from the text field.
    I use the following lines to call the GUI class.
    manGui = new ManagerGUI(this);
    manGui.show();
    Is this the correct way of calling the GUI class?
    How do I get to use the variable nameE here, in the Manager?
    Thanks.

    Hi,
    I have no idea why you want to have an instance of Manager class in class ManagerGUI and an instance of ManagerGUI class in Manager class.
    I will create an instance of Manager in ManagerGUI and show the GUI there.
    In Manager you can create method that will accept the text from textfield in parameter.
    L.P.

  • Looks like a stupid bug in the octetstring...Logger

    Hi all,
    My WLS hanged on no disk space left and most threads were hanging as follows:
    "ExecuteThread: '8' for queue: 'default'" daemon prio=5 tid=0x5f4c0d80 nid=0x6a0
    waiting on monitor [0x602af000..0x602afdb8]
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:415)
    at com.octetstring.vde.util.Logger.writeLock(Logger.java:195)
    at com.octetstring.vde.util.Logger.alog(Logger.java:310)
    at com.octetstring.vde.MessageHandler.doSearch(MessageHandler.java:312)
    at com.octetstring.vde.MessageHandler.answerRequest(MessageHandler.java:67)
    at com.octetstring.vde.WorkThread.executeWorkQueueItem(WorkThread.java:82)
    at weblogic.ldap.LDAPExecuteRequest.execute(LDAPExecuteRequest.java:28)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
    I noted that there was no other thread inside the
    at com.octetstring.vde.util.Logger.alog(Logger.java:310)
    that were NOT in the
    at com.octetstring.vde.util.Logger.writeLock(Logger.java:195)
    This makes me think that the 'Logger.alog()' method looks like this:
    wrtiteLock();
    writeToDisk(data); // whatever
    writeUnLock();
    instead of:
    writeLock();
    try{
    writeToDisk(data); // whatever
    finally {
    writeUnLock();
    Send it to the developers please, will you?
    Thanks,
    Mike.

    and a valuable lesson: whenever you think you've found a bug in one of the core classes, always consider that if it really were a bug minds immeasurably superior to yours would have found and reported it a long time ago.
    Ergo, whenever you find what you think is a bug in the core classes you should change your thinking to "what have I done wrong" rather than "there's a bug in Java".
    my sincere apologies to Orson Wells.

  • How to create an .exe file of the compiled class

    h2. {color:#000000}I would like to create a executable file{color}

    CeciNEstPasUnProgrammeur wrote:
    JSmooth just doesn't fulfill your requirements. If you can use JSmooth, you can just as well skipping the native part because the system's able to run a JARed program just as well. If you really want to go without a JRE, either look at InstallAnywhere which blows your 150 kB app to 15 MB by attaching an "internal" JRE to the .exe, or google for Java native compilers. Bear in mind, all the JRE classes need to be available for your program to run.IIRC JSmooth is able to download a suitable JRE if none is installed, so that would fulfill his requirements

  • What happened to the Triangulator class?

    I understand there were some bugs in the Triangulator class. It failed for polygons with holes in them, according to the docs...It seems that the entire class was deprecated. Does anyone know what the replacement is? Or if there is one?
    I am working through the Java 3D tutorial. I'm on Chapter 3. The first example of using the GeometryInfo class uses Triangulator. Can someone show me how to fix this? (Really, somebody needs to put up an errata/update page for this tutorial!)
    Here are the offending lines:
            GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
            gi.setCoordinates(coordinateData);
            gi.setStripCounts(stripCount);
            Triangulator tr = new Triangulator(); //this is deprecated
            System.out.println("begin triangulation");
            tr.triangulate(gi);
            System.out.println("  END triangulation");
            gi.recomputeIndices();Below is the entire code. This is GeometryInfoApp.java from the tutorial site http://java.sun.com/products/java-media/3D/collateral/ minus most of the commented lines.
    import java.applet.Applet;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.event.*;
    import java.awt.GraphicsConfiguration;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.universe.*;
    import com.sun.j3d.utils.geometry.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    public class GeomInfoApp extends Applet {
        float[] createCoordinateData() {
            float[] data = new float[69*3];               int i = 0;
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //0
            data[i++]= -0.9f; data[i++]= -0.3f; data[i++]= 0.3f; //1
            data[i++]= -0.8f; data[i++]= -0.1f; data[i++]= 0.3f; //2
            data[i++]= -0.6f; data[i++]= -0.1f; data[i++]= 0.3f; //3
            data[i++]= -0.5f; data[i++]= -0.3f; data[i++]= 0.3f; //4
            data[i++]=  0.2f; data[i++]= -0.3f; data[i++]= 0.3f; //5
            data[i++]=  0.3f; data[i++]= -0.1f; data[i++]= 0.3f; //6
            data[i++]=  0.5f; data[i++]= -0.1f; data[i++]= 0.3f; //7
            data[i++]=  0.6f; data[i++]= -0.3f; data[i++]= 0.3f; //8
            data[i++]=  1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //9
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]= 0.3f; //10
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]= 0.3f; //11
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]= 0.3f; //12
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]= 0.3f; //13
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]= 0.3f; //14
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]= 0.3f; //15
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; //16
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 0 17
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]=-0.3f; // 1 18
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]=-0.3f; // 2 19
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]=-0.3f; // 3 20
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]=-0.3f; // 4 21
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]=-0.3f; // 5 22
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 6 23
            data[i++]=  1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 7 24
            data[i++]=  0.6f; data[i++]= -0.3f; data[i++]=-0.3f; // 8 25
            data[i++]=  0.5f; data[i++]= -0.1f; data[i++]=-0.3f; // 9 26
            data[i++]=  0.3f; data[i++]= -0.1f; data[i++]=-0.3f; //10 27
            data[i++]=  0.2f; data[i++]= -0.3f; data[i++]=-0.3f; //11 28
            data[i++]= -0.5f; data[i++]= -0.3f; data[i++]=-0.3f; //12 29
            data[i++]= -0.6f; data[i++]= -0.1f; data[i++]=-0.3f; //13 30
            data[i++]= -0.8f; data[i++]= -0.1f; data[i++]=-0.3f; //14 31
            data[i++]= -0.9f; data[i++]= -0.3f; data[i++]=-0.3f; //15 32
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; //16 33
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]=  1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 0 34
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 1 35
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]= 0.3f; // 2 36
            data[i++]=  1.3f; data[i++]= -0.3f; data[i++]= 0.3f; // 3 37
            data[i++]=  1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 4 38
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 0 39
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]=-0.3f; // 1 40
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]= 0.3f; // 2 41
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]= 0.3f; // 3 42
            data[i++]=  1.2f; data[i++]= -0.1f; data[i++]=-0.3f; // 4 43
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]=-0.3f; // 0 44
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]=-0.3f; // 1 45
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]= 0.3f; // 2 46
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]= 0.3f; // 3 47
            data[i++]=  0.5f; data[i++]=  0.0f; data[i++]=-0.3f; // 4 48
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]=-0.3f; // 0 49
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]=-0.3f; // 1 50
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]= 0.3f; // 2 51
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]= 0.3f; // 3 52
            data[i++]=  0.1f; data[i++]=  0.3f; data[i++]=-0.3f; // 4 53
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]=-0.3f; // 0 54
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]=-0.3f; // 1 55
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]= 0.3f; // 2 56
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]= 0.3f; // 3 57
            data[i++]= -0.5f; data[i++]=  0.3f; data[i++]=-0.3f; // 4 58
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]=-0.3f; // 0 59
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]=-0.3f; // 1 60
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]= 0.3f; // 2 61
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]= 0.3f; // 3 62
            data[i++]= -1.1f; data[i++]=  0.0f; data[i++]=-0.3f; // 4 63
            System.out.println("end polygon; total vertex count: "+i/3);
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]=-0.3f; // 0 64
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]=-0.3f; // 1 65
            data[i++]= -1.3f; data[i++]= -0.3f; data[i++]= 0.3f; // 2 66
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]= 0.3f; // 3 67
            data[i++]= -1.3f; data[i++]=  0.0f; data[i++]=-0.3f; // 4 68
            System.out.println("end polygon; total vertex count: "+i/3);
            return data;
        Appearance createMaterialAppearance(){
            Appearance materialAppear = new Appearance();
            PolygonAttributes polyAttrib = new PolygonAttributes();
            polyAttrib.setCullFace(PolygonAttributes.CULL_NONE);
            materialAppear.setPolygonAttributes(polyAttrib);
            Material material = new Material();
            material.setDiffuseColor(new Color3f(1.0f, 0.0f, 0.0f));
            materialAppear.setMaterial(material);
            return materialAppear;
        Appearance createWireFrameAppearance(){
            Appearance materialAppear = new Appearance();
            PolygonAttributes polyAttrib = new PolygonAttributes();
            polyAttrib.setPolygonMode(PolygonAttributes.POLYGON_LINE);
            materialAppear.setPolygonAttributes(polyAttrib);
            ColoringAttributes redColoring = new ColoringAttributes();
            redColoring.setColor(1.0f, 0.0f, 0.0f);
            materialAppear.setColoringAttributes(redColoring);
            return materialAppear;
        public BranchGroup createSceneGraph(boolean wireFrame) {
            int total = 0;
            System.out.println("\n --- geometry debug information --- \n");
            float[] coordinateData = null;
            coordinateData = createCoordinateData();
            int[] stripCount = {17,17,5,5,5,5,5,5,5};
            for(int i=0; i<stripCount.length; i++){
                    System.out.println("stripCount["+i+"] = "+stripCount);
    total +=stripCount[i];
    if (total != coordinateData.length/3){
    System.out.println(" coordinateData vertex count: "+coordinateData.length/3);
    System.out.println("stripCount total vertex count: "+total);
    GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
    gi.setCoordinates(coordinateData);
    gi.setStripCounts(stripCount);
    Triangulator tr = new Triangulator();
    System.out.println("begin triangulation");
    tr.triangulate(gi);
    System.out.println(" END triangulation");
    gi.recomputeIndices();
    NormalGenerator ng = new NormalGenerator();
    ng.generateNormals(gi);
    gi.recomputeIndices();
    Stripifier st = new Stripifier();
    st.stripify(gi);
    gi.recomputeIndices();
    Shape3D part = new Shape3D();
    if(wireFrame==true)
    part.setAppearance(createWireFrameAppearance());
    else
    part.setAppearance(createMaterialAppearance());
    part.setGeometry(gi.getGeometryArray());
    BranchGroup contentRoot = new BranchGroup();
    TransformGroup objSpin = new TransformGroup();
    objSpin.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    contentRoot.addChild(objSpin);
    objSpin.addChild(part);
    LineStripArray lineArray = new LineStripArray(69, LineArray.COORDINATES, stripCount);
    lineArray.setCoordinates(0, coordinateData);
    Appearance blueColorAppearance = new Appearance();
    ColoringAttributes blueColoring = new ColoringAttributes();
    blueColoring.setColor(0.0f, 0.0f, 1.0f);
    blueColorAppearance.setColoringAttributes(blueColoring);
    LineAttributes lineAttrib = new LineAttributes();
    lineAttrib.setLineWidth(2.0f);
    blueColorAppearance.setLineAttributes(lineAttrib);
    objSpin.addChild(new Shape3D(lineArray, blueColorAppearance));
    Alpha rotationAlpha = new Alpha(-1, 16000);
    RotationInterpolator rotator =
    new RotationInterpolator(rotationAlpha, objSpin);
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);
    objSpin.addChild(rotator);
    DirectionalLight lightD = new DirectionalLight();
    lightD.setDirection(new Vector3f(0.0f,-0.7f,-0.7f));
    lightD.setInfluencingBounds(bounds);
    contentRoot.addChild(lightD);
    AmbientLight lightA = new AmbientLight();
    lightA.setInfluencingBounds(bounds);
    contentRoot.addChild(lightA);
    Background background = new Background();
    background.setColor(1.0f, 1.0f, 1.0f);
    background.setApplicationBounds(bounds);
    contentRoot.addChild(background);
    return contentRoot;
    public GeomInfoApp(String[] args) {
    setLayout(new BorderLayout());
    GraphicsConfiguration config =
    SimpleUniverse.getPreferredConfiguration();
    Canvas3D canvas3D = new Canvas3D(config);
    add("Center", canvas3D);
    BranchGroup scene = createSceneGraph(args.length>0);
    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
    simpleU.getViewingPlatform().setNominalViewingTransform();
    simpleU.addBranchGraph(scene);
    public static void main(String[] args) {
    System.out.print("GeomInfoApp - Java 3D API demo program\n");
    System.out.print("A demonstration of using the GeometryInfo class.\n");
    System.out.print("The blue lines show the input geometry - the red ");
    System.out.print("geometry was created by the GeometryInfo and other classes.\n");
    System.out.print("Running the program without any command line arguments will show a solid object\n");
    System.out.print("Supplying any command line argument will show the wireframe.\n");
    System.out.print("http://java.sun.com/products/java-media/3D/collateral\n");
    Frame frame = new MainFrame(new GeomInfoApp(args), 256, 256);

    Yes, we have a doc bug here. Search for "class editor" in the help system index and you will find several (4) topics about using the class editor for JavaBeans. The Class tab referred to is not available when you create a POJO or a Bean. I can enter a TAR on that if you want.

  • Could not find the main class JRE 1.6 only with console program into Contro

    Hi,
    I want replace JRE1.5-11 with JRE 1.6.
    Applet is running correctly with JRE 1.6.
    But when i want launching Java program located into "Parameters/Control Panel"
    I have following error message "Could not find the main class JRE 1.6 "
    Regards
    Philippe

    i wouldn't report a nullpointer to sun unless you're fairly confident there's some sort of bug. if main() can't be found it sounds to me like a config issue. if nullpointer, sounds like a code issue. post the code if you want, but i don't think sun will help you debug this.

  • Is there a bug in the as3 tween class

    Is there a bug in the as3 tween class that causes tweens to stop before completing. I read that there is and that a 3rd party tween class should be used. I'm just starting out learning as3 and experimenting but this would be good to know when I move onto more complex projects.
    Also the solution for this was to make your function global. Does this simply mean place your function in the top level of your movie.
    I have done research on this topic but I found many conflicting answers.
    Any assistance is welcome thanks in advance.

    the tween declaration (if you need one) must be placed within the scope of the function.  so, if the below function f() is defined in a movieclip, you can use any of the 3 (but don't use the last):
    ///////// most common use ////////////////////////////////////////
    var t:Tween;
    function f(){
    t=new Tween(...)
    /////// next most common use /////////////////////////////////////////
    //no declaration needed because the tween is not referenced anywhere outside the function so need not be assigned a variable
    function f(){
    new Tween(...)
    /////////// least common, not good coding, but possible ////////////
    // var t:Tween;  // declared on the root timeline, for example
    function f(){
    MovieClip(root).t=new Tween(...)
    p.s.  please mark correct/helpful answers

  • How do I know which is the correct location of the JRE?

    How do I know which is the correct location of the JRE / JVM? What do I add to my PATH environment variable? I'm trying to install Sybase ASE on my Sun Fire v480 SPARC box, but keep getting the below error...
    "A suitable JVM could not be found. Please run the program again using the option -is:javahome <JAVA HOME DIR>"
    So I did the following...
    STEP 01) To confirm that Java is installed, I ran the java -version command. I received the following output...
    bash-3.00# java -version
    java version "1.5.0_17"
    Java(TM) Platform, Standard Edition for Business (build 1.5.0_17-b04)
    Java HotSpot(TM) Server VM (build 1.5.0_17-b04, mixed mode)
    STEP 02) Then I tried to locate the location of where Java was installed...
    bash-3.00# which java
    /usr/bin/java
    STEP 03) Then I tried to confirm if it was a symbolic link or not...
    bash-3.00# ls -al /usr/bin/java
    lrwxrwxrwx 1 root other 16 Jun 24 01:54 /usr/bin/java -> ../java/bin/java
    STEP 04) The symbolic link doesn't seem to match any of the output below. Which is the correct location / path of Java (JVM / JRE)?
    bash-3.00# find / -name java -print;
    /usr/share/lib/java
    /usr/share/java
    /usr/bin/java
    /usr/sfw/include/mozilla/java
    /usr/include/firefox/java
    /usr/jdk/instances/jdk1.5.0/bin/java
    /usr/jdk/instances/jdk1.5.0/bin/sparcv9/java
    /usr/jdk/instances/jdk1.5.0/jre/bin/java
    /usr/jdk/instances/jdk1.5.0/jre/bin/sparcv9/java
    /usr/jdk/packages/javax.help-2.0/doc/api/com/sun/java
    /usr/java
    /usr/apache/tomcat/webapps/tomcat-docs/catalina/docs/api/org/apache/naming/java
    /usr/apache/tomcat55/classes/org/apache/naming/java
    /usr/apache/jserv/docs/api/org/apache/java
    /usr/j2se/bin/java
    /usr/j2se/bin/sparcv9/java
    /usr/j2se/jre/bin/java
    /usr/j2se/jre/bin/sparcv9/java
    /usr/appserver/samples/blueprints/adventure1.0.4/project/apps/activitysupplier/activitysupplier-ejb/src/java
    /usr/appserver/samples/blueprints/adventure1.0.4/project/apps/airlinesupplier/airlinesupplier-ejb/src/java
    /usr/appserver/samples/blueprints/adventure1.0.4/project/apps/bank/bank-ejb/src/java
    /usr/appserver/samples/webservices/security/web/apps/clientCert/clientCert-share/src/java
    /usr/appserver/samples/webservices/security/web/apps/clientCert/clientCert-war/src/java
    /usr/appserver/samples/webservices/security/web/apps/xms/xms-client/src/java
    /usr/appserver/samples/webservices/security/web/apps/xms/xms-share/src/java
    /usr/appserver/samples/webservices/security/web/apps/xms/xms-war/src/java
    /usr/appserver/samples/xml/apps/dom/src/java
    /usr/appserver/samples/xml/apps/sax/src/java
    /usr/appserver/samples/xml/apps/xslt/src/java
    /opt/staroffice8/share/Scripts/java

    I've been racking my head against the wall, but can't seem to find the solution... I've even installed the latest JRE (in a new location), but still seem to have the same problem. Please see the notes below...
    I installed the latest JRE in /export/home/jvm/jre1.6.0_17/
    bash-3.00# /export/home/jvm/jre1.6.0_17/bin/java -version
    java version "1.6.0_17"
    Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
    Java HotSpot(TM) Server VM (build 14.3-b01, mixed mode)
    bash-3.00# PATH=/export/home/jvm/jre1.6.0_17/bin:$PATH
    bash-3.00# export PATH
    bash-3.00# echo $PATH
    /export/home/jvm/jre1.6.0_17/bin:/usr/sbin:/usr/bin
    bash-3.00# JAVA_HOME=/export/home/jvm/jre1.6.0_17/bin
    bash-3.00# export JAVA_HOME
    bash-3.00# echo $JAVA_HOME
    /export/home/jvm/jre1.6.0_17/bin
    bash-3.00# env
    HZ=100
    LC_MONETARY=en_CA.UTF-8
    TERM=xterms
    SHELL=/sbin/sh
    LC_NUMERIC=en_CA.UTF-8
    OLDPWD=/export/home/jvm/jre1.6.0_17
    PATH=/export/home/jvm/jre1.6.0_17/bin:/usr/sbin:/usr/bin
    MAIL=/var/mail/root
    LC_MESSAGES=C
    LC_COLLATE=en_CA.UTF-8
    PWD=/export/home/jvm/jre1.6.0_17/bin
    JAVA_HOME=/export/home/jvm/jre1.6.0_17/bin
    EDITOR=vi
    TZ=Japan
    SHLVL=1
    HOME=/
    LOGNAME=root
    LC_CTYPE=en_CA.UTF-8
    LC_TIME=en_CA.UTF-8
    _=/usr/bin/env
    bash-3.00# cd /cdrom/disc1050709/
    bash-3.00# ./setup -console
    InstallShield Wizard
    Initializing InstallShield Wizard...
    Searching for Java(tm) Virtual Machine...
    .........................A suitable JVM could not be found. Please run the program again using the option -is:javahome <JAVA HOME DIR>
    Is there something I'm missing?
    Thank you

  • JRE doesn't find the main class inside a JAR archive file

    Hello everybody,
    I've written a small application in Java, using NetBeans. Running my application inside NetBeans works fine, but I can't run it from the console or by double clicking the jar file.
    Running it from the console I get the following error message:
    java -jar TestApplication.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: tst.Benchmark
       at gnu.java.lang.MainThread.run(libgcj.so.81)
    Caused by: java.lang.ClassNotFoundException: tst.Benchmark not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:TestApplication.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
       at java.net.URLClassLoader.findClass(libgcj.so.81)
       at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.81)
       at java.lang.ClassLoader.loadClass(libgcj.so.81)
       at java.lang.ClassLoader.loadClass(libgcj.so.81)
       at gnu.java.lang.MainThread.run(libgcj.so.81)I know that these errors often come when the class path is not set in the right way, and using a single java file, you can fix this by passing the parameter "-cp ."
    I tried this with the jar file but it does not work and using "-cp TestApplication.jar tst/Benchmark" didn't work either.
    Inside the jar file I have the META-INF Folder and a "tst" Folder which contains all my class files. And I've set tst.Benchmark as the main class, this also stands in the manifest file correctly.
    Do you have any ideas what could be wrong?
    Greetings JavanianGuy

    This line
    at gnu.java.lang.MainThread.run(libgcj.so.81)says that you're using GNU's Java, not Sun's Java. They are not the same. GNU Java is incomplete.
    You'll need to ask this question at the GNU Java site.
    Recommendation: Use Sun's Java

  • [svn:osmf:] 13027: Fix bug in SerialElement where the durationReached event was dispatched on a child-to-child transition due to the base class thinking that the duration had been reached  (since the second child didn't have a duration yet).

    Revision: 13027
    Revision: 13027
    Author:   [email protected]
    Date:     2009-12-16 18:09:46 -0800 (Wed, 16 Dec 2009)
    Log Message:
    Fix bug in SerialElement where the durationReached event was dispatched on a child-to-child transition due to the base class thinking that the duration had been reached (since the second child didn't have a duration yet).  Injection from trait refactoring.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/composition/CompositeTimeTrait.as

    http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/libata/ch07.html#excatATAbusErr wrote:
    ATA bus error means that data corruption occurred during transmission over ATA bus (SATA or PATA). This type of errors can be indicated by
    ICRC or ABRT error as described in the section called “ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION)”.
    Controller-specific error completion with error information indicating transmission error.
    On some controllers, command timeout. In this case, there may be a mechanism to determine that the timeout is due to transmission error.
    Unknown/random errors, timeouts and all sorts of weirdities.
    As described above, transmission errors can cause wide variety of symptoms ranging from device ICRC error to random device lockup, and, for many cases, there is no way to tell if an error condition is due to transmission error or not; therefore, it's necessary to employ some kind of heuristic when dealing with errors and timeouts. For example, encountering repetitive ABRT errors for known supported command is likely to indicate ATA bus error.
    Once it's determined that ATA bus errors have possibly occurred, lowering ATA bus transmission speed is one of actions which may alleviate the problem.
    I'd also add; make sure you have good backups when ATA errors are frequent

  • Ojc will compile the following class. A bug?

    I thought that in Java classes cannot be declared protected. ojc will however compile the following class:
    protected class aclass
    The Sun java compiler prints the following error:
    aclass.java:1: modifier protected not allowed here
    protected class aclass
    Is this a known bug in the Oracle Java compiler?

    Yes, it seems we have a little bug in OJC, the protected access modifier should only be allowed for member classes. I filed a bug report and I'll fix it.
    Thanks!
    Keimpe Bronkhorst
    JDev Team

  • [svn:fx-trunk] 5812: Fixed a bug where direct use of Animation failed because AnimationProperty was not setting up its internal keyframes with correct duration information , so the animation would skip immediately to the end.

    Revision: 5812
    Author: [email protected]
    Date: 2009-03-31 11:34:56 -0700 (Tue, 31 Mar 2009)
    Log Message:
    Fixed a bug where direct use of Animation failed because AnimationProperty was not setting up its internal keyframes with correct duration information, so the animation would skip immediately to the end.
    Bugs: SDK-20356
    QE Notes: spark/effects Mustella tests currently hosed, couldn't run test suite
    Doc Notes: None
    Reviewer: Jason
    Testing: checkintests, Mustella effects tests could not be run (post-rename issues)
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-20356
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimationProperty.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/animation/Animation.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateColorIns tance.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateShaderTr ansitionInstance.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/FadeInstance.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/MoveInstance.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/ResizeInstance. as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/Rotate3DInstanc e.as
    flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/RotateInstance. as

    Hi
    Can you please try setting up full persmission in the security properties for everyone on the wsconfig folder C:\ColdFusion10\config\wsconfig  and restart ColdFusion Server.
    Swaraj

  • Word 2011 for Mac Book pro - I have found that my cursor disappears sometimes when I click on a toolbar function. I found out it is a bug, that the Mac loses 'focus'. I can correct it temporarily by clicking on Format - Font - Cancel. Any info?

    I have Word 2011 on a Mac Book Pro and have had problems with a dissapearing cursor - it makes editing tricky
    After googling it I found out that there is a bug where the Mac loses focus if you click away from the document - it also does this with italics according to other users.
    I had a play with it and found out that when I click on the toolbar in a document where this happens, the cursor disappears, e.g. changing font colour etc. And then, when I click on Format - Font - Cancel it returns
    I'd be interested if anyone else has a comment to add, please do
    thanks

    BTW (speaking as a Dad of 3 daughters in Grad school) if you don't already have and use a DropBox account, or some other similar online "cloud" based backup of your school documents, you should start doing so immediately. By keeping all of your important documents in the Dropbox folder on your computer, you have instant access to them from any other computer (or iPad), should you be w/o your computer while in for repairs (or if, God forbid, it is stolen). It's free for 2 GB of online storage, which is more than enough for a few years worth of Word documents, etc. (If you get other people to sign up via your email "invitation", then Dropbox gives you even more free storage space.) Every time you close a document, it is updated on the Dropbox servers (encrypted), if it is in the Dropbox folder (assuming you give it a few seconds to update before turning off your computer). Do a google search of "Cloud based storage comparisons" to compare the amount of free space each of the competing services give you.

  • BUG: Oracle Java Compiler bug with anonymous inner classes in constructor

    The following code compiles and runs just fine using 1.4.2_07, 1.5.0_07 and 1.6.0_beta2 when compiling and running from the command-line.
    It does not run when compiling from JDeveloper 10.1.3.36.73 (which uses the ojc.jar).
    When compiled from JDeveloper, the JRE (both the embedded one or the external 1.5.0_07 one) reports the following error:
    java.lang.VerifyError: (class: com/ids/arithmeticexpr/Scanner, method: <init> signature: (Ljava/io/Reader;)V) Expecting to find object/array on
    stack
    Here's the code:
    /** lexical analyzer for arithmetic expressions.
    Fixes the lookahead problem for TT_EOL.
    public class Scanner extends StreamTokenizer
    /** kludge: pushes an anonymous Reader which inserts
    a space after each newline.
    public Scanner( Reader r )
    super( new FilterReader( new BufferedReader( r ) )
    protected boolean addSpace; // kludge to add space after \n
    public int read() throws IOException
    int ch = addSpace ? ' ' : in.read();
    addSpace = ch == '\n';
    return ch;
    public static void main( String[] args )
    Scanner scanner = new Scanner( new StringReader("1+2") ); // !!!
    Removing the (implicit) reference to 'this' in the call to super() by passing an instance of a static inner class 'Kludge' instead of the anonymous subclass of FilterReader fixes the error. The code will then run even when compiled with ojc. There seems to be a bug in ojc concerning references to the partially constructed object (a bug which which is not present in the reference compilers.)
    -- Sebastian

    Thanks Sebastian, I filed a bug for OJC, and I'll look at the Javac bug. Either way, OJC should either give an error or create correct code.
    Keimpe Bronkhorst
    JDev Team

Maybe you are looking for