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?

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

  • 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?

  • 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

  • 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.

  • 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.

  • Problems with a Java socket client

    Hi,
    I'm using the following piece of code to recieve from a C++ server a string of chars:
    TcpCli = new Socket(m_HostIP, m_HostPorta);
    String msg="";
    int lenSocketBuffer=0;
    BufferedInputStream in = new BufferedInputStream(TcpCli.getInputStream());
    lenSocketBuffer=in.available();
    if (lenSocketBuffer > 0)
    saveBuff = new byte[lenSocketBuffer];
    in.read(saveBuff,0,lenSocketBuffer);
    msg = saveBuff.toString();
    I have verified that the creation of the Socket is OK (using debug on the Server side) and that the Server sends to the Client what I expect to receive. The length of the buffer read in lenSocketBuffer is OK but when I receive the buffer using in.read I find a string that is something like this: "[B@7b6889" which is a completely different buffer from what the server sends and much more shorter then the value of lenSocketBuffer.
    Where is the problem? Please, help me.
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    replace...
    msg = saveBuff.toString();
    with...
    msg = new String(saveBuff);
    saveBuff.toString() returns the string-representation of the object saveBuff. new String(saveBuff) creates a new String-Object with the bytes of the given array.

  • 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.

  • Problem with MixingFloatAudioInputStream.java available() method

    I've always been under the impression that the available() method for an AudioInputStream +returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking+.
    Unfortunately, this doesn't seem to be the case for the available() method in the MixingFloatAudioInputStream class (found on jsresources).
          * The minimum of available() of all input stream is calculated and
          * returned.
         public int available() throws IOException {
              int nAvailable = 0;
              Iterator streamIterator = audioInputStreamList.iterator();
              while (streamIterator.hasNext()) {
                   AudioInputStream stream = (AudioInputStream) streamIterator.next();
                   nAvailable = Math.min(nAvailable, stream.available());
              return nAvailable;
         }Is there a reason why this specific method returns the minimum as opposed to the maximum number of bytes? Can I simply just modify the Math.min function to Math.max to revert it back to its normal behavior?

    Once again, great explanation.
    Like you noticed, I thought that the available() method implied total length minus amount processed so far... Because of this, I decided to use it to measure the length of an InputStream, used in an audio fade class (I've started another thread on this topic with more details).
    public FadeFilterInputStream(InputStream inputStream){
            super(inputStream);
            try {
                streamLength = super.available();
            } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(0);
            fadeLengthBegin = (int) ((0.8)*streamLength);
            fadeLengthEnd = (int) ((0.15)*streamLength);
    } Seeing that FadeFilterInputStream extends FilterInputStream, I can only use an InputStream. Unfortunately, unlike the AudioInputStream, it doesn't have a getFrameLength() method to measure the length of the stream. I tried getting creative with the "available()" method instead.
    What got me thinking that the available() method implied total length minus amount processed so far was the following output from my code:
    available():317520000  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317515904  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317511808  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317507712  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317503616  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317499520  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317495424  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317491328  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317487232  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317483136  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317479040  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317474944  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317470848  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317466752  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317462656  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317458560  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317454464  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317450368  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317446272  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    ...Like you mentioned, seeing that the combined AudioInputStreams were all the same length, it didn't cause me any problems when I modified the method to find the maximum length of the longest stream. From your explanation, this might not be the case if I decide to combine streams of different lengths.
    Using the available() method to measure the total length of the InputStream is probably not the best way to approach this problem. Any ideas?
    +On a side note, according to your example, shouldn't the available() method be returning the same value until the end (in this case 2 seconds worth of bytes)? That doesn't seem to be the case from my output.+

  • 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();
    }

Maybe you are looking for

  • Lost my lumia 620

     Dear Nokia, I am kumar i lost my nokia lumia 620 last saturday 05/07/2014 i am scare of misuse of it and imie no is 35xxxxxxxxxxxxx which was last used mobil no is 81xxxxxxxx. kindly lock it. before it misuse Regards  Kumar D Moderator's note: Phone

  • Does ISE 1.1 support TACACS and H-REAP?

    Hello, Does ISE1.1 support TACACS/TACACS+ and H-REAP mode ? Also, customer wants to have quick access to the corporate network with some few laptops without going through the Actice Directory? Any suggestion on this? Thanks Olu

  • Issue Intalling I Tunes on Windows 7

    Gee Wiz, A lot of information out on this, My resolve was simple Save to Desktop Right Click Make Sure not blocked Then rename Icon to executable file,  add .exe to the end and wholla the icon change to install icon and works Just sayin

  • Mail Profiles Being Deleted After Office 2010 to 2013 Deployment

    I am deploying Outlook 2013 to user in our environment that has Outlook 2010 presently. Many users have additional attached mailboxes to their Outlook profile. After the deployment the default profile for Outlook in the Mail control panel is removed.

  • Album information has gone!

    I recently transferred from a Windows 7 to a Windows 8 laptop and though the music library has all transferred, about half of the Album information has not - how do I fix this?