New operator in static context - how to make it work

pdftest.java:57: non-static variable this cannot be referenced from a static context
PageNumberer pn = new PageNumberer();
Is it basically that I can't use the new operator in my main function because main functions have to be static in java? What's the deal here?
I had this app working as a Java SERVLET, so all i had to do to port it over was replace the doGet method with main and remove all references to servlet specific stuff, etc. Had to make all my methods static too so main could call them, but that's all fixed. And now the thing that makes it not compile is the new operator!?!?
public class pdftest
     ....//private static members
          /* subClass to handle page numbering of pdf */
          class PageNumberer extends PdfPageEventHelper
     public static void main(String[] args)
          PageNumberer pn = new PageNumberer();
     ....//other methods, had to make them all static which was annoying
}

pdftest.java:57: non-static variable this cannot be
referenced from a static context
PageNumberer pn = new
PageNumberer();
Is it basically that I can't use the new operator in
my main function because main functions have to be
static in java? What's the deal here?
I had this app working as a Java SERVLET, so all i
had to do to port it over was replace the doGet
method with main and remove all references to servlet
specific stuff, etc. Had to make all my methods
static too so main could call them, but that's all
fixed. And now the thing that makes it not compile is
the new operator!?!?
public class pdftest
     ....//private static members
          /* subClass to handle page numbering of pdf */
          class PageNumberer extends PdfPageEventHelper
     public static void main(String[] args)
          PageNumberer pn = new PageNumberer();
....//other methods, had to make them all static
c which was annoying
static class PageNumberer

