Clickable/Linked Text in Java Applet

Hi,
I have always liked this tool http://link-verify.sourceforge.net/index.en.html and have always wanted to modify it to make the "referer" clickable so that I could easily click to link to the page that had the broken link more easily.
The source code is available and well with the hard economic times I have time to finally modify this to work how I would like.
Can anyone tell me how I would go about accomplishing this? I am a seasoned ASP.NET programmer and understand the overall logic, etc... It is just the Java syntax that I am missing.
Basically I can discern that in source code, LinkFrame.java to be exact on line 308 the "referreeP" panel is being populated with a refL=new List(), where refL is a List that is populated as each link is processed as the applet runs.
How can I make each of those items in the refL list clickable is my primary question for you all. Do I have to use some sort of listener on each item in the list, is that even the right approach to take.
Any and all thoughts appreciated!
PS - I want to shout out to Ralf Wiebicke for creating this wonderful tool, it has been a wonderful developer tool for me over the years.

>
Basically I can discern that in source code, LinkFrame.java to be exact on line 308 the "referreeP" panel is being populated with a refL=new List(), where refL is a List that is populated as each link is processed as the applet runs.
How can I make each of those items in the refL list clickable is my primary question for you all. >Questions usually end with a question mark. Where is yours?
If you check the JavaDocs for List, you will notice it has methods [addActionListener(ActionListener|http://java.sun.com/javase/6/docs/api/java/awt/List.html#addActionListener(java.awt.event.ActionListener)] ) and [addItemListener(ItemListener)|http://java.sun.com/javase/6/docs/api/java/awt/List.html#addItemListener(java.awt.event.ItemListener)]. Either of those listeners will detect actions/selections on the List.
As for showing the links, look to [AppletContext.showDocument(URL)|http://java.sun.com/javase/6/docs/api/java/applet/AppletContext.html#showDocument(java.net.URL)].
As an aside, the AWT widgets such as List are very old-hat. If you wanted to take on a bigger upgrade, you might convert the app. to use Swing.

Similar Messages

  • Voiceover tool doesnt rcognize text on java applet

    Voiceover tool doesnt recognize the texts on the java applet.

    absolutely now way of doing this straight forwardly. But some workouts could be :
    1. whatever text u want to display, try displaying it inside a textarea (and not simply as label). This will automatically adjust the textarea as well as the text inside it on resizing.
    2. develop a custom class (say DynamicLabel) which will keep track of the resizing event of the applet or frame and adjust the text in multiple lines accordingly. But then u have to write custom code to adjust the text in multiple lines.
    regards

  • Using text in java applets

    hello i have a typewriter applet and am entering text for it to type, i know that using # makes text skip a line and &nbsp makes a space. does anyone know what others there are to use when i am entering my text. HTML doesnt do anything in java so when i used the <br> tag it only showed as text, but then found that # worked great any other things/tricks on the keys i can use within my text ...thanks ahead of time

    i know that using # makes text skip a line and makes a space ...Really? I didn't and I suspect a number of regular helpful folk here didn't know that either. Suggestion: why don't you explain a little bit more about your app and what you want it to do - or even post your code, as I suspect there may be an easier way /possibly 'better' way to do what you're doing.

  • Loading Java Applet...  error

    Hi!
    When I try to run the Sun demo SwingSet2, IE(5.0) hangs.
    First I installed JRE 1.3.1(on advice of the demo site.)
    Then it all end up with the text "Loading Java Applet..."
    in the grey box.
    I have also tried to install different JRE versions but I just can't run a Sun demo applet (neither my own applets).
    I would be very happy if someone could solve this problem.
    /Jonas
    InternetExplorer: 5.00.3315.1000
    Windows 2000

    Hi:
    I just have a comment and one last suggestion.
    First, I am able to run the SwingSet2Plugin.html with both IE5.0 and IE5.5 on Windows 98SE. I am currently using JDK/JRE1.3.1. A few months ago, I upgraded to 1.3.1_02 and found that some of my applets stopped working for no apparent reason, so I went back to 1.3.1.
    If your applets stopped working because of an upgrade in JDK or JRE and you're using Windows, I suggest that you make sure that the previous version of the JDK/JRE were cleanly removed from the system. You can verify this by going to the Control Panel and click on Add/Remove Program to see if there are multiple versions of the software. Also, click start, run REGEDIT and look in the following folder for any remaining references to the JDK/JRE:
    HKEY_LOCAL_MACHINE-->Software-->Microsoft-->Code Store Database-->Distribution Units
    look for something with {...} or the prefix {CAFE...  and remove any remaing older versions (I know most people wouldn't touch regedit with a ten-foot pole but this may be the only way to solve the problem).
    I use a lot of applet and am particularly interested in cases where ppl have problems with using applet and find out how the problems are resolved.  If my suggestions worked or if you find out what caused the problem, I would appreciate your sharing the info.
    Good Luck!
    V.V.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • So I can update my Oracle Java Applet Plug-in to Development Kit 7, Update 65, can you link me to the correct Oracle download page from your Plugin Update page?

    When I periodically accessed your Plugin Check and Updates web page in the past, I really appreciated you connecting me to the correct Plugin Updates vendor web page when I clicked on your red Update Now button. This time, however, your Java Applet Plug-in "Update Now" button linked me to the Oracle Java "7u65 Updates Release Notes" instead of the usual download page. It seems rather unexpected for me, or any other conscientious user for that matter, to search the appropriate "JDK 7U65" file download from the Oracle website.
    Thank you,

    This is getting way too complicated for normal peop.
    First: the "Update Plugin" does not work, it goes to a page with all sort of computer jargon but no "Update button" anywhere.
    Second: this forum jscher2000 gives a good solution, but I downloaded the incorrect java update, because my computer is 64 bit. how am I supposed to know my browser is what it refers to and that FF is 32 bit.....???$%^&*()??
    Third: some of those "critical update" software are not even on my computer....well at least I don't think it is, I search for "shockwave" and did not find it.
    I love Moz FF but the updating is starting to get out of control. why give us (computer idiot) an auto recommendation update not tailored to our computer? Perhaps in big letters at the top there should be an explanation "this is general suggestion these plugin needs updating, not to tailored with your computer, do your own research"
    and/or add info I need to know like the 32 bit thing, took me forever to download the 64bit update for JAVA and it was the wrong one.
    Now I am just afraid to update anything for FF because it is too darn confusing.

  • Java applet shows boxes instead of text

    I'm helping a friend with a new PC. He likes to work the crosswords at washingtonpost.com, which are embedded java applets. For what ever reason, all the clues just show up as boxes where the text should be. This screen shot should help:
    http://members.cox.net/rtadams89/screen.png
    As you can see, all the "clues", and the crossword title just show boxes where letters should be. Other text (that which you type into the crossword) as well as text in java apps on other sites shows up fine. I've tried reinstalling the java run time environment, as well as clearing the browser files and checking internet explorer settings. Any other suggestions?

    I'm still not having any luck with this. I've reinstalled Java, and also check the internet explorer settings. Nothing seems to be wrong as other sites work just fine. Could this be a missing font issue?

  • Why doesn't text in Java Swing applets show?

    See http://sambaker.com/econ/elast/elast.html
    This web page works OK on PCs.  Not on my MacBook Pro.  On my MacBook Pro, text is missing from some of the first Java applets on this page. 

    Be sure that the font color is different than the background color
    Increase the pt size in the tool's option bar beyond the presets. You can enter a number manually.

  • Creating Java applet

    I have to create a Java applet, but I don't know how. It should display a simulation of running rabbit in 10 circles, explaining the For cycle in a programming language C. I tried to make it in NetBeans, but I couldn't. Can anubody please help me? Any hint, useful site or line of code... I would be very grateful.

    mneskovic wrote:
    I'm sorry. I'm just in deadline,.. For the record. Not our fault, not our problem, and mentioning deadlines does not encourage people to help.
    ..so I lose my nerves easy... In that case, I strongly suggest you re-read all your posts before sending them off. If they have a hint of 'lost nerves' they are likely to irritate the very people who might otherwise help you. I think you can guess that is not conducive to getting a good, timely, technical solution.
    ..OK, let's deal with the problem.
    I was looking for the solution of posted problem on the Internet and found that I should sign in my applet. Since I work in NetBeans, I enabled Web start because it looked like the fastest way to do it. .. That statement reads like nonsense to me. Perhaps NetBeans has some automagic script that presumes a JWS application needs to be digitally signed and does that for each build. If that is the case, I just found another reason to dislike it.
    ..My applet has database connection (connection to MySQL database - applet has text field and input from it is recorded in database) which works just fine in Applet Viewer. .. Are you launching the AppletViewer using NetBeans?
    ..When I enabled Web Start, I finally could see applet in Web page, but now I don't have database connection, there is no recording in database when I make input from text field...Are you looking for exceptions in the Java Console?
    The post you made earlier shows no sign of adding the Jar containing the DB driver to the archive attribute of the applet element. That is the most logical reason why the applet would not be able to connect to the DB.
    Note that I am still pretty unimpressed by your efforts to get help with this. I linked to an earlier thread where I asked you questions and you then abandoned the thread. You can partly restore my motivation to help by copy/pasting those questions to this thread and answering the questions.
    These problems will not be sorted by some 'magic line of code'. You need to understand what is happening. I see no sign you are gaining that understanding.

  • Putting Java Applets in Cell in Report

    I am in a small biotech and am trying to put together a chemi-bioinformatics application with HTMLDB. I want to have chemical structures (2D & 3D) show up in reports in the same row with the data associated with that chemical (e.g. properties, assay results, etc.)
    I have found several Java applets that work well. These are uploaded along with the chemical structure files (as static files)and referenced using #WORKSPACE_IMAGES# in the path in the HTML/Javascript.
    What I would like to do is to have the structural info (essentially it is formated alphanumeric text) in a table linked to the appropriate chemical id and associated data.
    This will be displayed as a report with the first cell of each row containing the applet (with a reference to read in the structural info cell on the same row).
    How can I embed the applet into the first cell of each row on the report?
    Any suggestions will be greatly appreciated!
    -Dave Hecht

    our oracle support analyst was checking around internally re your issue, and tipped your hand a little by saying you're trying to have your #MOLFILE# column render as a textarea. as you've probably found, those "Updateable Column Attributes" are ignored when you specify an HTML Expression. since you would still like to have your data render as updatable while applying some of that html expression formatting, consider manually making your #MOLFILE# column updatable. if you do that, you'd have 100% control over the id values that you're having issues with. so if you had a report query like...
    select molfile from my_table
    ...and you indicated that you wanted molfile to render as a textarea, you'd find the generated html for each row to look something like this...
    <textarea name="f01" rows="15" cols="15" wrap="VIRTUAL" id="f01_000N">some molfile data here</textarea></td>
    ...where N is the associated #ROWNUM#. so if you're having a hard time referencing your values after rownum=9, as i'm gathering, you could consider manually naming your cells (though there's probably a more proper/fancy way to dynamically reference those higher rownum values, i just haven't looked for one). to do so you could turn off the "Updateable Column Attributes" by setting the "Display As" field in that region to "Display as Text (does not save state)". then drop something like...
    <textarea name="f01" rows="15" cols="15" wrap="VIRTUAL" id="f01_#ROWNUM#">#MOLFILE#</textarea></td>
    ...into the "HTML Expression" field for your molfile column. the part of this syntax that needs to conform to htmldb standards is the "name" value. this is somewhat explained in our tabular form how-to doc at...
    http://otn.oracle.com/products/database/htmldb/howtos/tabular_form.html#MANUAL
    ...but the form elements with names f01, f02, f03, etc will be accessible during the htmldb engine's accept processing via those pl/sql varchar arrays, htmldb_application.g_f01, htmldb_application.g_f02, htmldb_application.g_f03, etc. if you're using an htmldb wizard-generated tabular form instead of one you're creating yourself, just make sure your HTML Expression code provides the same html form element names that would have been used by the unaltered form.
    hope this helps,
    raj

  • Rewriting java applet parameters

    I am attempting to get a java applet to work through the portal. Of
    course it
    does not work "out of the box" The applet is a menuing applet and it
    gets is
    text for the menu options (and the associated links) from the applet
    parameters. I have read the documentation for this and, in typical Portal
    Server documentation fashion, it has been less than helpful.
    Here are the details: The asp page that loads the applet is loaded from
    /menu/menu.asp Here is the HTML that loads applet and sets some of the
    parameters:
    <td><APPLET name='1' code='imgMenu.class'
    codebase='class/'height='17' width='124' id=Applet1>
    <param name='xloc' value='0'>
    <param name='yloc' value='17'>
    <param name='upimage' value='/menu/images/bbusinessunit.gif'>
    <param name='placement' value='right'>
    <param name="item1" value="0|ACT - Alaska Consolidated Team">
    <param name="item2" value="1|ACT Home">
    <param name="URL2" value="http://alaska.somewhere.com/act|_top">
    <param name="item3" value="1|ACT Badami">
    <param name="URL3" value="http://alaska.somewhere.com/cns_badami|_top">
    <param name="item4" value="1|ACT Endicott">
    I configured the rewriter like this:
    /menu/menu.asp imgMenu.class upimage
    /menu/menu.asp imgMenu.class URL*
    so that the upimage parameter would be rewritten as well ad the URL*
    parameters (there are URL1 all the way to URL53). This does not work.
    Has anyone gotten the Java applet paremeters rewriting working? If so,
    what I am I missing?
    Kent
    "For everything there is a season, and a time for every matter
    under heaven: ... a time to love, and a time to hate; a time
    for war, and a time for peace."
    -- Ecclesiastes 3:1,8

    sig and J.C. Westin-
    I used the Adobe Flash UNinstaller, and then installed Adobe Flash Player v10.0.12.10. No improvement/it did not correct the problem. Power E*Trade Pro (a Java Applet) still won't start properly (since Apple Software Update installed Java Release 7).
    I even did all the Repair Permissions steps before and after Flash UNinstal/reinstall (suggested by J.C. Westin; even though they did seem somewhat excessive; Note: all permissions were set properly before installing; Permissions DID need repair AFTER installing Flash; guess that Adobe doesn't get the permissions right in it's own installer!).
    To be honest, I did not really place much hope in solving the problem via an update to a BETA version of Flash. The problem occurred when I updated Java (per Apple's Software Update), not when doing anything with Flash. More to the point, I don't believe the Java applet that's having problems now uses Flash at all. Placing hope in a Flash BETA seemed to me like being told to replace my brake fluid after complaining the engine wasn't running.
    I'm (still) looking for a (non-draconian) way of reverting back to Java Release 6. Someone has to have some steps for trashing specific files/binaries to Remove Java Release 7, then installing the full Java Release 6 anew. Please? Anyone? Trashing the entire OS then performing a clean install is a huge amount of work. I just need to trash Java Release 7.
    Thanks in advance to anyone who can help here.

  • Java Control Panel wont open at all and any Java Applets crash web browsers

    Hello,
    I recently installed a fresh fully updated copy of Windows 7 Home Premium 64 bit, and I have not for the life of me been able to get Java working at all. Java version is the latest JRE 6U31. I only have Internet Explorer 9 installed but I doubt it is a browser issue since I cannot even open the Java control panel. I have tried using the 32 bit version of Java, and the 64 bit. Anytime I try to open the Java control panel with either 32 bit or 64 bit, I get an error message (click link below to view error message):
    http://i65.photobucket.com/albums/h204/gobigjeff/Java%20Error/javaerror.png
    I can only bring up the Java Control Panel using the command “javaws –viewer” . Anytime I try to load a web page with a Java applet in either 64 bit or 32 bit, it freezes and crashes. I am running Internet Explorer 9 and have tried both the 32 bit and 64 bit browser versions. I saw Java’s recommendation to only use the 32 bit version so I have mainly been trying to get the 32 bit version working 1st, with no success. I have tried ALL of the following steps, and have done some exhaustive research on this problem. It seems others have had this issue as well, with no solution to be found:
    •     Uninstalled and reinstalled only Java 32 bit JRE 6u31 multiple times (Used Javara and reg cleaner to remove all old Java traces)
    •     Uninstalled and reinstalled only Java 64 bit JRE 6u31 (Used Javara and reg cleaner to remove all old Java traces)
    •     Uninstalled and reinstalled bit JRE 7 (Used Javara and reg cleaner to remove all old Java traces)
    •     Used SFC /scannow in safe mode to verify Windows files
    •     Ran spyware and virus scan with no issues detected
    •     Added all java processes to windows firewall
    I am out of solutions here. If anyone has had this problem with Java or knows what I need to do to fix the problem your advice would be greatly appreciated. I don’t think reinstalling windows is the solution because this is a fresh install.
    Edited by: 918650 on Mar 4, 2012 1:16 PM

    I figured it out. I changed the installation folder to C:/Java and it finally worked!

  • SeaMonkey v2.0.4's Java applets doesn't work all the time.

    Hello. I use Mozilla's SeaMonkey v2.0.4 (using binary from mozilla.org) in Debian/Linux. I can get Java applets to work on https://eetime11.adp.com/c08e/logon but not on http://javatester.org, http://java.com/en/download/installed.jsp, and http://java.com/en/download/help/testvm.xml
    Java Plug-in 1.6.0_20
    Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
    User home directory = /home/ant
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class testvm2/Main.class not found.
    java.lang.ClassNotFoundException: testvm2.Main.class
         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 sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    FYI on my setups:
    $ pwd
    /home/Programs/seamonkey2/plugins
    $ ls -all
    total 28
    drwxr-xr-x 2 ant ant 4096 2010-04-15 15:46 .
    drwxr-xr-x 15 ant ant 4096 2010-04-16 08:32 ..
    lrwxrwxrwx 1 root root 32 2009-11-27 17:19 libflashplayer.so -> /home/Programs/libflashplayer.so
    lrwxrwxrwx 1 root root 63 2010-04-15 15:46 libjavaplugin_oji.so -> /home/Programs/jre1.6.0_20/plugin/i386/ns7/libjavaplugin_oji.so
    -rwxr-xr-x 1 ant ant 15824 2009-10-17 09:30 libnullplugin.so
    $ ls -all /home/Programs/jre1.6.0_20/plugin/i386/ns7/libjavaplugin_oji.so
    -rwxr-xr-x 1 ant ant 137021 2010-04-12 14:39 /home/Programs/jre1.6.0_20/plugin/i386/ns7/libjavaplugin_oji.so
    Does anyone know why? Thank you in advance. :)
    Edited by: antdude on Apr 16, 2010 8:37 AM

    More poking around:
    $ java -version
    java version "1.6.0_18"
    OpenJDK Runtime Environment (IcedTea6 1.8pre) (6b18~pre2-1)
    OpenJDK Server VM (build 14.0-b16, mixed mode)
    # dpkg -l | grep ^ii |grep java
    ii ca-certificates-java 20091021 Common CA certificates (JKS keystore)
    ii java-common 0.35 Base of all Java packages
    ii libaccess-bridge-java 1.26.2-4 Java Access Bridge for GNOME
    ii libaccess-bridge-java-jni 1.26.2-4 Java Access Bridge for GNOME (jni bindings)
    ii libhsqldb-java 1.8.0.10-6 Java SQL database engine
    ii liblucene2-java 2.9.2+ds1-1 Full-text search engine library for Java(TM)
    ii libservlet2.4-java 5.0.30-12 Servlet 2.4 and JSP 2.0 Java library
    ii openoffice.org-java-common 1:3.2.0-4 full-featured office productivity suite -- arch-independent Java support files
    ii tzdata-java 2010h-1 time zone and daylight-saving time data for use by java runtimes
    # dpkg -l | grep ^ii |grep jre
    # locate bin/java
    /home/Programs/jre1.6.0_20/bin/java
    /home/Programs/jre1.6.0_20/bin/java_vm
    /home/Programs/jre1.6.0_20/bin/javaws
    /usr/bin/java
    /usr/bin/javaws
    /usr/lib/jvm/java-6-openjdk/bin/java
    /usr/lib/jvm/java-6-openjdk/bin/java-rmi.cgi
    /usr/lib/jvm/java-6-openjdk/bin/javaws
    /usr/lib/jvm/java-6-openjdk/jre/bin/java
    /usr/lib/jvm/java-6-openjdk/jre/bin/javaws
    /usr/lib/jvm/java-6-openjdk/jre/bin/javaws.real
    I tried to uninstall all the unneccesary Java packages, but still had some can't be removed because of other programs requiring it like OpenOffice:
    # apt-get remove openjdk-6-jre-headless
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    openoffice.org-filter-mobiledev ttf-sil-gentium ttf-sil-gentium-basic
    Use 'apt-get autoremove' to remove them.
    The following packages will be REMOVED:
    ca-certificates-java libaccess-bridge-java libaccess-bridge-java-jni libhsqldb-java liblucene2-java libservlet2.4-java
    openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib openoffice.org openoffice.org-base openoffice.org-officebean
    openoffice.org-report-builder-bin
    0 upgraded, 0 newly installed, 13 to remove and 125 not upgraded.
    After this operation, 114MB disk space will be freed.
    Do you want to continue [Y/n]? n
    Abort.
    # apt-get remove java-common
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    openoffice.org-filter-mobiledev ttf-sil-gentium ttf-sil-gentium-basic
    Use 'apt-get autoremove' to remove them.
    The following packages will be REMOVED:
    ca-certificates-java java-common libaccess-bridge-java libaccess-bridge-java-jni libhsqldb-java liblucene2-java
    libservlet2.4-java openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib openoffice.org openoffice.org-base
    openoffice.org-officebean openoffice.org-report-builder-bin
    0 upgraded, 0 newly installed, 14 to remove and 125 not upgraded.
    After this operation, 115MB disk space will be freed.
    Do you want to continue [Y/n]? n
    Abort.
    Any ideas? :(

  • Java Applet is not working in IE11 in win8/win 2008 server

    Hi,
    we have developed web application using PHP. in the start of the page we have link which will kick start the Java Applet application on click.  
    It is not working in IE 11 browser with all windows machine until we add that page in the compatibility view settings.
    we have tried with many options like setting the meta tag in the start of the HTML page.
    but this is also not helped. we expect some more idea/solution to solve this issue.
    Thanks in Advance.
    Thanks.
    Udhayakumar Gururaj.

    IE 11 is not a supported browser of JavaFx. See http://www.oracle.com/technetwork/java/javafx/downloads/supportedconfigurations-1506746.html.
    If you want Oracle to change their support policy, ask Oracle customer support.
    Visual C++ MVP

  • Printing problem on java applet

    Hi, I'm Korean and MacBook air user.
    I'm very not good at English, please excuse me .
    I use OS X 10.8.3 and jdk 7.
    I make a simple java applet program includes printing functionary.
    But, only browsers (Safari and FireFox) on Mac OS X  not printing font correctly.
    I use setFont() function and then drawString() function.
    If you cannot understand my question, enter the link below. I think that question is same with my question.
    http://stackoverflow.com/questions/15466060/java-app-on-mac-os-x-not-printing-fo nts-correctly
    Thank you for reading my question.

    Points/questions.
    It is a lot easier to debug these things if we can see the applet. Is it on the net? Can you give us the URL?
    Have you considered launching this applet using web start? (If it turns out to be related to security, the web
    start JNLP API has a neat way to sidestep that problem.)
    Edit 1: Deleted the entire first two paragraphs when realised you said 'always prints'.
    Edited by: AndrewThompson64 on Apr 1, 2008 9:41 AM

  • Socket communication failure between Java applet and C++ application

    I have a java applet that connects to a C++ application via Java's ServerSocket and Socket objects. THe C++ application is using the Winsock 2 API. The applet and application are running on an NT workstation (SP 6) and using IE (5.5) For a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close. Upon performing a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket. The Java applet can still receive messages from the C++ app but C++ cannot receive responses from the Java side. Java throws no exceptions and an explicit check of the socket shows no errors. Again, what puzzles me is that it works for simple C++ applications. Are there any known conflicts between Java and C++ in this regard?
    I have inlcuded the basic java code segments below.
    / run Method.
      * This method is called by the Thread.start() method. This
      * method is required for the implementation of the Runnable interface
      * This method sets up the server side socket communication and
      * contiuously loops looking for requests from a external
      * socket.
      * @author Chris Duke
      public void run(){
         // create socket connections
         boolean success = false;
         try {
             cServerSocket = new ServerSocket(cPortID);
             System.out.println("Waiting for client to connect...");
             cClientSocket = cServerSocket.accept();
             System.out.println("Client connected");
             // Create a stream to read from the client
             cInStream = new BufferedReader(new InputStreamReader(
               cClientSocket.getInputStream()));
             // Create a stream to write to the client       
             cOutStream = new PrintWriter(
               cClientSocket.getOutputStream(), true);
             success = true;
         }catch (IOException e) {
             System.out.println("CommSocket:Run - Socket Exception(1) " + e);
             success = false;
         // if the socket was successfully created, keep the thread running
         while (success){
             try{
                // check socket to see if it is still available for reading
                if (cInStream != null && cInStream.ready()){
                    // check for an incoming message
                    String message = ReceiveMessage();
                    // Send message to listeners
                    Event(message);
                if (cInStream == null){
                    success = false;
                    System.out.println("CommSocket:Run - shutdown");
             }catch (IOException e){
                System.out.println("CommSocket:Run - Socket not ready exception");
                break;
    // SendMessage method -
      *  Sends a text message to a connected listener through port specified by portID
      * @author Chris Duke
      * @param  String message - This will be the message sent out through the server
      * socket's port specified by portID.
       public void SendMessage(String message){
          cOutStream.println(message);
          if (cOutStream.checkError() == true)
            System.out.println("SendMessage : Flush = Error");
          else{
            System.out.println("SendMessage : Flush - No Error");
       }

    a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close.
    This quite strongly implicates the extra code in the C++ App. The firstly thing I would try would be telnet. Try connecting to both versions of the C++ Application and manually reproducing a proper exchange.
    a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket.
    A correct implementation of recv should return the number of bytes received, or -1 for an error. A zero return indicates no bytes received not a socket closed/error. This sounds like FUD to me.
    Are there any known conflicts between Java and C++ in this regard?
    I can see no obvious faults, though the code is incomplete, I don't think it's an sockets implementation issue, at either end, it sounds more likely to be a protocol/handshaking bug in the C++ App.

Maybe you are looking for