¿Does this will work as an applet?

Hello.
I have this working code on my Dot Matrix printer (in the parallel port):
package print;
import java.io.*;
public class lpt {
   public static void main(String[] argv) {
   try {
      FileOutputStream os = new FileOutputStream("LPT1");
      PrintStream ps = new PrintStream(os);
      String line = "this is a test";
      ps.println(line);
      ps.print("\f");
      ps.close();
   } catch (Exception e) {
      System.out.println("Exception occurred: " + e);
But when i convert it to an applet it seems that doesn't work. I'm using jnlp on my project, i have an old version (without FileOutputStream) using  java.awt.print.* but the result is distorted.
Maybe some part of the code isn't supported by java applets, i made some versions of the code as an applet but it didn't worked.

Well, here's the code:
package print;
import java.applet.Applet;
import java.io.*;
public class lpt extends Applet {
   public void init() {
   try {
     FileOutputStream os = new FileOutputStream("LPT1");
     PrintStream ps = new PrintStream(os);
     String text = "this is a test";
     ps.println(line);
     ps.print("\f");
     ps.close();
   } catch (Exception e) {
     System.out.println("Exception occurred: " + e);
It works well alone, but i need the applet to print tickets and buy/sale comprobants (using deployJava.js)... i changed the init() function to print(String text).
The text parameter will be sent from jQuery.
I was up all night (to get lucky ) and checked the console (sorry, but i'm little lost in java, i left it for php) and this was the error:
java.security.AccessControlException: access denied ("java.io.FilePermission" "LPT1" "write")
i found that all what i need is to add this inside
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() { /* MY CODE HERE */ });
And now is working, sorry about this question (i was working on it 2 weeks but after some coffee and twelve hours without sleep, i solved it.
Thanks for your responde

Similar Messages

  • I just purchased the Apple MB974ZM/B World Travel Adapter Kit for my iphone 5. It says it works for the 4.  Does anyone know if this will work for my iphone 5?

    I just purchased the Apple MB974ZM/B World Travel Adapter Kit for my iphone 5. It says it works for the 4.  Does anyone know if this will work for my iphone 5?

    here is the link to Apples compatibility guide for it.
    http://store.apple.com/us/product/MB974ZM/B/apple-world-travel-adapter-kit

  • I've read a whole bunch of forums about printing from the Ipad2, I think I understand that, but I haven't found anything answering this:  I'm hesitating to buy an Ipad because I can't find an answer if this will work.

    What I want to do:  Set up a (non-gmail...Mobileme or another recommended) dedicated email account on my ipad2 (or ipad3) that does nothing but send e-mails and attachments to my gmail account.  Once sent, I can turn off my Ipad and put it away.  Then I can go to any computer that can open and print out my received gmail and attachments.  (Like, duh, any computer with an internet connection -smile-)
    A year from now, I might try setting this up to go thru google cloud/ cloud print -- do you know if apple is doing anything that willl prevent this?
    For now, just e-mail and attachments, sent to my gmail account from ipad. The ipad account is to use a unique e-mail address, password, username, login.
    Know if this will work?  If a work-around is needed, do you know of one?  I'm real vague about what a 'push' is in e-mail speak.
    Thanks, minimalistme

    Sorry, but I'm a bit more confused (by your examples).
    minimalistme wrote:
    Hi Chris - I'm just trying to be able to get print-outs from my ipad without carrying a special printer around.  Suppose I'm traveling and want to provide a bank statement to verify income: I can ask them ( a landlord, say) to let me print it out and sign it for them.
    This assumes you are using your iPad and they have an AirPrint capable printer. Or you send/email the form to them.
    Or I need to print out a PDF while I'm visiting my nephew - I can fill it out and have him print it out for me.  Or I can fill out that landlord's application blank with my ipad and email it to him.
    What does this have to do with emailing from one of your accounts to another of your accounts?
    Gmail apparently prevents us from sending emails to ourselves.
    You mean from/to the same account?
    If you can access the email, why would you need to resend it to the same account?
    Anyway, its not a privacy issue, but rather a work-around
    Don't understand/know what you are working around...
    Access the email then send to your landlord or nephew and have them print it.
    If they have an AirPrint printer available, you can print it yourself.
    Use their computer to access your email though webmail and print it on their printer.
    Again, I don't understand what forwarding the email to yourself will accomplish.

  • Hard drive caddy - T61 - How does this thing work?

    I have a 200gig hard drive on my T61.  Since my computer has died twice in a year I want to have a cloned hard drive handy to insert and not miss a beat and not fuss with reinstalling everything.
    When I bought the machine I also bouht a hard drive caddy...
    http://shop.lenovo.com/SEUILibrary/controller/e/we​b/LenovoPortal/en_US/catalog.workflow:item.detail?​...
    I bought a SATA 500 gig hard drive and inserted this into the hard drive caddy.
    I inserted the caddy into the CD drive area.
    Now what? 
    When I click on "My Computer" I do not see the drive listed?
    Do I need special software to make a clone of my hard drive on here?   Recommendations?
    I thought Lenovo had one that came with it, but I do not see anything?
    Should "My Computer" see this drive with the caddy?
    All advice greatly appreciated!!

    Good advice, same as the Lenovo Tech support.  Unfortunately it does not see the new drive there either...
    Right clicked My Computer
    Manage
    Disk  Management
    (Only C: drive shows)
    This is the way to initialize drives, a step before cloning apparently to set up a new drive.
    I ordered a SATA to USB cable from Amazon for $28.  Hopefully this will work were yet another Lenovo periferal has failed.
    Very frustrated with Lenovo, definitely my last one.  After buying 3 in a year from Lenovo even with a warranty all I get is attitude from customer service.  One guy told me that backing up was the same as cloning.
    For anyone with the same problem trying to clone, I believe you will need a 3rd party software to make a clone.
    Norton Ghost - $70
    CloneZilla - Free
    1. Get Hard Drive
    2. Connect new hard drive
    3. Initialize new hard drive
    4. Get third party software
    5. Clone

  • I have deleted my photos but have icloud. when i log into icloud it doesnt give me an option to view these photos at all. my photo stream is only showing photos from another iphone in the house. i am unsure if i do a restore from back up if this will work

    I have deleted my photos but have icloud. when i log into icloud it doesnt give me an option to view these photos at all. my photo stream is only showing photos from another iphone in the house. i am unsure if i do a restore from back up if this will work. i really dont want to lose these photos but i am very unsure of what to do to resolve. can anyone please help?
    thank you

    If you had Photo Stream enabled with your iCloud account settings on the iPhone, photos in the Camera Roll should have been transferred to your photo steam automatically when the iPhone was connected to an available wi-fi network.
    Your photo stream is not available when logging in with your iCloud account with a browser on a computer.
    Why were the photos in the Camera Roll deleted?
    Photos/videos in the camera roll are included with your iPhones backup. If your iPhone's backup has not been updated since the photos were deleted from the camera roll, you can try restoring your iPhone from the backup.

  • You guys think this will work?

    Im just wondering if you guys think that this will work on intels.
    http://www.resexcellence.com/news/?p=127

    You need Boot Camp and Windows installed as the ATI utility is .exe (make sure it's the latest .25 version)
    http://www.techpowerup.com/downloads/Tweaking/ATITool
    Tales of the brave/foolhardy souls who've tried it:
    http://forum.onmac.net/showthread.php?s=77142640a51e9bc7608af0bd7dba7bf3&t=767
    Heat is already an issue, this isn't going to help any IMHO

  • Past from 1year am using 4s in India...if we carry this phone to Australia does this phone work...If its does not work Then what is the procedure..???

    Past from 1year am using 4s in India...if we carry this phone to Australia does this phone work...
    If its does not work Then what is the procedure..???

    Call AppleCare and tell them you just want to know if your iPhone is unlocked and if not, who is it locked with. If it is locked contact the cell provider and ask them what their unlock process is and complete it if you qualify.

  • 24 hours after setting the erase button on the Find My iPhone option in iCloud the phone was still not erased. Does this function work in a timely fashion?

    24 hours after setting the erase button on the Find My iPhone option in iCloud the phone was still not erased. Does this function work in a timely fashion?

    No. It functions when connected to the Internet.

  • Anyone know if this will work?

    Hello, everyone I got an idea to do this but do not know if it will work. Ok so I want to hook up my iPod Classic to a external display and external display as a computer screen "Just a computer screen no computer" and i figured out if it would work I would need these Cables/hardware. So check out the links please and tell me if it would work. Thank You
    http://www.bestbuy.com/site/olspage.jsp?skuId=8764483&type=product&id=1203815243 481
    http://www.bestbuy.com/site/olspage.jsp?skuId=8772036&st=ipod+classic&type=produ ct&id=1204332254288
    http://www.amazon.com/NEW-CONVERTER-S-VIDEO-CABLE-ADAPTER/dp/B000S675JU/ref=pdcp_e_1?pf_rd_p=413863501&pf_rd_s=center-41&pf_rd_t=201&pf_rd_i=B000Y7T5UU&pf_rd_ m=ATVPDKIKX0DER&pf_rdr=023N5AMT0KKSF36FV9T0

    bishbashboshxo wrote:
    i was wondering if i was to buy an internet add on with my company would i be able to access the internet and blackberry messenger? 
    You must have THE BlackBerry Data Plan to get the internet browser and BlackBerry Messenger on a BlackBerry. If you buy a WiFi-enbabled model, you will will be able to access the hotspot browser ONLY, no Messenger.
    bishbashboshxo wrote:
    or does anyone know if theres any way of me being able to use blackberry messenger some otherway? 
    You must have THE BlackBerry Data Plan to get BlackBerry Messenger. No other way.
    If your "add-on" includes the BlackBerry features plan, you're cool.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I have an Apple Macbook and will be backing up the entire system to an external hard drive utilizing the Time Machine application. when I am doing this, will the data on the external drive that I am using be erased?

    I have an Apple Macbook and will be backing up the entire system in order to upgrade to a newer OS. I will be using an external hard drive to do this and there is already data on it. To complete the backup, i will be using the Time Machine application. Does this application wipe out all of the existing data on the external hard drive, or will it create a new "folder" for the backup?
    thank you

    No, but as steve359 states you should use a dedicated hard drive for backups. It you need a temporary backup then you can use the drive provided it has sufficient space for all your data on the hard drive.
    When Time Machine finds that the drive has data on it already it may decide to erase the drive before continuing, which is another reason to use a dedicated drive.

  • Panther on B&W 350. Tell me if this will work.

    Well over a year ago, I gave my Mother-In-Law my old G3 350 B&W, rev2 machine after her G4 died. At the time, I could only get it to 10.2.8, (what I assumed to be) mostly because of the lack of RAM. Since then, I've installed more, and it's 576 now.
    I'd like to bump her up to 10.3.9. Here's the rub: She lives about 350 miles away, so it's not a quick hop over to their house. Is it possible to get an ATA drive, put it inside my MDD G4 (or even an external case, temporarily), install 10.3.9 on it, then bring it down there, next time I visit, and swap drives? Or is there going to be an issue with hardware reconciliation? And will I still need more RAM, even though the minimum required is 128?
    Essentially, I don't want to spend my entire visit dealing with a computer, especially one that I had issues with when I had it, because it was a rev1 board at the time; even though I fixed that issue, I still don't want to tempt fate, and would rather just install a whole new hard drive, port over the stuff I need to, like mail, and be done with it.
    Doable?
    MB Pro 2.16, MDD 1.25   Mac OS X (10.3.9)   10.4.8

    Thousands have done it before you, so no reason why you can't. Be sure to do some prior preparation. Be sure you have the retail Panther package and not some OEM discs (gray labels) or Upgrade-only discs. Panther came as three CDs that had black labels with a large gray "X". A fourth disc was the XCode Tools installer.
    Repair the hard drive and permissions. If Disk Utility cannot repair the drive then use Disk Warrior or TechTool Pro. Do not attempt to upgrade a drive that has problems.
    Backup her current system by making a bootable clone to an external hard drive. This will make recovery easier in case of problems. You can clone the drive using the Restore option in Panther's Disk Utility or by using the freeware utility Carbon Copy Cloner.
    Install Panther by doing an Archive and Install:
    How to Perform an Archive and Install
    1. Be sure to use Disk Utility first to repair the disk before performing the Archive and Install.
    Repairing the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger.) After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior (4.0 for Tiger) and/or TechTool Pro (4.5.2 for Tiger) to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. Do not proceed with an Archive and Install if DU reports errors it cannot fix. In that case use Disk Warrior and/or TechTool Pro to repair the hard drive. If neither can repair the drive, then you will have to erase the drive and reinstall from scratch.
    3. Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When you reach the screen to select a destination drive click once on the destination drive then click on the Option button. Select the Archive and Install option. You have an option to preserve users and network preferences. Only select this option if you are sure you have no corrupted files in your user accounts. Otherwise leave this option unchecked. Click on the OK button and continue with the OS X Installation.
    4. Upon completion of the Archive and Install you will have a Previous System Folder in the root directory. You should retain the PSF until you are sure you do not need to manually transfer any items from the PSF to your newly installed system.
    5. After moving any items you want to keep from the PSF you should delete it. You can back it up if you prefer, but you must delete it from the hard drive.
    6. You can now download a Combo Updater directly from Apple's download site to update your new system to the desired version as well as install any security or other updates. You can also do this using Software Update.

  • Does T420 will work with Intel 520 180GB SSD?

    Hi
    Is there any chance I can see my t420 (4236qs6) working well with Intel 520 180GB SSD SATA 3 drive?
    I am wondering because of a spec note for my machine I saw on lenovo site:
    Solid state drive features
    Standard 80GB, 128GB, 160GB solid state drive sizes.
    Thanks,
    Eugene
    Solved!
    Go to Solution.

    Hello ladjack,
    The specs are for the capacity of the SSD.  The ones listed on the support site are only the sizes available from the lenovo shop site.  The SSD you plan on buying will work fine with the computer.  The only thing is that the SSD you have chosen is a SATA 3.0 drive and the computer runs its drive speed at SATA 2.0.  Your SSD will run fine but will be limited to SATA 2.0 speeds. 
    It will work great in the T420.
    Hope this helps,
    Alex
    Was this or another post on the forum helpful? Click the star on the left side of the screen to give kudos! Did someone solve the problem you encountered? Click Solution Provided to let us know!
    What we Do in Life will Echo through Eternity. -Maximus Aurelius

  • HOW DOES THIS FORUM WORK?

    I'd be interested to know how this forum works - are there any moderators who read the posts.  I posted earlier today regarding a problem I have on my printer - it hasn't even been viewed.
    Quite frankly I'm feeling extremely let down by HP recently.  I've always been an HP printer fan but I'm starting to wonder if it really is worth ALL my time and effort - Epson reviews next on th list!!!!

    Cook book techs.
    Follow a logic tree and hope that the questions asked were for the actual problem. The real problem is that words mean things and if we each have our own meaning.
    Freeze--- 5 minutes I see no change? 10 minutes? 2 days later the computer has not done anything?
    Hangs up - - no change in 5 minutes? no change in 10 minutes? no change in 30 seconds? 2 days later the screen is different it turned it's self off.
    hesitates - - no change in 30 seconds, 5 minutes, 10 minutes, 2 tv shows later there is something different.
    I am a patient person. Hesitates no change 30 seconds; hangs 2 tv shows later; and freeze 2 days later. Some one else may react differently 2 seconds for hesitates, 30 seconds hangs, freezes 31 seconds.
    So the cook book teck may ask whats your problem give you 4 answers to choose from. And each of us may give different answers from our unique prospective. Me it was hangs up where the same problem may be a hesitation or a freeze to another. Of course then the teck decides to enter another answer cos she don't think you know what you are talking about....
    C'est la Vie.  And they might be in Corvallis Oregon

  • How does this programme work?

    can someone please explain step by step how this programme workes? The code was developed by ian.f.k
    Attachments:
    graph_with_jpg-bkgd_01052003[1].vi ‏33 KB

    A JPEG file is read from disk and written to a picture indicator (Read JPEG File and Draw Flattened Pixmap). The size of the rectangle (right and bottom items of the cluster) is checked to make sure that it is greater than zero. This is done by converting the cluster to an array and the Less or Equal function creates an array of Booleans for each comparison. The array of comparison results is ANDed together to verify that all elements are not TRUE (each element is not less or equal to zero). If each element is not less than or equal to zero, the size of the picture indicator is set to the same size as the JPEG file. If any element is less than or equal to zero, then the size of the picture indicator is set to a default width of 50 and height of 50.

  • HT4623 Does this really work??

    I want to. Know if this really works cuz all my friends have it

    Work as what?
    Thermo nuclear lance?
    No, not so you'd notice.
    Peter

Maybe you are looking for

  • Java desktop application run problem

    Hi. I have designed java desktop application which includes some libraries (XMLparserV2.jar, Ojdbc6.jar,xdb.jar, Orai18n-mapping,jar) with XML ini file. Then I have done deploy to jar. After it I relocated jar file and XML ini files to separate direc

  • Error in Crystal Reports 9 and Ras 9

    Hi, Hepl please. Server Error in '/GestaoWeb/GestaoWebSeguro' Application. Method not found: Void CrystalDecisions.ReportAppServer.Controllers.ISCRSubreportController.SetDataSource(System.String, System.Object, System.String, System.String).  Descrip

  • Call of duty4 download failed

    I bought call of duty 4 in Store days before when I was in travelling, the connection speed was suck, so today I back home and want to download again, my app store told me that AN ERROR HAS OCCURRED. Whatever I try to sign out and in or restart my ma

  • Package_123

    CREATE OR REPLACE PACKAGE BODY APPS.XXTI_Projects_Budget_Pkg IS PROCEDURE XXTI_Create_budgets(errbuf OUT VARCHAR2, retcode OUT VARCHAR2) IS -- variables needed for API standard parameters l_api_version_number NUMBER := 1.0; l_commit VARCHAR2(1) := 'F

  • Can't use swiftkey keyboard, keeps force closing it.

    When I'm using the SwiftKey keyboard for Android in some forms at a web page, Firefox keeps closing the keyboard. The only way I can get through this is using another keyboard.