Problems with "SecondMidletServlet.java"

Hi guys, I'm now trying to use MIDlet to connnect a servlet which will retrieve the data from MS Access database.
I had tried the sample programs(First & SecondMidletServlet) in this site. It's fine for me to run the "FirstMidletServlet.java"... but I need the more advance method - POST. When I run "SecondMidletServlet.java", the MIDlet program is stopped after I click the 'submit' button where the program asking me "Is it OK to use airtime?"... Even i choose 'Yes', it doesn't work..
Do anyone could help? Please kindly tell me what's the problem behind.... Thanks!!!

Yes, here it's:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
* An example MIDlet with simple "Hello" text and an Exit command.
* Refer to the startApp, pauseApp, and destroyApp
* methods so see how each handles the requested transition.
* @author  Ken_2
* @version
public class GetNpost extends MIDlet implements CommandListener {
    private Display display;    // The display for this MIDlet
    private Form fmMain;
    private Alert alError;
    private Command cmGET;
    private Command cmPOST;
    private Command cmExit;   // The exit command
    private TextField tfAcct;
    private TextField tfPwd;
    private StringItem siBalance;
    private String errorMsg = null;
    public GetNpost() {
        display = Display.getDisplay(this);
        //Create Command
        cmGET = new Command ("GET", Command.SCREEN, 2);
        cmPOST = new Command ("POST", Command.SCREEN, 3);
        cmExit = new Command("Exit", Command.SCREEN, 1);
        // Textfields
        tfAcct = new TextField("Account:",  "", 5,  TextField.NUMERIC);
        tfPwd = new TextField("Password:", "", 10,  TextField.ANY | TextField.PASSWORD);
        //Balance string item
        siBalance = new StringItem("Balance: $","");
        // Create Form, add commands & Components, listen for events
        fmMain = new Form("Account Information");
        fmMain.addCommand(cmExit);
        fmMain.addCommand(cmGET);
        fmMain.addCommand(cmPOST);
        fmMain.append(tfAcct);
        fmMain.append(tfPwd);
        fmMain.append(siBalance);
        fmMain.setCommandListener(this);
     * Start up the Hello MIDlet by creating the TextBox and associating
     * the exit command and listener.
    public void startApp() {  
        display.setCurrent(fmMain);
     * Pause is a no-op since there are no background activities or
     * record stores that need to be closed.
    public void pauseApp() {
     * Destroy must cleanup everything not handled by the garbage collector.
     * In this case there is nothing to cleanup.
    public void destroyApp(boolean unconditional) {
     * Respond to commands, including exit
     * On the exit command, cleanup and notify that the MIDlet has been destroyed.
    public void commandAction(Command c, Displayable s) {
        if (c == cmGET || c == cmPOST) {
            try
                if (c == cmGET)
                    lookupBalance_withGET();
                else
                    lookupBalance_withPOST();
            catch (Exception e)
                System.err.println("Msg: " + e.toString());
        else if (c == cmExit)
            destroyApp(false);
            notifyDestroyed();
     * Access servlet using GET
    private void lookupBalance_withGET() throws IOException
        HttpConnection http = null;
        InputStream iStrm = null;
        boolean ret = false;
        // Data is passed at the end of url for GET
        String url = "http://ismt.no-ip.com/servlet/DRMfypGroup2.GetNpostServlet" + "?" + "account=" + tfAcct.getString() + "&" + "password=" + tfPwd.getString();
        try
            http = (HttpConnection) Connector.open(url);
            // Client Request
            //  1) Send request method
            http.setRequestMethod(HttpConnection.GET);
            //  2) Send header information - none
            //  3) Send boday/data - data is at the end of URL
            //  Server Response
            iStrm = http.openInputStream();
            // Three steps are processed in this method call
            ret = processServerResponse( http, iStrm);
        finally
            // Clean up
            if (iStrm != null)
                iStrm.close();
            if (http != null)
                http.close();
        // Process request failed, show alert
        if (ret == false)
            showAlert(errorMsg);
     * Access servlet using POST
    private void lookupBalance_withPOST() throws IOException
        HttpConnection http = null;
        OutputStream oStrm = null;
        InputStream iStrm = null;
        boolean ret = false;
        // Data is passed at the end of url for GET
        String url = "http://ismt.no-ip.com/servlet/DRMfypGroup2.GetNpostServlet" + "?" + "account=" + tfAcct.getString() + "&" + "password=" + tfPwd.getString();
        try
            http = (HttpConnection) Connector.open(url);
            oStrm = http.openOutputStream();
            // Client Request
            //  1) Send request method
            http.setRequestMethod(HttpConnection.POST);
            //  2) Send header information. Required for POST to work!
            http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            // If you experience connectoin/IO problems, try removing the comment from the following line
            //http.serRequestProperty("Connection", "clsoe");
            //  3) Send boday/data
            // Write account number
            byte data[] = ("account=" + tfAcct.getString()).getBytes();
            oStrm.write(data);
            oStrm.flush();
            //  Server Response
            iStrm = http.openInputStream();
            // Three steps are processed in this method call
            ret = processServerResponse(http, iStrm);
        finally
            // Clean up
            if (iStrm != null)
                iStrm.close();
            if (http != null)
                http.close();
        // Process request failed, show alert
        if (ret == false)
            showAlert(errorMsg);
     * Process a response from a server
    private boolean processServerResponse(HttpConnection http, InputStream iStrm) throws IOException
        // Reset  error message
        errorMsg = null;
        //  1) Get Statis Line
        if (http.getResponseCode() == HttpConnection.HTTP_OK)
            //  2) Get header information - none
            //  3) Get body (data)
            int length = (int) http.getLength();
            String str;
           if (length != -1)
               byte servletData[] = new byte[length];
               iStrm.read(servletData);
               str = new String(servletData);
           else  // Length not available...
               ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
               int ch;
               while ( (ch =iStrm.read()) != -1)
                   bStrm.write(ch);
               str = new String (bStrm.toByteArray());
               bStrm.close();
            //Update the string item on the display
            siBalance.setText(str);
            return true;
        else
            // Use message from the servlet
            errorMsg = new String ( http.getResponseMessage() );
        return false;
     * Show an alert
    private void showAlert(String msg)
        // Create Alert, use message returned from servlet
        alError = new Alert("Error", msg, null, AlertType.ERROR);
        // Set Alert to type model
        alError.setTimeout(Alert.FOREVER);
        // Display the Alert. Once dismissed, display the form
        display.setCurrent( alError, fmMain);
}Thanks!!!

Similar Messages

  • Solution Manager systems RAM requirements - problems with the Java Engine

    Hello,
    I am about to install SAP Solution Manager 7 on a WIndows 2003 Server x64 but I need to know what the RAM requirements are? I have been having problems with the Java Engine starting and it seems to time out, I have heard that this is a very RAM hungry process and it might be why?
    Many thanks for your help in advance,
    Omar

    Hello Omar,
    To size SAP Solution Manager 7.0 EHP1 we recommend to use the SAP Solution Manager Quicksizer Tool at:
    http://service.sap.com/sizing-solman
    Here you find information on how to use the tool, how to collect input data for E2E Scenario Sizing, on SAP E2E RCA Sizing, Introscope Tuning, Wily Enterprise Manager Cluster Setup for E2E RCA Scenario and BI Aggregation Strategy in E2E Scenario.
    Please find more information about installing Solution Manager in:
    http://service.sap.com/instguides -> SAP Solution Manager
    I hope this information helps.
    Thanks,
    Mark

  • JCoIDoc IDocLibrary 3.0.2 Problems with IDocServerExample.java

    Hello, I´m facing a problem with IDocServerExample.java. I created a new project in eclipse, added the package com.sap.conn.idoc.examples and the class IDocServerExample.java. I configured the files "MYSERVER.jcoServer" and "BCE.jcoDestination" and started the application. Then I get the following error messages: *********************************************************************************************************************************************************
    com.sap.conn.jco.JCoException: (102) RFC_ERROR_COMMUNICATION: Unable to get repository at com.sap.conn.jco.rt.DefaultServer.update(DefaultServer.java:136) at com.sap.conn.jco.rt.DefaultServer.(DefaultServer.java:105) at com.sap.conn.idoc.jco.DefaultJCoIDocServer.(DefaultJCoIDocServer.java:35) at com.sap.conn.idoc.jco.DefaultJCoIDocServerFactory.createServer(DefaultJCoIDocServerFactory.java:17) at com.sap.conn.idoc.jco.DefaultJCoIDocServerFactory.createServer(DefaultJCoIDocServerFactory.java:13) at com.sap.conn.jco.rt.DefaultServerManager.getServer(DefaultServerManager.java:108) at com.sap.conn.jco.rt.StandaloneServerFactory.getServerInstance(StandaloneServerFactory.java:170) at com.sap.conn.idoc.jco.JCoIDoc.getServer(JCoIDoc.java:78) at com.sap.conn.idoc.examples.IDocServerExample.main(IDocServerExample.java:18) Caused by: com.sap.conn.jco.JCoException: (102) RFC_ERROR_COMMUNICATION: Connect to message server host failed Connection parameters: TYPE=B DEST=JCOSERVER01 MSHOST=arm115tx GROUP=PUBLIC R3NAME=T01 PCS=1 LOCATION CPIC (TCP/IP) on local host rz1462 with Unicode ERROR service '?' unknown TIME Tue Jul 07 09:09:40 200 RELEASE 711 COMPONENT NI (network interface) VERSION 39 RC -3 DETAIL NiErrSet COUNTER 2 at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:615) at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1280) at com.sap.conn.jco.rt.ClientConnection.connect(ClientConnection.java:661) at com.sap.conn.jco.rt.PoolingFactory.init(PoolingFactory.java:103) at com.sap.conn.jco.rt.ConnectionManager.createFactory(ConnectionManager.java:171) at com.sap.conn.jco.rt.DefaultConnectionManager.createFactory(DefaultConnectionManager.java:44) at com.sap.conn.jco.rt.ConnectionManager.getFactory(ConnectionManager.java:160) at com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:789) at com.sap.conn.jco.rt.RfcDestination.getSystemID(RfcDestination.java:817) at com.sap.conn.jco.rt.RepositoryManager.getRepository(RepositoryManager.java:32) at com.sap.conn.jco.rt.RfcDestination.getRepository(RfcDestination.java:891) at com.sap.conn.jco.rt.DefaultServer.update(DefaultServer.java:132) ... 8 more Caused by: RfcException: [null] message: Connect to message server host failed Connection parameters: TYPE=B DEST=JCOSERVER01 MSHOST=arm115tx GROUP=PUBLIC R3NAME=T01 PCS=1 LOCATION CPIC (TCP/IP) on local host rz1462 with Unicode ERROR service '?' unknown TIME Tue Jul 07 09:09:40 200 RELEASE 711 COMPONENT NI (network interface) VERSION 39 RC -3 DETAIL NiErrSet COUNTER 2 Return code: RFC_FAILURE(1) error group: 102 key: RFC_ERROR_COMMUNICATION at com.sap.conn.rfc.engine.RfcIoControl.error_end(RfcIoControl.java:255) at com.sap.conn.rfc.engine.RfcIoControl.ab_rfcopen(RfcIoControl.java:94) at com.sap.conn.rfc.api.RfcApi.RfcOpen(RfcApi.java:83) at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1273) ... 18 more
    Does anyone know what I´m doing wrong? With thanks, Veit

    Im having the same issue here.  Has anyone found a solution to this?

  • Performance problems with new Java Tiger style recommendations

    Performance problems with jdk 1.5 on Linux plattform
    (not tested on Windows, might be the same)
    using the new style recommendations.
    I need fast Vector loops for high speed mathematical calculations, some
    hints about the fastest way to program that loop would be also great!
    After refactoring using the new features from java 1.5 (as recommended from
    SUN) I lost performance significantly:
    using a vector:
    public Vector<unit> units;
    The new code (recommended from SUN for Java Tiger for redesign):
    for (unit u: units) u.accumulate();
    runs more than 30% slower than the old code:
    for (int i = 0; i < units.size(); i++) units.elementAt(i).accumulate();
    I expected the opposite.
    Is there any information available that helps?
    The following additional information I got from Mr. Shankar Unni:
    I got some fairly anomalous results comparing ArrayList and Vector: for the
    1.5-style loops, ArrayList was faster then Vector, but for a loop with get()
    calls, Vector was faster. Vector was even faster than that using
    elementAt(), which was a surprise:
    For a million summing iterations over a 100-element array:
    vector elementAt loop took 3446 ms.
    vector get loop took 3796 ms.
    vector iterator loop took 5469 ms.
    arraylist get loop took 4136 ms.
    arraylist iterator loop took 4668 ms.

    If your topic doesn't change, please stay in your original post.

  • Problems with a java bean in Weblogic 5.1

    Hello,
              I am having a problem deploying a java bean in Weblogic 5.1:
              I have been given a .class and a .jar file for a java bean (not an EJB). I
              placed the .class file into e:\temp\WEB-INF\classes and added the following
              line to my weblogic.properties file:
              weblogic.httpd.webApp.testApp=e:/temp/
              I have also updated the web.xml file in the WEB-INF directory as follows:
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
              Application 1.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <servlet>
              <servlet-name>EdIface</servlet-name>
              <jsp-file>test.jsp</jsp-file>
              </servlet>
              <servlet-mapping>
              <servlet-name>EdIface</servlet-name>
              <url-pattern>EdIface</url-pattern>
              </servlet-mapping>
              </web-app>
              When I try to access my http:\\server:port\testApp\test I get an "Error
              500 - internal server error".
              Has anyone had experice with deploying a java bean with jsut the .class and
              .jar file? Where should I put the .jar file?
              I appreciate any advice!
              

    Bump

  • A problem with my Java Scrabble game

    Hello
    I am making a Java Scrabble game for a school assignment and I have a problem with the following:
    The number of players is input by the user (2 to 4) and i need to create a number of arrays based on the number of players. These arrays must have 7 playing pieces at all times until the "bag" of pieces has less pieces than those required to replace the ones a certain player just used (in wich case the bag would give that player all of it's remaining pieces and, from this point on, the player arrays would not necessarily need to have 7 pieces).
    this is my procedure to take a piece from the bag:
         public Piece takePiece()
              if (this.pieceCounter > 0) {
                   Arrays.sort(this.pieces, 0, this.pieceCounter);
                   int i = this.generator.nextInt(this.pieceCounter);
                   Piece p = this.pieces;
                   this.pieceCounter--;
                   this.pieces[i] = this.pieces[this.pieceCounter];
                   return p;
              else
                   return null;
    this is my Piece class:
    public class Piece implements Comparable {
         private int scorePiece;
         private char letterPiece;
         public Piece(char letterPiece, int scorePiece)
              this.scorePiece = scorePiece;
              this.letterPiece = letterPiece;
         public int scorePiece()
              return scorePiece;
         public String letterPiece()
              return letterPiece();
         public String toString()
              return letterPiece+ " " + scorePiece;
         public int compareTo(Object a)
              Piece piece= (Piece) a;
              return (int) letterPiece - (int) piece.letterPiece;
    }Thanks in advance for your help

    Ok, if i create a Players class and do this in Main class:
         if(nPlayers >= 2 && nPlayers <= 4)
              Players arrayPlayers[];
              arrayPlayers= new Players [nPlayers ];
              for(int i=0 ; i < nPlayers ; i++)
                       arrayPlayers[i] = new Players ();
              }My Players Class should contain something like this:
             // Array of 7 that contains Pieces...
         Piece[] pieces= new Piece[7];how can i get pieces from takePiece(); (Class Bag) and put them in the pieces arrays until takePiece(); returns null?

  • Problems with VA Java Visual Composition

    Hi!
    I have some problems with reopening (even simple) visually in VA Java created
    beans (JFrame, JDialog). IDE behaves somehow unpredictable. Sometimes it reopened it into the
    visual composition editor, anothe time the reoppening fails with following log message:
    Java exception during layout of bean(<unnamed>): java.lang.NullPointerException
    Java exception during layout of bean(JFrameContentPane): java.lang.NullPointerException
    An exception occurred in a system program.
    Terminating TimeSlotGUI (VCE) (System) (25/07/01 10:05:07)
    Can anybody help?
    Ivan

    Which Version do you use? This VAJ 3.5 was quite bugy and you had to use patches. Now there is an Update 3.5.2 which fixes most of the bugs ( although there are new ones). When I work with the VCE ( avoid this normally) I get problems if I rename Beans which were generated with th VCE. then your stuff is lost. Sometimes you can recover if you delete the generated[i] initialize() method and then open the VCE.
    Nevertheless, VAJ 3.5.3 works quite good, great debugging tools.

  • HT5559 I  can't connecting  to chat  please can you help me,i think my problem with da java

    I  can't connecting  to chat  please can you help me,i think my problem with da java

    Have you read thread (From More like this on the right)
    https://discussions.apple.com/message/18837278#18837278

  • Problem with Sun Java Creator JDBC driver .....

    Hi:
    I am new to Java Studio Creator. I am using Oracle Enterprise Edition 8.0.5.0 database to get data from. Through Servers Navigator->Data Sources, I define a new datasource using default JSC JDBC driver for Oracle. However, when I try to test the connection I get the following error.
    [sunm][Oracle JDBC Driver] Internal Error: Net8 Protocol Error
    Can someone tell me what is going on here? By the way I also have Netbeans 4.0 IDE which works fine with the same database.
    -Victor bagga

    I was using the following database URL.
    jdbc:sun:oracle://autoserv.cqtel.com:1521;SID=autosvdb
    The SID is valid because I can use other JDBC drivers such as Oracle's thin driver which uses the Database URL
    jdbc:oracle:thin:@autoserv.cqtel.com:1521:autosvdb
    and it works. However, I can not use the Oracle thin JDBC driver with Sun Java Creator as it seems to be incompatible. Using this driver I can successfully define a datasource and veiw all the data and make all kind of queries through the Server Navigator window but when I try to drop a database table on to a Data Table in my project, nothing happens. If I try to Edit the query on the rowset, the GUI window does not show any Column names and display names.
    By the way, I also have an Oracle 9.x database which works just fine with Java Ctreator Studio. I really like Java Creator as I find it very productive but not being able to make it work with Oracle 8.0.5.0 takes the fun out of it.

  • Problem with Cut.java sample

    I am attempting to use code from the Cut.java sample to cut multiple
    regions from the same source audio file to separate destination files.
    I am calling the doIt() method from my coding, passing MediaLocators to
    the input and output files (both .wav) , and arrays with a single
    element (time in ns as a long) for the start and end, and false for
    frame mode. The first time I call it, it works fine. However, on
    subsequent calls, despite the output messages suggesting it has worked
    successfully, the output files are full of white noise. I have tried:
    using a new instance of Cut each time
    adding code to close the processor and disconnect the datasink
    disabling JMF buffering
    all to no effect. Any suggestions would be greatly appreciated.
    cheers
    Matthew Wilson.

    I have kind of the same problem too.
    I copy-paste the "cutting sections from an input" example from http://java.sun.com/products/java-media/jmf/2.1.1/solutions/Cut.java but can't get it to work.
    The error I'm getting back is:
    - Create processor for: file:/c:/song.mp3
    - Configure the processor for: file:/c:/song.mp3
      Transcode:
         from: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits
         to: LINEAR, 44100.0 Hz, 16-bit, Stereo, BigEndian, Signed
    - Realize the processor for: file:/c:/song.mp3
    Failed to build a graph for the given custom options.
    Failed to realize: com.sun.media.ProcessEngine@19360e2
      Cannot build a flow graph with the customized options:
        Unable to transcode format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits
          to: LINEAR, 44100.0 Hz, 16-bit, Stereo, BigEndian, Signed
          outputting to: RAW
    Error: Unable to realize com.sun.media.ProcessEngine@19360e2
    Failed to realize the processor.
    Failed to cut the inputsince I'm using eclipse as IDE, I made some "minor" changes on Cut.java to test it on eclipse
    public static void main(String [] args) {
        args = new String[7];
        args[0] = "-o";
        args[1] = "file:/c:/tmp.mov"; //outputfile
        args[2] = "file:/c:/peli.mov"; //inputfile
        args[3] = "-s";
        args[4] = "5000";
        args[5] = "-e";
        args[6] = "25000";
        //no more changes...Does any one have an idea what do I'm doing wrong? I'll appreciate ur help.

  • Having problems with a Java Telnet Client

    I'm trying to write a Telnet Client(for a mud). I've searched the forum but can't seem to find the answer to my problem. The mud sends the ANSI color codes, is there anyway to get java to interpret this, or will I have to make a parser and do all the work by hand?

    Try looking up RFC854 & RFC855. A Google Search will give several references. Other Searches include "Interpret As Command", and "Telnet IAC Options".
    The keys to telnet communications:
    1. Unless it is explicitly a command, it is data.
    2. All Commands start with the Interpret As Command (IAC) character, decimal 255 or hexidecimal ff.
    3. IAC DO/DONT/WILL/WONT Negotiations for a Telnet Option occurs before IAC SB/SE Subnegotiations. DON'T/WON'T is the default Telnet Network Virtual Terminal (NVT) setting for all options.
    4. All Negotiations complete before you get to the data phase.
    5. Be ready for Negotiations, at the start and during the middle of the Telnet Session....
    Here is an example of decoding Telnet
    The remote host may start with the following, shown in decimal:
    255, 253, 3, 255, 253, 24, etc...
    Viewed as UTF text, this appears to be some "y" characters with special accents above them.
    Cheat Sheet:
    255 == Interpret As Command (IAC)
    254 == DON'T, as is "I DON'T support xyz...."
    253 == DO, as in "I DO support xyz..."
    252 == WON'T, as in "You WON'T support abc..."
    251 == WILL, as in "You WILL support abc..."
    250 == SuBnegotiations Start (SB)
    240 == Subnegotiations End (SE)
    The above has 2 commands:
    - 255, 253, 3 == IAC DO Suppress Go Ahead
    - 255, 253, 24 == IAC DO Terminal Type
    Appropriate Responses could be:
    - 255, 251, 3, 255, 251, 24, etc....
    OR
    - 255, 252, 3, 255,252, 24, etc...
    OR
    - 255, 251, 3, 255, 252, 24, etc...
    OR
    - 255,252, 3, 255, 251,24, etc...
    Once you get the remotes questions answered, you can move on to the real work of passing data.
    Cheers,
    Joel.

  • Problem with creating JAVA Source. please help

    Dear all
    how are you.
    In fact I have made a simple java class that return a string which represents the screen size . for example 800/600 or 1024/768 or others
    but I face error ORA-29541 class string.string could not be resolved
    This what i made
    first i created my JAVA Source
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ScreenProperty" AS
    import java.lang.Object;
    import java.awt.*;
    public class ScreenProperty
    int w;
    int h;
    public static String getScreenSize()
    w = Toolkit.getDefaultToolkit().getScreenSize().width;
    h = Toolkit.getDefaultToolkit().getScreenSize().height;
    return w+"/"+h;
    SQL>Operation 160 succeeded.
    this means the the java source created successfuly
    and I'm sure that my java code is correct
    then i created a fuction to call this java source as fellow
    SQL> create or replace function f_get_screen_size
    return varchar2
    as language java
    name 'ScreenProperty.getScreenSize() return java.lang.String';
    Function created.
    the I Issued this sql statement to return the result that should be varchar2 that represent the sceen size(1024/768)
    SQL> select f_get_screen_size from dual;
    ORA-29541 class string.string could not be resolved.
    I do not know what is the reason for this error
    and when i searched the documentation for this error i found
    ORA-29541 class string.string could not be resolved
    Cause: An attempt was made to execute a method in a Java class that had not been previously and cannot now be compiled or resolved successfully.
    Action: Adjust the call or make the class resolvable
    I need to know what is the problem.
    And is there another way to load this class other than making JAVA SOURCE
    please help

    before drawing hands of clock you could fill a circle/oval with certain color, then you'd have that kind of circle that has been filled as backgound.
    you may change those dots to be small lines for 12, 3, 6 and 6 o'clock and then have small dots represent 1, 2, 4, 5, 7, 8, 10 and 11 o'clock
    anyhow, you should study that code and see how you can modify it whitout breaking it but having it look different.
    better yet would be trying to understand how it works, what any line there means and then recreate your own... this way you would learn more....
    and if there are some methods or anything you don't understand, then look them up from API documentation
    good luck.

  • A problem with importing java.util.concurrent

    I am rather new to Java with not that much experience. I apologize ahead though if this is the inappropriate forum to post this problem and/or this question has been answered somewhere else (I couldn't find a post on this subject).
    Some of my research has lead to using a semaphore if you wish to use the synchronized() method. I looked up that the import for that is under java.util.concurrent.Semaphore; however, thanks to netbeans for pointing this out before I compiled it, this doesn't seem to exist.
    I'm using Java version 1.6.0_03 which does seem to be the latest version. Was it simply removed or am I seriously missing something big here? Anyways, I'm at a total loss and hopefully someone can point me in the right direction.
    Thank you in advance for your help.

    jiju wrote:
    check whether import java.util.concurrent.*; is workingAwesome.
    As for netbeans, I went and double checked to see if it is reading from the most updated folder of Java and it is.
    So as I said, I am totally lost as to why it's not working. Should I just downgrade to a lower version of Java? Although it would seem kinda weird to do something like this.

  • Problems with basic Java JPanel animation using paintcomponent

    okay so I am trying to animate a sprite moving across a background using a for loop within the paintComponent method of a JPanel extension
    public void paintComponent(Graphics g){
    Image simpleBG = new ImageIcon("Images/Backgrounds/Simple path.jpg").getImage();
    Image mMan = new ImageIcon("Images/Sprites/hMan.gif").getImage();
    if (!backgroundIsDrawn){
    g.drawImage(simpleBG, 0, 0, this);
    g.drawImage(mMan, xi, y, this);
    backgroundIsDrawn=true;
    else
    for (int i=xi; i<500; i++){
    g.drawImage(simpleBG, 0, 0, this);
    g.drawImage(mMan, i, y, this);
    try{
    Thread.sleep(10);
    } catch(Exception ex){System.out.println("damn");}
    The problem is that no matter what I set my thread to, it will not show the animation, it will just jump to the last location, even if the thread sleep is set high enough that it takes several minutes to calculate,, it still does not paint the intemediary steps.
    any solution, including using a different method of animation all together would be greatly appreciated. I am learning java on my own so i need all the help I can get.

    fysicsandpholds1014 wrote:
    even when I placed the thread sleep outside of the actual paintComponent in a for loop that called repaint(), it still did not work? Nope. Doing this will likely put the Event Dispatch Thread or EDT to sleep. Since this is the main thread that is responsible for Swing's painting and user interaction, you'll put your app to sleep with this. Again, use a Swing Timer
    and is there any easy animation method that doesnt require painting and repainting every time becasue it is very hard to change what I want to animate with a single paintComponent method? I don't get this.
    I find the internet tutorials either way too complicated or not nearly in depth enough. Maybe its just that I am new to programming but there doesn't seem to be a happy medium between dumbed down Swing tutorials and very complicated and sophisticated animation algorithmns.I can only advise that you practice, practice, practice. The more you use the tutorials, the easier they'll be to use.
    Here's another small demo or animation. It is not optimized (repaint is called on the whole JPanel), but demonstrates some points:
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    @SuppressWarnings("serial")
    public class AnimationDemo2 extends JPanel {
      // use a publicly available sprite for this example
      private static final String SPRITE_PATH = "http://upload.wikimedia.org/" +
                "wikipedia/commons/2/2e/FreeCol_flyingDutchman.png";
      private static final int SIDE = 600;
      private static final Dimension APP_SIZE = new Dimension(SIDE, SIDE);
      // timer delay: equivalent to the Thread.sleep time
      private static final int TIMER_DELAY = 20;
      // how far to move in x dimension with each loop of timer
      public static final int DELTA_X = 1;
      // holds our sprite image
      private BufferedImage img = null;
      // the images x & y locations
      private int imageX = 0;
      private int imageY = SIDE/2;
      public AnimationDemo2() {
        setPreferredSize(APP_SIZE);
        try {
          // first get our image
          URL url = new URL(SPRITE_PATH);
          img = ImageIO.read(url);
          imageY -= 3*img.getHeight()/4;
        } catch (Exception e) { // shame on me for combining exceptions :(
          e.printStackTrace();
          System.exit(1); // exit if fails
        // create and start the Swing Timer
        new Timer(TIMER_DELAY, new TimerListener()).start();
      // all paintComponent does is paint -- nothing else
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.blue);
        int w = getWidth();
        int h = getHeight();
        g.fillRect(0, h/2, w, h);
        if (img != null) {
          g.drawImage(img, imageX, imageY, this);
      private class TimerListener implements ActionListener {
        // is called every TIMER_DELAY ms
        public void actionPerformed(ActionEvent e) {
          imageX += DELTA_X;
          if (imageX > getWidth()) {
            imageX = 0;
          // ask JVM to paint this JPanel
          AnimationDemo2.this.repaint();
      // code to place our JPanel into a JFrame and show it
      private static void createAndShowUI() {
        JFrame frame = new JFrame("Animation Demo");
        frame.getContentPane().add(new AnimationDemo2());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      // call Swing code in a thread-safe manner
      public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
            createAndShowUI();
    }

  • Problems with DirectPrinterDemo: java.lang.NoSuchMethodException

    Hello,
    our environment is oracle forms10g Version 9.0.4.0.19. i have tried to run the directprinterbean from casey bowden, but i had no luck. i forced forms to use the jre 1.5.06. instead of the jinitiator but i get error messages like these..
    java.lang.NoSuchMethodException: sun.java2d.SunGraphicsEnvironment.setFallbackFont(java.lang.String)
         at java.lang.Class.getMethod(Unknown Source)
         at oracle.forms.engine.Main.initDesktop(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NoSuchMethodException: sun.java2d.SunGraphicsEnvironment.preferLocaleSpecificFonts()
         at java.lang.Class.getMethod(Unknown Source)
         at oracle.forms.engine.Main.initDesktop(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    proxyHost=null
    proxyPort=0
    connectMode=HTTP, native.
    Version von Forms-Applet: 9.0.4.0
    java.lang.ClassFormatError: Truncated class file
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.startRunform(Unknown Source)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    what should i do to fix the problem? what are meaning the error messages in detail? where is my fault?
    is there a way to run the directprinterbean with jinitator?
    thank you
    Gunnar
    Message was edited by:
    [email protected]

    Hi
    Did you ever find out what caused this. We are having a similar problem where we forced the use of jre 1.6

Maybe you are looking for

  • Error while starting Managedserver for 2nd server in cluster

    Hi we have 2 Unix servers of which one has Admin and managed server and second has only managed server. while starting managed server for 2nd unix server we are getting below error though it is in running state: KINDLY HELP!! changed Location=site:XX

  • Extract Data in Power Pivot from MDX with diffrentnt different Level of Hierarchy in MDX

    Hi All, My requirement is to extract the data form tabular model and put in power pivot,as all the measures calculation is present in model just extracting the aggregated data. Issue is appearing on Rolling up the data, so is there any way to extract

  • Return a collection

    I am having trouble coming up with a plan for search functionality for my UI. I have an application that talks to a middle teir in .NET, the middle tier accesses the Oracle database. People are going to want to search by multiple fields that come fro

  • .PKG files won't open

    So I downloaded some shareware recently and out of nowhere .pkg files can't be recognized and I can't install anything. It just gives me an option to choose an application with which to open it. This comes after cleaning out my hard drive of crap I d

  • Mail Crashing repeatedly over past week

    Several times a day for the past week Mail has suddenly quit. I have not yet been able to figure out what is causing this, so I am attaching part of the error information below in the hopes that a more knowledgeable user can help me pinpoint the caus