Similar Messages

  • How to make buttons work in Interactive Adobe Forms

    Hi Experts,
    I am new to interactive form. Though i have worked in normal/non-Interactive form, i do not know how to make buttons work in interactive adobe forms using ABAP  (I don't know JAVA). Can any one help me out and walk me through to how to code in ABAP to make buttons work.
    Kind Regards,
    Sharat.

    Please refer to my earlier post ... You will get an idea
    Please refer to the below thread for detail solution
    Sample Interactive form example ?....urgent...
    Cheers
    Satya

  • When i charge my ipod it works but as soon as i take it out the charger it doesnt work any suggestion on how to make it work?

    When i charge my ipod it workd but as soon as i take it out the charger it doesnt work any suggestion on how to make it work?

    It may need a new battery, take it to an Apple Store and check.

  • RdbmsRealm - how to make it work

    I was running the example server. I would like to see if I can delegate the security to an rdbmsRealm. I followed the instruction from the documentation. I created the three tables for security in Oracle 8i Lite in my NT machine. I then startup the example server and created a security realm for my oracle 8i tables. I then selected the cacing realm and selected my oralce 8i Lite realm. However, this does not change the security because the new users that I created are still updated in the filerealm.properties file.
    My understanding is that we should be able to use the oracle realm I just created for the wls realm. As for the caching realm, I thought it's there for performance reasons.
    Could somebody tell me how to make it work? Thanks.

    Hi Susan:
    I followed you instruction and modified the config.xml file to use the rdbmsRealm in that I set up in Oracle 8i Lite. I am using the Oracle 8i Lite driver to talk to the database. I then tried to create new users. From the console, it appears that the users are added successfully. However, the new users do not exit in the oracle 8i lite rdbmsRealm. They do not exist in the filerealm.properties file neither.
    I then tried to use the cloudscape rdbmsRealm. This is achived by the following configuration in the config.xml file:
    <CachingRealm BasicRealm="defaultRDBMSRealmForCloudscape" Name="defaultCachingRealm"/>
    However, the realm initialization failed. Then I checked the definition for the cloudscape rdbmsRealm in the config file and found out that the schemaproperties entried are all chopped off. This is because of the bug you told me earlier.
    I would like to get the cloudscape rdbmsRealm working first and then try to find out why the oracle 8i Lite rdbmsRealm did not work. Could you please send me the schemaproperties entries needed for the cloudscape rdbmsRealm? Thanks.
    Helen
    "Suresh Vallabhaneni" <[email protected]> wrote:
    >
    Hi Helen
    Here is a sample of what you need in the config.xml. Modify to match your environment.
    <Security
    Realm="defaultRealm"
    />
    <Realm
    Name="defaultRealm"
    FileRealm="defaultFileRealm"
    CachingRealm="defaultCachingRealm"
    />
    <CachingRealm
    Name="defaultCachingRealm"
    BasicRealm="defaultRDBMSRealmForOracle"
    />
    SUBSTITUTE THE REQUIRED VALUES FOR THE RDBMS REALM
    <RDBMSRealm
    Name="defaultRDBMSRealmForOracle"
    RealmClassName="examples.security.rdbmsrealm.RDBMSRealm"
    DatabaseDriver="weblogic.jdbc.oci.Driver"
    DatabaseURL="jdbc:weblogic:oracle:yourdatabase"
    DatabaseUserName=""
    DatabasePassword=""
    SchemaProperties=""
    />
    Let me know if you still have a problem.
    thanks
    "Helen Semus" <[email protected]> wrote:
    Hi Suresh:
    Yes, I was selecting the default cacherealm from the console.
    I checked my config.xml for the exampe server. You are right. The schemaProperties attribute values are truncated. I guess I will have to manually modify my config.xml file to get it to work.
    Besides making sure the attributes for the rdbmsRealm element correct, is there anyother element or attribute that I need to set to enable the rdbmsRealm?
    Thanks.
    Helen
    "Suresh Vallabhaneni" <[email protected]> wrote:
    Hi Helen
    Are you trying to select the caching realm through console? There is a release note on this(http://www.weblogic.com/docs60/notes/issues.html#1029973) that selecting the caching realm through console will corrupt the config file. If you're doing otherwise, plz let me know.
    thanks
    "Helen Semus" <[email protected]> wrote:
    I was running the example server. I would like to see if I can delegate the security to an rdbmsRealm. I followed the instruction from the documentation. I created the three tables for security in Oracle 8i Lite in my NT machine. I then startup the example server and created a security realm for my oracle 8i tables. I then selected the cacing realm and selected my oralce 8i Lite realm. However, this does not change the security because the new users that I created are still updated in the filerealm.properties
    file.
    My
    understanding
    is
    that we should be able to use the oracle realm I just created for the wls realm. As for the caching realm, I thought it's there for performance reasons.
    Could somebody tell me how to make it work? Thanks.

  • DVR with fms3 , how to make it work?

    Hi
    I am trying to look for documentation on how the DVR functionality is working in fms3. It seems that I need to implement som server-side scripting to make DVR even work. In Flash Live Encoder there is an option to Record DVR, but it when I press the button, all I get is:
    Thu Apr 30 2009 13:15:38 : Start DVR command received
    Thu Apr 30 2009 13:15:38 : Requested DVR command has been successfully issued to Primary FMS server for stream ob1stream
    Thu Apr 30 2009 13:15:38 : Primary - Network Status: NetConnection.Call.Failed error Method not found (DVRSetStreamInfo).
    Does anyone know how to make this work?
    Best Regards Niclas

    ok i'm back for a second......so uhhh....class is in session here is a basic example of a video encoder
    use this to stream your video while recording.....what makes it record?and not live? this line here:
      ns.publish("thefilename", "record");
    the second parameter.....to make it stream live without recording it to file you change it to "live"....the first parameter is what you name your file...
    after this you use your client player to connect to the same connection as outlined.....and to play the same file ..ie   stream.play("thefilename");
    package
        import flash.display.*;
        import flash.media.*;
        import flash.net.*;
        import flash.events.*;
        public class SimpleEncoder extends Sprite
            var nc:NetConnection;
            var ns:NetStream;
            var mic:Microphone;
            var video:Video = new Video();
            var camera:Camera;
            public function SimpleEncoder():void
                NetConnection.defaultObjectEncoding = 0;
                nc = new NetConnection;
                nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                nc.connect("rtmp://localhost/video/myvids");
            private function publishLiveStream():void
                ns = new NetStream(nc);
                ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                ns.client = this;
                camera = Camera.getCamera();
                mic = Microphone.getMicrophone();
                if (camera != null){
                    camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                    video = new Video();
                    video.attachCamera(camera);
                    ns.attachCamera(camera);
                if (mic != null) {
                    mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                    ns.attachAudio(mic);
                if (camera != null || mic != null)
                // start publishing
                // triggers NetStream.Publish.Start
                // "thefilename" is the name of the file you use after you connect to stream in client player   stream.play("thefilename");
                ns.publish("thefilename", "record");
                else
                    trace("Please check your camera and microphone");
                addChild(video);
            public function onBWDone():void
            private function netStatusHandler(event:NetStatusEvent):void
                trace(event.info.code);
                switch (event.info.code)
                    case "NetStream.Buffer.Full":
                        break;
                    case "NetStream.Buffer.Empty":
                        break;
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected");
                        publishLiveStream();
                        break;
                    case "NetConnection.Connect.Failed":
                    case "NetConnection.Connect.Rejected":
                       // trace ("Oops! the connection was rejected");
                        break;
                    case "NetStream.Play.Stop":
                        break;
                    case "NetStream.Play.StreamNotFound":
                        trace("The server could not find the stream you specified");
                        break;
                    case "NetStream.Publish.BadName":
                        break;
                    case "NetStream.Publish.Start":
            private function statusHandler(event:StatusEvent):void {
                trace("statusHandler: " + event);
                trace(mic.activityLevel);
            private function activityHandler(event:ActivityEvent):void
                //trace(mic.activityLevel);
            public function onFault(e:Object)
                //trace(e.info);
                //nc.close();
        }//end class
    }//end package
    thelegendaryghost

  • Macbook pro to HDTV, video is working but audio is not working, how to make audio work as well

    Macbook pro to HDTV, video is working but audio is not working, how to make audio work as well

    If you use an HDMI cable, the audiostream will be integrated, so there will be sound when using an HDMI cable!
    Not necessarily.  That only works as stated if you have one of the most recent MBP's that has a built-in HDMI port.
    If the MBP only has a Thunderbolt or miniDisplayPort, you need an appropriate adapter cable and even if you use an HDMI adapter or cable to connect to your HDTV there is no guarantee it will carry audio.  You have to determine if your specific MBP model supports audio out through its miniDisplayPort or Thunderbolt output, and whether the adapter does likewise.

  • TS2634 I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?

    I have the same problem.
    Two similar discussions:
    https://discussions.apple.com/message/23081658#23081658
    https://discussions.apple.com/message/23281391#23281391
    I have not yet seen any official response to the question: "Is the Apple AV Composite cable fully supported with 30pin connector devices upgraded with iOS7 - specifically ? - eg. iPad 2, iPhone 4, iPhone 4s"
    If it is not currently supported is that then due to a bug / oversight and in that case is it something that will be fixed in the near future?
    Please let us know what feedback you got from asking Apple support.

  • Deleted itouch files using ifile from cydia. i restarted it but now it shows the apple logo and that is it... it doesnt respond. any ideas of how to make it work?

    I restarted my itouch using the home button and top button...it restarted but it only shows the apple logo and that is it.  I deleted all files from ifile and then it froze... any ideas of how to make it work again?

    Discussions of hacked ipods is not permitted here.

  • I have unlocked iphone 5.i tried to use it with tmobile.it shows full network but fails to activate and shows sim invalid.how to make it work?

    i have unlocked iphone 5.i tried to use it with tmobile.it shows full network but fails to activate and shows sim invalid.how to make it work?

    Who was your original carrier; did you call them to ask them to unlock your phone, and are you aware of what their unlock policy is (THey may only unlock for international sims and not US sims

  • HT201343 My mac is OS X 10.6. has not airplay. how to make it work?

    My mac is OS X 10.6. has not airplay. How to make it work?

    OS 10.6 is Snow Leopard, which does not support Air Play.  If you upgrade to OS 10.7 Mountain Lion (which is what you list in your category) then you may be able to use Air Play depending on the age of your computer. 
    See this document:
    http://support.apple.com/kb/HT5404

  • Today my money is deducted Rs.60 when I try to download paid applications of any amount and I am getting message transaction declined, so why my money is deducted. I lost almost Rs 480 rupees . So how to get refund and how to make card working?

    Today my money is deducted Rs.60 when I try to download paid applications of any amount and I am getting message transaction declined, so why my money is deducted. I lost almost Rs 480 rupees . So how to get refund and how to make card working?

    Today my money is deducted Rs.60 when I try to download paid applications of any amount and I am getting message transaction declined, so why my money is deducted. I lost almost Rs 480 rupees . So how to get refund and how to make card working?

  • How to make tablesorter work for GroupedColumns??

    Hi all,
    I imported the class of TableSorter.java to my project. It automatically picks up my normal columns, they all can be sorted.
    but the groupedColumns generated by the drag and drop table node into the design area wont pick up, even i set the property of "onAction" of the column to "Sort"(method) it wont sort the content for me.
    how to make it work?
    thanks

    hi!
    you can get lead selection in the action handler then inset your code for currentContextElement.
    wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.nodeXXX());
    thanks
    vishal

  • How to make rss work

    So, I'd like to get RSS working on my iMac. When I click on an RSS logo/button, I get the message "No associated application could be found." HUH??? Any idea on how to make RSS work??? In either Safari or Mail.

    RSS has been removed from Mail and Safari in Mountain Lion, so you will need to use a thrd party application such as Vienna.

  • How to make MDM work?

    Hi Guy,
    I'm newbie for MDM.I already intalled it on my machine(Window Xp)but dunno how to make it work.
    The installed components are MDM/Syndicator/Import server,Console/Import mgr/Data mgr/Syndicator.
    Do I have to install any component else?And Can you guy give me any guides/documents/Posts how to make it work.Cause I have to demo it next week but right now still blank about it...
    Thanks
    Parinya.

    Hi Jack,
    For Demo Purpose,
    1.Create few master records in R/3 Servers [ MM(Tcode MM01) /Employee(PA40) /Vendor(Xk01) /Customer(XD01) according to your MDM Repository(For Example "Products").]
    2.Extract those master datas from R/3 Servers.
    3. You will get the xml file of master datas.
    4.Open the import manager and import the xml file into  the MDM server.
    5.In Import manager ,you need to map the records[Source Fields(Imported records) VS Destination Fields(MDM repository)].
    6.Once you imported the record ,u can see the records in the MDM Data manager.
       We can Create/edit/Delete those records .
       We can merge the records for consolidation purpose.
       We can perform Data enrichments process   like Validation,Workflow,Assignments..etc.
    7.Once cleaned the Master records,it is ready to distribute to R/3 servers.
    8.Syndicator is used for sending data back to the R/3 servers
       Here also we have to do Mapping against R/3 servers.
       Using XI We can connect the R/3 Servers.
    Hope u will understand this.
    This is very simple example for MDC-MDH Scenario.
    For futher learning on how to create a repository/Enrich the mater datas, go through reference documents in the Service Market place.
    Best Regards
    Devaraj PK

  • How to make stylesheets work ???urgent

    Hi,
    How to make stylesheets work.I tried including the CSS file on the
    header
    <%@ include file="stylesheets.css" %>
    <%@ include file="stylesheets.inc" %>
    and both options does not work. can somebody tell me what is wrong here.
    Thanks
    jack

    Hi,
    below thing does not work ?? any idea ??
    <TITLE>IBMSWG - <%= childCategoryListBean.getCurrentCategory().getName() %></TITLE>
    <META NAME="Keywords" CONTENT=" passive, components">
    <META NAME="Description" CONTENT=" varistors">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="stylesheets.css" type="text/css">
    <script language="JavaScript">
    <!--
    function xxx
    Thanks
    jack

Maybe you are looking for

  • Authentication - multiple domains with multiple accounts

    Dear All, Consider an environment where a user, Joe Bloggs, has an account on two Windows domains:  DOMA and DOMB.  DOMA is a domain that all users in the organisation are members of.  DOMB is a domain used by a smaller subset of users.  The user's m

  • Model Physical Implementation ?

    Hi , I am using SQL DM 3.0.0.665. I need your thoughs on following. We have a logical model and physical model on SQL Developer. We need to push the same physical model into multiple schemas/instances. What is the best way to do that? Any idea? Thank

  • Hot to attach URL of attachment to a Purchase Order

    Hi, We have a requirement where the URLs of the scanned documents need to be associated with Purchase Orders Created in R3. We can do this using SAP GUI by accessing the PO. We want to do this via code. Is there any BAPI available for this? Or Someon

  • Stuff drawn on JPanel will display in Eclipse but not browser?

    Hi guys, I wrote a simple java applet and just put it up on my webpage. When I ran it in Eclipse, everything worked fine, but now in Firefox, I can see the two buttons it has, but there's a lot of stuff that was supposed to be drawn to some JPanels b

  • How do I compress my itunes MP3s to 192kb

    How do I compress my whole itunes library MP3s to 192kb? I want to make some space on my HD