Static reference error

Hi experts,
I have an application that launches a simple browser.
I have this resourcheBundle containing the url string
  ResourceBundle bundle = ResourceBundle.getBundle("Init");
  String LOCAL_URL_STRING = bundle.getString("BrowseItem");The ResourceBundle.getBundle("Init") in the resource file is:
Init=BrowseItem=file:/D:/My Web Sites/Kingdom.htmlMy problem is how can I avoid the error message that says:
non-static variable LOCAL_URL_STRING cannot be referenced from a static contextMy main method has this code:
public static void main(String[] args) {
    String urlString = LOCAL_URL_STRING;
    if (args.length > 0)
       urlString = args[0];
    new Browser(urlString).setVisible(true);
  }Changing the String LOCAL_URL_STRING = bundle.getString("BrowseItem"); to static would not help either.
Please

Kevin_Cloutier wrote:
Regardless of whether you use the Preferences API, if you want to access class variables from the main method (which is static) you need to have an object of the class to do so.Kevin, I have replaced that constant.
So far I have read some of the tutorials that are suggested in this thread, but I am not getting any fitting situation yet. May be I hit the wrong tutorials.
So I am placing my code here.
//file: Browser.java
package browser;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*; // for the Bundle
public class Browser extends JFrame {
  protected JEditorPane mEditorPane;
  protected JTextField mURLField;
  ResourceBundle bundle = ResourceBundle.getBundle("Init");
  String localURLStirng = bundle.getString("BrowseItem");
  public Browser(String urlString) {
    super("Simple Browser");
    createGUI(urlString);
  protected void createGUI( String urlString ) {
    Container content = getContentPane(  );
    content.setLayout(new BorderLayout(  ));
    JToolBar urlToolBar = new JToolBar(  );
    mURLField = new JTextField(urlString, 40);
    urlToolBar.add(new JLabel(""));
    urlToolBar.add(mURLField);
    //content.add(urlToolBar, BorderLayout.NORTH);
    mEditorPane = new JEditorPane(  );
    mEditorPane.setEditable(false);
    content.add(new JScrollPane(mEditorPane), BorderLayout.CENTER);
    openURL(urlString); 
    mURLField.addActionListener(new ActionListener(  ) {
      public void actionPerformed(ActionEvent ae) {
        openURL(ae.getActionCommand(  ));
    mEditorPane.addHyperlinkListener(new LinkActivator(  ));
    setSize(500, 600);
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  protected void openURL(String urlString) {
    try {
      URL url = new URL(urlString);
      mEditorPane.setPage(url);
      mURLField.setText(url.toExternalForm(  ));
    catch (Exception e) {
      System.out.println("Couldn't open " + urlString + ":" + e);
  class LinkActivator implements HyperlinkListener {
    public void hyperlinkUpdate(HyperlinkEvent he) {
      HyperlinkEvent.EventType type = he.getEventType(  );
      if (type == HyperlinkEvent.EventType.ACTIVATED)
        openURL(he.getURL(  ).toExternalForm(  ));
  public static void main(String[] args) {
    String urlString = new String(localURLStirng);
    if (args.length > 0)
       urlString = args[0];
    new Browser( urlString ).setVisible( true );
}I need this since the Properties file deals with this link:
BrowseItem=file:/D:/My Web Sites/Kindgdom Bible Studies Background Information/www.kingdombiblestudies.org/Revelation/rev70.htm.
This is a local copy of the website http://www.kingdombiblestudies.org (thanks to HTTrack) which I would like to distribute as browsable articles to none-programmer students of the Word of God regardless of the church building they represent.
Its just that I feel the need for them to browse at this site sometimes. So I gave this effort to learning Java even if I am not a programmer.
I therefore solicit assistance for that code alone. As one that is familiar in some degree to Spiritual things, I find it sometimes necessary to use some programming technology to assist the needs of the Kingdom of God on the earth.
I know it is not easy to stress my points so clear, but the messages of J. Preston Eby are all very real to me.
Things like, "No Physical Heaven, No Hell, No Rapture, No Golden Street, No Physical Satan to fear, No Physical 666 and worldwide rule of the Anti-Christ, Jesus is a corporate Man of which we are part of, All Men will attain into the experience of the Glory of God in His throne, all Men will be saved and become immortal, the new creation shall also be a creator or that the Creation is Co-extensive with THE Creator" --these are entirely controversial in the CHURCH WORLD.
--A MUST READ I must say for the Church age to see*
I am currently dealing with coppied link of the latest writings of J. Preston Eby in the Kingdom Bible Studies Series which can be found at:
http://www.kingdombiblestudies.org/tablecontents.htm#REVThis man gives his letters free of charge to the rest of the world and does not ask for money. And although I am in the Philippines, I am quite affected so much by his writings that I thought that it is entirely a Great hope that somehow, someone can assist him in his Revelation Series distribution to be spread all accross the globe in electronic or letter format.
And that is why I am here learning a lot from this forum, but I believe that there is no substitute to pure relationship, and that is why I could not relate so much to the Java API (may be I am not alone).
We humans need a better person who could impart to us the learning that we need in the aspect of our life and walk where we need them. I can not overemphasize the examples that Jesus Christ had set. But I believe I have made my points very clear. Even Jesus himself need the proper nourishing words from his physical parents to impart practical knowlege of which it isnt written that he learned it from His School Youth 101.
Therefore I need your help. Many come into this forum asking help becuase they are stock with their deadlines on they business projects or school assignments but my coming here is different because my cause and my reason is actually concerning the things of God.
I need help because of the Work of God.
Can anyone help me?
I am not a church member. I dont go to churches. I just believe in God -- I mean, "*THE GOD*". And this is the only way I know that I can contribute to the world's needs.
I dont mean to talk metaphysics but I think I just made my points very clear.
The real intelligent men among you can investigate to see if I am really serious about this.
You can as well investigate if you have time, just as we always had time to investigate the API. But that is not a requirement. All it needs for you is to hear from God the TRUTH that's in your HEART. He will reveal everythig to you.
That might sound metaphysics to some. But it is not. It may sound crazy or insane for others. But I am assured of this:
The foolishness of God is wiser than men
Surely one would say, this is a technical forum.
My simple answer is:
Yes it is. That is why I ask technical assistance.
Please help me.

Similar Messages

  • Static reference; how am I instantiating this incorrectly?

    Hi, all:
    I'm getting a static reference error, but I don't know how to fix it. I'm trying to generate a list of objects, and I can't tell where the problem is located. I've chopped all the irrelevant stuff out of this class so you can see what's going on:
    public class VonNeumannGridNet {
         public int nCols = -1;
         public int nNodes;
         public int nRows = -1;
         public int radius = -1;
         public ArrayList <Node> nodeList;
         public Class <Node> nodeClass;
         public Class <Edge> edgeClass;
         public VonNeumannGridNet ( Class<Node> node, Class <Edge> edge, int cols, int rows, int connectRadius) {
              nodeClass = node;
              edgeClass = edge;
              nCols = cols;
              nRows = rows;
              nNodes = nCols * nRows;
              radius = connectRadius;
         public ArrayList<Node> makeVonNeumannGridNet(Class<Node> node, Class<Edge> edge,
                   int cols, int rows, int connectRadius) throws IllegalAccessException, InstantiationException     {
              return nodeList;
         public static List <Node> makeVonNeumannGridNet(int cols, int rows, int connectRadius,
                   double rewireProb, Class <Node> node, Class <Edge> edge) {
              ArrayList <Node> list = makeVonNeumannGridNet(node, edge, cols, rows, connectRadius); //ERROR HERE
              ArrayList <Node> network = new ArrayList <Node> (NetUtilities.randomRewireSymmetric(list, rewireProb));
              return network;
    public Class <Node> getNodeClass() {     return nodeClass;}
    public void setNodeClass(Class <Node> node)     {nodeClass = node;}
    public Class <Edge> getEdgeClass()     { return edgeClass;}
    public void setEdgeClass(Class <Edge> edge) {edgeClass = edge;}
    }The error happens when I try to "makeVonNeumannGridNet"; how is that a static reference?

    Geesh what a worthless discussion.
    After all, the cause of your problem is that you're trying to access an instance method from within a static (non-instance!) method. The possible solutions might be obvious:
    1) make both methods non-static.
    2) make both methods static.
    3) make the calling method non-static and make the method-to-be-called static.
    4) instantiate the class having the instance method and invoke that method using the reference.
    Read a good Java book/tutorial and learn about static vs. non-static. Don't use them randomly, but use them when the design and behaviour require.

  • Error: Cannot make a static reference to the non-static method

    Below is a java code. I attempt to call method1 and method2 and I got this error:
    Cannot make a static reference to the non-static method but If I add the keyword static in front of my method1 and method2 then I would be freely call the methods with no error!
    Anyone has an idea about such error? and I wrote all code in the same one file.
    public class Lab1 {
         public static void main(String[] args) {
              method1(); //error
         public  void method1 ()
         public  void method2 ()
    }

    See the Search Forums at the left of the screen?
    If you had searched with "Cannot make a static reference to the non-static method"
    http://search.sun.com/search/onesearch/index.jsp?qt=Cannot+make+a+static+reference+to+the+non-static+method+&rfsubcat=siteforumid%3Ajava54&col=developer-forums
    you would have the answer. Almost every question you will ask has already been asked and answered.

  • Open VI reference from a static reference

    Hello guys,
    To open VIs dynamically, instead of hardcoding the VI name in a string constant, I do this as shown below to keep a dependency to my VI, so if someone ever delete the VI from the project, move it, rename it, it will create a broken wire somewhere so we'll be able to fix it faster.
    However, don't you think it's a bit weird to have the reference to the VI already, but we need to open a new reference, is there a way to get rid of the property node to get the VI path? Is the static VI reference should be closed after the other reference is opened?
    Would it make sense to be able to right clic the static reference and specify the option to open a call and forget reference?
    Is there a better practice?
    Cheers,
    Solved!
    Go to Solution.

    From the LabVIEW help:
    vi path accepts a string containing the name of the VI that you want to reference or a path to the VI that you want to reference. If you wire a name string, the string must match the full delimited name of a VI in memory on that target. If you wire a path, LabVIEW searches for a VI in memory that you previously loaded from that path on the same target. If a matching VI is not found in memory, LabVIEW then tries to load the VI from that file on disk. An error occurs if LabVIEW cannot find the file or if the file conflicts with another VI in memory.
    So, basically, if you use the string, you load the VI in memory and get an error if not found.  If you use path, it will still use the VI in memory at that path, or attempt to load it.  In your case, it won't make much difference.  I typically use VI Name myself since I know it is in memory.

  • How do you make a static reference to a method?  I've included code.

    I'm sorry but this is a cross post. This should be here but it is also in the 100% pure Java forum. It won't happen again.
    Now...
    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{   
        static String sString = "TESTING";   
        public int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;      
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );   
    }Again, I apologize for the cross post.

    hi,
    this seems to be pretty easy, isn't it?
    Oh c'mon! You try to invoke a non-static method from within a static method. Solution: Create a specific instance of class testClass:
    testClass test=new testClass();
    test.add(3,4);best regards, Michael

  • Can't make static reference to method while it is static

    Hello, can somebody please help me with my problem. I created a jsp page wich includes a .java file I wrote. In this JSP I called a method in the class I created. It worked but when I made the method static and adjusted the calling of the method it started to complain while i didnt make an instance of the class. the error is:Can't make static reference to method
    here is the code for the class and jsp:
    public class PhoneCheckHelper {
    public static String checkPhoneNumber(String phoneNumber) {
    String newPhoneNumber ="";
    for(int i=0; i<phoneNumber.length(); i++) {
    char ch = phoneNumber.charAt(i);
    if(Character.isDigit(ch)) {
    newPhoneNumber += String.valueOf(ch);
    return newPhoneNumber;
    <html>
    <head>
    <title>phonecheck_handler jsp pagina</title>
    <%@page import="java.util.*,com.twofoldmedia.text.*, java.lang.*" %>
    </head>
    <body>
    <input type="text" value="<%= PhoneCheckHelper.checkPhoneNumber(request.getParameter("phonenumberfield")) %>">
    </body>
    </html>

    Go over to the "New to Java" forum where that message is frequently explained. Do a search if you don't see it in the first page of posts.

  • Can't make static reference to method

    hi all,
    pls help me in the code i'm getting
    " can't make static reference to method....."
    kindly help me
    the following code gives the error:
    import java.rmi.*;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.io.*;
    import java.io.IOException;
    import java.io.LineNumberReader;
    public class client
    static String vcno;
    static String vpin;
    static String vamt;
    static String vordid;
    static String vptype;
    //static String vreq;
    static String vreq = "1";
    static String vorgid;
    static String vm1;
    static String vs1;
    static String vqty1;
    static String vm2;
    static String vs2;
    static String vqty2;
    static String vm3;
    static String vs3;
    static String vqty3;
    static String vm4;
    static String vs4;
    static String vqty4;
    public static void main(String args[])
    try
    ServerIntf serverintf=(ServerIntf)Naming.lookup("rmi://shafeeq/server");
    int c;
    StringBuffer sb;
    FileReader f1=new FileReader("c:/testin.txt");
    sb=new StringBuffer();
    int line=0;
    while ((c=f1.read())!=-1) {
    sb.append((char)c);
    LineNumberReader inLines = new LineNumberReader(f1);
    String inputline;
    String test;
    while((inputline=inLines.readLine())!=null)
    line=inLines.getLineNumber();
    switch(line)
    case 1: {
    vcno = inLines.readLine();
    System.out.println(vcno);
    case 2: {
    vpin = inLines.readLine();
    System.out.println(vpin);
    case 3: {
    vptype = inLines.readLine();
    System.out.println(vptype);
    case 4: {
    vamt = inLines.readLine();
    System.out.println(vamt);
    case 5: {
    vordid = inLines.readLine();
    System.out.println(vordid);
    case 6: {
    vorgid = inLines.readLine();
    System.out.println(vorgid);
         case 7: {
    vm1 = inLines.readLine();
    System.out.println(vm1);
         case 8: {
    vs1 = inLines.readLine();
    System.out.println(vs1);
         case 9: {
    vqty1 = inLines.readLine();
    System.out.println(vqty1);
         case 10: {
    vm2 = inLines.readLine();
    System.out.println(vm2);
         case 11: {
    vs2 = inLines.readLine();
    System.out.println(vs2);
    case 12: {
    vqty2 = inLines.readLine();
    System.out.println(vqty2);
    case 13: {
    vm3 = inLines.readLine();
    System.out.println(vm3);
         case 14: {
    vs3 = inLines.readLine();
    System.out.println(vs3);
    case 15: {
    vqty3 = inLines.readLine();
    System.out.println(vqty3);
    case 16: {
    vm4 = inLines.readLine();
    System.out.println(vm4);
    case 17: {
    vs4 = inLines.readLine();
    System.out.println(vs4);
    case 18: {
    vqty4 = inLines.readLine();
    System.out.println(vqty4);
    f1.close();
    FileWriter f2=new FileWriter("c:/testout.txt");
    String t;
    t=ServerIntf.add(vcno,vpin,vamt,vordid,vptype,vreq,vorgid,vm1,vs1,vqty1,vm2,vs2, vqty2,vm3,vs3,vqty3,vm4,vs4,vqty4);
    String str1 = " >>";
    str1 = t + str1;
    f2.write(str1);
    System.out.println('\n'+"c:/testout.txt File updated");
    f2.close();
    catch(Exception e)
    System.out.println("Error " +e);

    Yes, ServerIntf is the interface type. The instance serverIntf. You declared it somewhere at the top of the routine.
    So what you must do is call t=serverIntf.add(...)This is probably just a mistype.

  • STATIC REFERENCE

    THE CODE IS ATTACHED. I NEED TO SOLVE THE ERROS.
    THIS IS THE ERRORS AFTER COMPILE
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:47: Can't make static reference to method void setLayout(java.awt.LayoutManager) in class java.awt.Container.
                        setLayout(new FlowLayout());
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:48: Can't make static reference to method void setBackground(java.awt.Color) in class java.awt.Component.
                        setBackground(Color.green);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:53: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                        add(l);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:58: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                        add(name);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:61: Can't make a static reference to nonstatic variable tf_name in class PwdClient.
                        tf_name = new TextField(20);
                        ^
    5 errors
    //HERE IS THE CODE
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    class PwdClient extends Frame
         private TextField tf_name;
         private TextField tf_password;
         private String input_str_name;
         private String input_str_password;
         private String str_to_pass;
         //private String str;
         //private String str_name;
         //private String str_password;
         //private Button button1;
         private final static int buffsize = 512;
         public static void main(String args[])
              try
                        String server = args[0];
                        int port = Integer.parseInt(args[1]);
                        //create socket
                        Socket s = new Socket(server, port);
                        //readresult from server
                        InputStream is = s.getInputStream();
                        DataInputStream dis = new DataInputStream(is);
                        OutputStream os = s.getOutputStream();
                        DataOutputStream dos = new DataOutputStream(os);
                        InputStreamReader isr = new InputStreamReader(System.in);
                        BufferedReader br = new BufferedReader(isr);
                        //Frame frm = new Frame( "Client Server" );
                        setLayout(new FlowLayout());
                        setBackground(Color.green);
                        String str = "Enter Name and Password:";
                        Label l= new Label( str, Label.CENTER);
                        l.setBackground(Color.red);
                        add(l);
                        String str_name = "Name:";
                        Label name = new Label( str_name, Label.CENTER);
                        name.setBackground(Color.red);
                        add(name);
                        //Name textfield User input for name
                        tf_name = new TextField(20);
                        add(tf_name);
                        String str_password = "Password:";
                        Label password = new Label( str_password, Label.CENTER);
                        password.setBackground(Color.red);
                        add(password);
                        //Password Textfield (user input for password)
                        tf_password = new TextField(20);
                        tf_password.setEchoChar('*');
                        add(tf_password);
                        Button Button1 = new Button("Submit");
                        add(Button1);
                        Button1.addActionListener( new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  input_str_name = tf_name.getText();
                                  tf_name.setText(new String(""));
                                  input_str_password = tf_password.getText();
                                  tf_password.setText(new String(""));
                                  str_to_pass = input_str_name+"/"+input_str_password;
                                  dos.writeBytes(str_to_pass);
                                  String received_from_server = brr.readLine();
                                  l.setText(received_from_server, Label.CENTER);
                        frm.setSize( 300, 200 );
                        frm.show();
                        frm.addWindowListener( new WindowAdapter()
                             public void windowClosing(WindowEvent e)
                             { System.exit(0);}
              }//closes the try
              catch(Exception e){}

    Put the code you have in static main in a constructor, or make an instance of PwdClient in main that you can call those methods on. You can't call non-static methods directly from a static method (main). You need to instantiate the class.
    public class PwdClient extends JFrame {
      public PwdClient() {
        // the code from your main method
      public static void main(String[] args) {
        new PwdClient(); // makes a new instance of PwdClient
    }

  • Thousands of reference errors in TCMRuntimeManager.as

    I'm working on a fairly large AIR app and in the process of trying to find the cause of an out of memory error, I see that the class TCMRuntimeManager.as is throwing thousands of reference errors...just letting my app sit for 10 minutes had over 350,000 reference errors.  The function checkTLFFontsLoaded is the culprit.  I'm not sure if the reference errors are directly related to the out of memory error, but I did notice that as I interact with the app not all the reference errors are getting garbage collected.  If I stop interacting with the app and force garbage collection a few times they all get cleared, but I think that under normal use the garbage collector is getting overwhelmed and doesn't clear out everything, and thus eventually these errors start piling up and contribute to the out of memory error.
    The way the project is built is Flash CS 5.5 is used to import psd files, I set up some linkage classes, then export as a swc.  The psd text fields are imported as TLFTextFields.  The swc assets are then used in a FDT project compiled with Flex SDK 4.5.1 with AIR SDK 3.1.  There are 5 products, each with its own swf.  The swfs are compiled as Flash browser swfs and they are debugged/profiled using the standalone Flash player.  When I profile the individual swfs there are no reference errors.  If I profile the main swf (using adl) without loading the individual swfs, there are no reference errors. It's only when one or more of the product swfs are loaded into the main swf that reference errors start piling up. I've tried conerting the static text fields into bitmaps and registering the fonts (all from the same swc) in each swf and it hasn't made the problem go away but the memory spikes are no longer so dramatic. Any ideas on what is the root cause of this error?

    fl.text.TCMRuntimeManager was implemented by Flash pro. Please forward the question to http://forums.adobe.com/community/flash. Thanks!

  • Create static references array

    Hello,
    i have done a labview program which controls six different test machines.
    the different tests are VIs which are kept by the main program in an array of static references. this way i have to write the vi only once. afterwards i create six different references of the same vi, each of them managing one test machine.
    everything is working fine. the only drawback I have found, is how to create the six references of each VI.
    the first thing I tried, was to locate the static reference function inside a loop. I enabled indexing, and i expected to obtain an array of six different references of the same vi. unfortunately this is not working: i obtain an array with six times the same reference.
    to fix this, i located the static reference function inside a switch with six cases. all of this, inside the same loop. i have to use the static reference function six times, one for each test machine. this is working, but is more work. everytime a add a new test vi, I have to add the switch with the six cases. it is a lot of copy & paste work, and errors are likely to be done doing this.
    I would like to know if there is any other (and simpler) way of obtaining this array.
    enclosed you find an example showing this: the upper loop creates an array of six references but all of them are the same. the other one, uses a switch-case so that different references are generated.
    thank you in advance
    Attachments:
    static references array.zip ‏11 KB

    I think you missed the point of what I was getting at. If you create a template VI and programmatically open a reference to it 6 times you will get references to 6 independent instances of the template all running in memory. Nothing needs to get saved to disk. If the template changes simply close the 6 old references and open 6 new ones.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How do I make a static reference to a method?  Sample Code Included

    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{
        static String sString = "TESTING";
        int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;  
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );
    }

    Why doesn't this work?Because you can't call a non-static method like add (which operates on the object called this) from a static method like main (for which there is no this).
    There are two ways to fix this:
    (1) In main, create a TestClass object, and call add() for that object:
    class TestClass implements TestInterface {
       public int add(int a, int b) {
          return a+b;
       public static void main(String[] args) {
          TestClass testObject = new TestClass();
          int sum = testObject.add(3, 4);
          System.out.println("test");
          System.out.println(sum);
    }(2) Make add() static. This is the preferred approach, because add() doesn't really need a TestClass object.
    class TestClass implements TestInterface {
       public static int add(int a, int b) {
          return a+b;
       // main is same as the original
    }

  • I get a "JavaScript Application - Reference Error: XPCSafeJSObjectWrapper is not defined" error every time I try to open a new tab.

    <blockquote>Locking duplicate thread.<br>
    Please continue here: [/questions/777191]</blockquote><br>
    Just like the title says, starting with Firefox 4 Beta 6 or 7, I forgot. Any time I try to open a new blank tab (sometimes even when I start up Firefox and the app tabs load) I get an error that says "JavaScript Application - Reference Error: XPCSafeJSObjectWrapper is not defined" If I close it everything works as normal again (until I open a new tab) but it is very annoying to have to do this. Is there any fix for this or is the bug just still there?

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]

  • Non static variable error

    There may be more errors in here besides the static variable error. I made the methods static for the method call in my constructor Product(name, price). The purpose of this Class is to the the name and price of a product from user input, subtract 5.00 from the price, and return the new price. Please help!!!
    public class Product
    public Product(String name, double price)
    String product;
    price = Product.getPrice(price);
    Double.toString(price);
    //this.product = product;
    product = Product.getName(name) + Product.getPrice(price);
    public static String getName(String name)
    System.out.println("What is their name?: ");
    name = in.nextLine(); // I GET A NONSTATIC VARIABLE ERROR FOR variable "in" HERE.
    return name;
    public static double getPrice(double price)
    this.price = price;
    System.out.println("What is the price?: ");
    price = in.nextDouble();
    return price;
    public double reducePrice()
    price = price - 5.00;
    return price;
    public String getProduct()
    product = new Product(name, price);
    return product;
    Scanner in = new Scanner(System.in);
    public static String name;
    //public double price;
    }

    you not define the class member properly.
    the class member is define before the constructor as
    public class Product {
         static Scanner in = new Scanner(System.in);
         String product;
         double price;
         public static String name;
         public Product(String name, double price) {
              price = Product.getPrice(price);
              Double.toString(price);
              // this.product = product;
              product = Product.getName(name) + Product.getPrice(price);
    }

  • StartTransmit / stopTransmit reference error on NetStream when connecting to device

    Hi all,
    I'm trying to create a P2P connection between a mobile device (Android) and a PC using the NetStream class.
    When the connection is established, the Flash Player Instance on the PC is crashing with a reference error:
    “Property startTransmit not found on flash.net.NetStream”
    I have seen the thread located located here: http://stackoverflow.com/questions/9676496/adobe-cirrus-error-on-direct-connectproperty-st arttransmit-not-found-on-flash-n
    but was not successfull in making it work with my code.
    I have tried extending the NetStream class like so:
    import com.frimastudio.cosy.util.NetConsole;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    public class NetStreamProvider extends NetStream
      public function NetStreamProvider (connection:NetConnection, peerID:String)
       super(connection, peerID);
      // For AIR Android projects: when the device is put to sleep for a moment, this function will be
      // called so we need to implement it to prevent flash from crashing.
      public function startTransmit($p1:*, $p2:*):void
       COSY::console { NetConsole.WarningInternal("NetInterfaceSlot", "startTransmit", "startTransmit called"); }
      public function stopTransmit():void
       COSY::console { NetConsole.WarningInternal("NetInterfaceSlot", "stopTransmit", "stopTransmit called"); }
    and using the NetStreamProvider instead. Without success.
    Any help would be greatly appreciated.
    Thanks.
    Guillaume

    >> i suspect this is AIR-specific (probably if AIR is the sender) -- in my experience it doesn't happen with plain Flash Player.
    [Guillaume] -> Right, it does not happen on NetStreams between 2 Flash Players and 2 AIR app. Only between AIR-FlashPlayer NetStreams. Basically, after a stream is opened between AIR and Flash Player, the AIR is calling "starTransmit" on the FlashPlayer NetStream, wich is not implemented.
    >> try making an object with those method names and assign it to netStream.client
    [Guillaume] -> I tried the following:
    Implement starTransmit/stopTransmit functions in the NetStream.client object
    Implement startTransmit/stopTransmit functions in the NetStream instance (subclassed)
    Without success. Basically, it works fine if I just create a "dummy" client object for the NetStream that has those 2 functions. But If I want to use my own client it was still crashing.
    I found a work around for my problem.
    My NetStream object is sub classed as such:
    public class NetStreamProvider extends NetStream
      public var customClient:Object;
      public function NetStreamProvider (connection:NetConnection, peerID:String)
       super(connection, peerID);
       customClient = new Object();
       this.client = customClient;
       // Implement startTransmit and stopTransmit here for dummy client
       customClient.onPeerConnect = function(subscriber:NetStream): Boolean{
        var subClient:Object=new Object();
        subClient.stopTransmit=function($p1:*,$p2:*):void{
         trace("Cosy: stopTransmit called",$p1,$p2);
        subClient.startTransmit=function():void{
         trace("Cosy: startTransmit called");
        subscriber.client = subClient;
        return true;
      public function SetClient(c:Object):void
       this.client = c;
      public function OnNetStreamAsyncError(event:AsyncErrorEvent):void
    And in the stream status event handler, when the stream is ready (events "NetStream.Play.PublishNotify" and "NetStream.Play.Start") I set the correct client, which has the receive handler. At that point startTransmit was already called:
    And in the stream status event handler, when the stream is ready (events "NetStream.Play.PublishNotify" and "NetStream.Play.Start") I set the correct client, which has the receive handler. At that point startTransmit was already called:
    private function OnNetStreamStatus(e:NetStatusEvent)
    switch(e.info.code)
      case "NetStream.Play.PublishNotify":
               stream = e.target as NetStreamProvider;
               stream.SetupClient(client);
      break;
      case "NetStream.Play.Start":
               stream = e.target as NetStreamProvider;
               stream.SetupClient(client);
      break;
    At this point, i'm not blocked anymore. However, it would be good to know why, when and who are calling those functions to understand the issue. this is not documented anywhere, and might be an issue to a lot of people now that we are starting to see more and more cross-platform connectivity.
    Cheers.
    Guillaume

  • Implementing Custom Event - non-static referencing in static context error

    Hi,
    I'm implementing a custom event, and I have problems adding my custom listeners to objects. I can't compile because I'm referencing a non-static method (my custom addListener method ) from a static context (a JFrame which contains static main).
    However, the same error occurs even if I try to add the custom listener to another class without the main function.
    Q1. Is the way I'm adding the listener wrong? Is there a way to resolve the non-static referencing error?
    Q2. From the examples online, I don't see people adding the Class name in front of addListener.
    Refering to the code below, if I remove "Data." in front of addDataUpdatelistener, I get the error:
    cannot resolve symbol method addDataUpdateListener (<anonymous DataUpdateListener>)
    I'm wondering if this is where the error is coming from.
    Below is a simplified version of my code. Thanks in advance!
    Cindy
    //dividers indicate contents are in separate source files
    //DataUpdateEvent Class
    public class DataUpdateEvent extends java.util.EventObject
         public DataUpdateEvent(Object eventSource)
              super(eventSource);
    //DataUpdateListener Interface
    public interface DataUpdateListener extends java.util.EventListener
      public void dataUpdateOccured(DataUpdateEvent event);
    //Data Class: contains data which is updated periodically. Needs to notify Display frame.
    class Data
    //do something to data
    //fire an event to notify listeners data has changed
    fireEvent(new DataUpdateEvent(this));
      private void fireEvent(DataUpdateEvent event)
           // Make a copy of the list and use this list to fire events.
           // This way listeners can be added and removed to and from
           // the original list in response to this event.
           Vector list;
           synchronized(this)
                list = (Vector)listeners.clone();
           for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
               DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
               // Make a call to the method implemented by the listeners
                  // and defined in the listener interface object.
                  listener.dataUpdateOccured(event);
               System.out.println("event fired");
    public synchronized void addDataUpdateListener(DataUpdateListener listener)
         listeners.addElement(listener);
      public synchronized void removeDataUpdateListener(DataUpdateListener listener)
         listeners.removeElement(listener);
    //Display Class: creates a JFrame to display data
    public class Display extends javax.swing.JFrame
         public static void main(String args[])
              //display frame
              new Display().show();
         public Display()
         //ERROR OCCURS HERE:
         // Non-static method addDataUpdateListener (DataUpdateListener) cannot be referenced from a static context
         Data.addDataUpdateListener(new DataUpdateListener()
             public void dataUpdateOccured(DataUpdateEvent e)
                 System.out.println("Event Received!");
    //-----------------------------------------------------------

    Calling
        Data.someMethodName()is referencing a method in the Data class whose signature includes the 'static' modifier and
    might look something like this:
    class Data
        static void someMethodName() {}What you want is to add the listener to an instance of the Data class. It's just like adding
    an ActionListener to a JButton:
        JButton.addActionListener(new ActionListener()    // won't work
        JButton button = new JButton("button");           // instance of JButton
        button.addActionListener(new ActionListener()     // okay
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.*;
    public class EventTest extends JFrame
        Data data;
        JLabel label;
        public EventTest()
            label = getLabel();
            data = new Data();
            // add listener to instance ('data') of Data
            data.addDataUpdateListener(new DataUpdateListener()
                public void dataUpdateOccured(DataUpdateEvent e)
                    System.out.println("Event Received!");
                    label.setText("count = " + e.getValue());
            getContentPane().add(label, "South");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(300,200);
            setLocation(200,200);
            setVisible(true);
        private JLabel getLabel()
            label = new JLabel("  ", JLabel.CENTER);
            Dimension d = label.getPreferredSize();
            d.height = 25;
            label.setPreferredSize(d);
            return label;
        public static void main(String[] args)
            new EventTest();
    * DataUpdateEvent Class
    class DataUpdateEvent extends java.util.EventObject
        int value;
        public DataUpdateEvent(Object eventSource, int value)
            super(eventSource);
            this.value = value;
        public int getValue()
            return value;
    * DataUpdateListener Interface
    interface DataUpdateListener extends java.util.EventListener
        public void dataUpdateOccured(DataUpdateEvent event);
    * Data Class: contains data which is updated periodically.
    * Needs to notify Display frame.
    class Data
        Vector listeners;
        int count;
        public Data()
            listeners = new Vector();
            count = 0;
            new Thread(runner).start();
        private void increaseCount()
            count++;
            fireEvent(new DataUpdateEvent(this, count));
        private void fireEvent(DataUpdateEvent event)
            // Make a copy of the list and use this list to fire events.
            // This way listeners can be added and removed to and from
            // the original list in response to this event.
            Vector list;
            synchronized(this)
                list = (Vector)listeners.clone();
            for (int i=0; i < list.size(); i++)
                // Get the next listener and cast the object to right listener type.
                DataUpdateListener listener = (DataUpdateListener) list.elementAt(i);
                // Make a call to the method implemented by the listeners
                // and defined in the listener interface object.
                listener.dataUpdateOccured(event);
            System.out.println("event fired");
        public synchronized void addDataUpdateListener(DataUpdateListener listener)
            listeners.addElement(listener);
        public synchronized void removeDataUpdateListener(DataUpdateListener listener)
            listeners.removeElement(listener);
        private Runnable runner = new Runnable()
            public void run()
                boolean runit = true;
                while(runit)
                    increaseCount();
                    try
                        Thread.sleep(1000);
                    catch(InterruptedException ie)
                        System.err.println("interrupt: " + ie.getMessage());
                    if(count > 100)
                        runit = false;
    }

Maybe you are looking for

  • How do I resize a photo in iphoto and keep it in iphoto library

    So in windows I can resize a photo and leave it where it is.  Why can't I do this in iphoto?

  • How to get result from another JSP file?

    I have to write a jsp (my.jsp) to get information from another jsp file (other.jsp). The other.jsp return integer value (0 / 1) so that user can tell if certain service is available or not. And in my.jsp I need to collect such result and other inform

  • XI 3.0 SAMPLE Interactive Editor Integration Java Sample

    Hi I am trying to run XI 3.0 sampe for Interactive Editor Integration provided at resdk_java_ieditIntegr_sample.zip. When I try to login I am getting the following error: org.apache.jasper.JasperException: /viewers/cdz_adv/wistartpage.jsp(16,0) The v

  • IS IT POSSIBLE TO INSERT A PICTURE ON THE LEOPARD WALLPAPER

    I like the standard wallpaper that appeared after i installed leopard. I would love to have some personal photos, even just one, appear in a small box, maybe 2.5x3 inch, or other size. I just dont like when the entire desktop is occupied by personal

  • Hot backup cloning in ebs r12

    HI i was doing the hot backup cloning in ebsr12. i have backed up the control files and datafiles and the trace file also. i have done the steps till copying the db and apps tier. next is 2) Create the target database control file manually Open the b