Comm.jar not working in Applet but works in Eclipse

Hello,
Please help me to read serial port data from Java Applet.
The below code working well and get data from weighing machine when we run in eclipse(Run Applet). But it now working when we use class file in Applet.
I think its security issue, but i still could not understand what we need to do.
I put the JOptionPane.showDialog and found that the code is crashing in line CommPortIdentifier.getPortIdentifiers(); (Not understood why try catch not working.)
I am using in Windows 7 environment.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.logging.Logger;
import javax.comm.*;
import javax.swing.*;
public class SimpleApplet extends JApplet {
public void init() {
JButton button = new JButton("Click me!");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {                 
     JOptionPane.showMessageDialog(SimpleApplet.this, "hello");
JOptionPane.showMessageDialog(SimpleApplet.this, Getdata());
add(button, BorderLayout.CENTER);
setBackground(Color.GRAY);
public String Getdata()
     try
          String drivername = "com.sun.comm.Win32Driver";
try
CommDriver driver = (CommDriver) Class.forName(drivername).newInstance();
driver.initialize();
catch (Exception e) { //just do nothing, it doesn't really matter
     Enumeration portList=null;
CommPortIdentifier portId;
SerialPort serialPort;
OutputStream outputStream;
try
     portList = CommPortIdentifier.getPortIdentifiers();
}catch(Exception ex)
     JOptionPane.showMessageDialog(SimpleApplet.this, "erorr:" + ex.getStackTrace().toString());
JOptionPane.showMessageDialog(SimpleApplet.this, "get port lsit");
          while(portList.hasMoreElements())
               portId = (CommPortIdentifier) portList.nextElement();
               if(portId.getPortType()== CommPortIdentifier.PORT_SERIAL)
                    if(portId.getName().equals("COM1"))
                         try
                              serialPort = (SerialPort) portId.open("WeightMachine",200);                              
                              serialPort.setSerialPortParams(1200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
                              outputStream = serialPort.getOutputStream();
                              InputStream mInputFromPort = serialPort.getInputStream();
                              outputStream.write("W".getBytes());
                              outputStream.flush();
                              Thread.sleep(500);
                              byte mBytesIn [] = new byte[20];
                              mInputFromPort.read(mBytesIn);
                              //mInputFromPort.read(mBytesIn);
                              String value = new String(mBytesIn);
                              mInputFromPort.close();
                              serialPort.close();
                              return value.replace("+00", "").replace(" Kg", "");
                         }catch(Exception ex)
                              return ex.getMessage();
          }catch(Exception ex)
               JOptionPane.showMessageDialog(SimpleApplet.this, "erorr last:" + ex.getStackTrace().toString());
          return "Not found";
Thanks in advance.
Avinash

959817 wrote:EJP wrote:959817 wrote:
it now working when we use class file in Applet.Define 'not working'.But when i run applet from browser from same machine its not working.That's not an answer. That's just a vague and pointless restatement of the original vague and pointless statement that I asked you to clarify.
When you take your car to a mechanic, do you just tell him it's 'not working'?

Similar Messages

  • People picker is not working for ie11 but working fine for other lower version

    i am using sharepoint 2010 and windows authentication
    recently i have updated my ie to ie11 and problem goes here.
    when i try to select from people picker, there are an unexpected error happened 
    however when i use other ie version, people picker work fine, what goes wrong?
    i have already added my system as trusted site
    if there any others thing i miss out?

    Hi,
    According to your post, my understanding is that People picker is not working for ie11 but working fine for other lower version.
    IE 11 is known to have compatibility issues on SharePoint 2010, please make sure to:
    first of all, try installing latest update for IE 11 (several compatibility issues were fixed since the first release)
    add the site to compatibility view (in IE> Tools> Compatibility view settings> type site name> add)
    add the site to trusted sites and set the zone security level to low (in IE> Internet Options> Security> trusted sites> sites>add your site there> ok> custom level> select low> reset> ok)
    You can use developer tools (f12) and set browser mode to the version that is most compatible with your environment.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • My keyboard is not working in "Pages" but works with all other applications.  Please provide resolution advice.

    My keyboard is not working in "Pages" but works with all other applications.  Please provide resolution advice.

    What version of Pages?
    There are one or two of us here who are not intimately acquainted with your particular set-up.
    Peter

  • I have a Mac running 10.9.2. My wireless mouse with not scroll in mail but works fine in other applications? Any suggestions?

    I have a Mac running 10.9.2. My apple wireless mouse will not scroll in Mail but works fine in other applications.
    Any suggestions?

    First, see this discussion. If the solution suggested there doesn't work for you, continue.
    If you've installed a Mail plugin called "Mail Unread Menu" and you know how to remove it, please do that, then quit and relaunch Mail. Test. Otherwise, see below.
    Back up all data.
    1. Triple-click anywhere in the line below on this page to select it:  
    ~/Library/Mail/Bundles
    Right-click or control-click the highlighted line and select 
    Services ▹ Open
    from the contextual menu.* A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.
    2. Repeat with this line:
    /Library/Mail/Bundles
    This time you may be prompted for your login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Motion tracking is not working for videos but works for images?

    Motion tracking is not working for videos but works for images. When the videos is drop onto the tracking object the videos corner don't appear highlighted. I am working on windows 7 with version 13.1.

    ivanhoeeurope
    Are you within 30 days of purchase for the Premiere Elements 13? And, did you purchase as a download from Adobe? If so, you can
    apply for a return/refund for 13. If you purchased elsewhere, then you would be governed by the return/refund policy of the seller.
    Adobe no longer sells version 12, so you would have to find a vendor who still has it in stock and purchase it. There is no way to "downgrade"
    13 to 12.
    What you may want to do is to download and install the Premiere Elements 12 tryout from the following web site to verify that 12 Motion
    Tracking works for you; whereas 13 cannot with regard to use of video for the Motion Tracking source media.
    Adobe Photoshop Elements 12 Direct Download Adobe Photoshop Elements 12 Direct Download Links, Premiere too | ProDesignTools
    Apparently this web site does not sell the tryout. It just makes it available for use.
    Before I posted my reply to you I looked at Motion Tracking with video source media on both Premiere Elements 12/12.1 and 13/13.1 on the same Windows 7 64 bit computer.
    If any questions or need clarification, please do not hesitate to ask.
    Thank you.
    ATR

  • The "new" hotmail no longer works with safari, but works with firefox. Hmm.

    The "new" hotmail no longer works with safari, but works with firefox. Hmm. i find this very convenient being a microsoft product. anybody else wonder why this new version happens to not be safari compatible? does anybody know if it works on the PC version of safari? if not, i find this to be a blatant move on microsofts part to bias the safari browser (especially since its basicly new on the window platform). forcing safari/hotmail users to "have" to use another browser to access their hotmail accounts.

    I have been successfully using Hotmail and Gmail with Safari for a long time. For roughly the past month, that relationship is rocky at best. At times, one of the following actions suddenly opens Hotmail, but it is a short-lived solution:
    (a) Hotmail directly
    (b) Hotmail Home>Hotmail
    (c) Sign up to Windows Hotmail
    (d) Deletion of prescribed cookies, resetting, etc. - made no difference
    Both Firefox and Opera work fine with Hotmail - especially Opera is very fast.
    In addition, Safari and Gmail does not work with Attachments, but otherwise Gmail is OK.
    I suspect I have to wait for a Safari fix because in my case I do not wish to abandon Hotmail, and Safari is a given. I would think that Safari would want to stay competitive with the two biggies, Hotmail and Gmail, which must have large numbers of users.
    I certainly would appreciate any other suggested fixes.

  • Wireless not working in linux, but works fine in windows vista

    Hello!
    I have installed Unbreakable Enterprise Linux 4 in a dual boot config. with Window Vista on a Compaq Presario laptop. After install completed I found that my on board Broadcom Wireless Adapter (Dell 1390 Mini PC card) was not recognized. I have tried installing NDISwrapper versions 1.48 and later 1.47 (after uninstalling 1.48) because everytime I got to the "modprobe ndiswrapper" received a fatal error about an unknown symbol or parameter, and on install I also encountered a "CONFIG_4KSTACKS" error as well. The good part is the light on my laptop for the wireless adapter finally came on and the driver (bcmwl5.inf) appears to be installed and the wireless adapter identified as being present, but it still doesn't show up in the network manager gui interface. So I am out of ideas if any one can give me a suggestion for a solution I would appreciate it.

    Hi there,,,,,
    I have Oracle Enterprise Linux 5 installed and Intel wifi 5100 card installed on my laptop. Wireless card does not work in Linux it works fine with Vista, I have dual boot. I have downloaded and installed the microcode for the wireless card for Linux,,,it is now active but it does not take ip address from dhcp and nor does it connect when i supply manual ip. it does not even scan for any wireless network. I have WEP enabled on my wireless network. It just says disconnected.....
    Please help me.....i have been trying to get this thing work for 3 weeks.
    thanks.

  • Page is not working in serverside but working correctly in JDEV

    Hi,
    After deploying the page which is working propely in my local machine JDEV,
    its not working same at server side. i bounced apache couple of time.
    if any one faced similar issue, please share.
    Thanks,
    Mahesh

    Pages are working fine in my loacl machine, but whn i compile pages (javacode) at server and running the pages from apps instance, pages are not working correctly. But whn I transfer the class file from local machine to server side page is working perfectly, what would be the reason.How to check the Java/JDK version
    D:\>cd jdevbin
    D:\jdevbin>cd bin
    D:\jdevbin\bin>java -version
    java version "1.3.1_01" -- Java Version on local machine
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
    On server
    [apeafin19@camoraapp10 ~]$ cd $ORACLE_HOME
    [apeafin19@camoraapp10 8.0.6]$ pwd
    /u01/oracle/eafin19ora/8.0.6
    [apeafin19@camoraapp10 8.0.6]$ cd bin
    [apeafin19@camoraapp10 bin]$ java -version
    java version "1.4.2_12" -- Java Version on server machine
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
    [apeafin19@camoraapp10 bin]$
    You can see the difference of JDK installed on server and on our local machine which can be root cause of the issue
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Flash player not loading on http but works on https

    I have an issue where flash player shows "movie not loading" on http pages but works fine on https.
    I am using windows 7 64 bit, ie9 64 bit, i have tried it with the latest firefox and chrome and i still get the same issue.
    This started with flash player 10.3, the 10.2 version did not have this problem and all subsequent versions have the same issue. i am currently using the 11.2 version of flash.
    Example: Any flash video on youtube with the address beginning with HTTP, the video screen is black and when you right click you get movie not loading and the correct version of the flash player. If you change the header over to HTTPS the video works fine. this wouldnt be much of a problem except when going to any other website that has flash as its main element but does not have an HTTPS version, you cannot use the page or its features.
    I have uninstalled and reinstalled several times, done a clean install, deleted all files and updated every area of my computer but this issue remains. I have read the forums here and done any suggestions listed to no avail and noticed many people have this type of problem. This issue has now been going on for almost 6 months. Can anyone help?
    I may have posted this in the wrong forum and I appologize. If so can you please move it to the correct location?

    I don't claim to know the solution to your problem, but in your situation I would try either or both administrator install methods: 1) Right-click the downloaded install file, choose "Run as Administrator" and install the software as usual. 2) Try using a different Windows account that you are positively certain has full administrator rights or the actual Administrator login name, install with that account.
    Also, make sure you empty the browser cache before retrying the http pages. What about other browser settings, like security or privacy settings? Any add-ons or antivirus browser helper objects?
    Do you only use Internet Explorer, or is this issue the same in Firefox, Opera, Chrome and Safari?
    Good luck, hope you get the error fixed.

  • Videos will not work in Firefox but work fine in windows explorer. why?

    I tried to verify my plug-in's and all are enabled. I found where was suggested to remove and reinstall Firefox but that did not fix problem either. I tried to change viewer for videos but still no luck. Not certain why Quicktime doesn't work. Note, videos when browsing will not open but everything else works fine. Videos work fine with windows Explorer, but not Firefox.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Top Nav buttons not working after publish, but works in app. WHY?

    I have tried to find out why these buttons will not work after publishing. They work fine while in the iWeb app, but not when publishing. I do not have any objects near the top nav buttons. The first site went off without a hitch
    <www.serenitycustompools.net> the second site began the problem with the last page, the nav buttons would not work. Now this 3rd site, none of the nav buttons at top will work after publish, but will work in app. Anyone else having the same probs? None of my pages have the same names or any punctuation marks, and they are simple one word named pages.
    mini intel   Mac OS X (10.4.9)  

    They all work for me, try clearing your browser cache or using another browser.

  • @font-face not working in FF, but working elsewhere.

    Hey, I've been trying to get @font-face working in Firefox, but it just won't work. I'm hosting the font externally and the way I'm doing it works on other browsers. This is my code:
    <body bgcolor="CA2E28" style="margin-left: 0px; margin-right: 0px;">
    <style type="text/css" media="screen, print">
    @font-face {
    font-family: "Blackout";
    src: url(woff link is here, don't want to put it here though.);
    body { font-family: "Blackout" }
    </style>
    <center>THIS SHOULD BE BLACKOUT.</center>
    </body>

    ''jscher2000 [[#answer-709096|said]]''
    <blockquote>
    Can you check to see whether Firefox is downloading the file? To do that, first open the Web Console in the lower part of the tab below your page using either:
    * Ctrl+Shift+k
    * "3-bar" menu button > Developer > Web Console
    * (menu bar) Tools > Web Developer > Web Console
    Click the "Network" button/tab along the top of the console and reload the page. Here you can see whether Firefox is requesting the file and, if so, whether it is retrieved.
    If that checks out, then click the Console tab and reload the page and watch for any error messages that might relate to the font. Anything strange?
    If the font is downloading and there are no error messages, use the Inspector tab to look at the body element and see whether the style is there and is being given effect (i.e., no line-through).
    If all that is good, you might double-check your personal settings to make sure you aren't overriding website fonts. Either:
    * "3-bar" menu button (or Edit menu) > Preferences > Content
    Click the Advanced button and make sure you have a checkmark for "Allow pages to choose their own fonts".
    If all of that is good, then... it's a mystery. Have you checked Firefox on other machines or other operating systems?
    ''For reference:'' https://developer.mozilla.org/docs/Web/CSS/@font-face
    </blockquote>
    This message came upon refreshing:
    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <my font like here>. This can be fixed by moving the resource to the same domain or enabling CORS. Blackout_Midnight-webfont.woff
    And this one soon after:
    downloadable font: download failed (font-family: "Blackout" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed
    source: <my font link here>

  • Select query not working in Dev but working in QA and PRD

    Hi All,
    I have a select query with inner join which is not working in the DEV but working in QA and PRD. Anyone has any idea why is it happening, I think it to be a basis issue. Just want to confirm if anyone has any other idea.
    Thanks in advance,
    Barjinder Singh.

    Hi Barjinder Singh,
    In development you can't find the records for the table.
    In testing system only you can test even the program(report).
    If it is the DEV system you can't get the data.
    Go and see into the table wether it has records or not(in DEV system).
    It doesn't has the records in DEV system.
    Regards,
    Balakrishna.N

  • Exchange server not aviable on OSX but works fine on IOS

    Using coorperate Exchange server i suddenly cannot acces my exchange mail leaving the HQ (outside the firewall) on my Macbook air.
    This has worked fine earlier but apperently our company upgraded the firewall or changed the port settings.
    My mail and calender works fine on my iphone and ipad.
    Any sugestions how to install an app or program on my MB Air or to bypass the upgraded security settings?
    Ps. MAC is not a company standard, and I would be very sad to convert to an old Dell computer.
    Thanks.

    Since MAC is not cooperate standard they will not....
    is it possible to use mail the same way as on iPhone (IOS) on my Mac (OSX) ?

  • Motion tween created not works after exporting,but works in TEST MOVIE(ctrl+enter)

    I am using adobe flash cs4 and actionscript3
    my project consists several different layers using classic motion tween option available in flash cs4
    my project works fine when I test the movie using Ctrl+Enter
    but after exporting my animation remains stationary
    If any one knows how to solve this please do reply me. It will be very helpful to me
    Even it is a simple setting please do reply me .
    It is very urgent.
    thank u in advance

    Are you using any ActionScript at all or is it all just motion on the timeline?
    If you're not using any AS then you can try to add a little to force it to play. Just add a new layer at the very top. Click on the first frame (which shoudl be a keyframe - if it's not make it one) and press F9. This will open your Actions window. In the window type "play();" (without the quotes). Not sure if that will work or not but it's worth a try!
    If you are using AS make sure you don't have a stop(); action anywhere that's not being controlled.
    Good luck!

Maybe you are looking for

  • Quick question about using Time Machine on iMac FireWire external

    I have been backing up my MacBook using Time Machine via a USB external hard drive that is connected to my iMac. Now when I look at the Time Machine setting in my MacBook is says that the MacBook NEEDS to be plugged in in order for the next backup to

  • Auth 7, PHP, with SSL

    We are having problems with an Authorware 7 file accessing a php file on a server that is running in an SSL environment (using HTTPs). . The php file runs just fine when accessed directly via a URL http://..../___.php). . When Authorware tries to cal

  • The interface is so big, that I can only see a small section of the screen.

    I installed Photoshop CC 2014 on Windows 8.1 operating system. I inadvertently checked a preference in the 'experimental' I think, that has caused the interface on my 17'' Dell CRT to be so big that I can't navigate around to change the preferences a

  • DBMS_SPACE_ADMIN ASSM

    Hi, Does anyone know to simulate the type of corruption or inconsistency in an ASSM tablespace or segment that would be highlighted by the following procedures? DBMS_SPACE_ADMIN.ASSM_TABLEPSACE_VERIFY DBMS_SPACE_ADMIN.ASSM_SEGMENT_VERIFY I'd like to

  • Metronome BPM Doesn't Line Up

    The metronome on Logic Express 8 is completely off for me. If I import anything at a given tempo, and set the computer metronome to the same tempo, it doesn't line up. For example, I downloaded the Radiohead "Reckoner" remix stems, which listed the B