How to register a created font in java 5?

Java 6 provides the registerFont(Font) method in GraphicsEnvironment to register fonts created using Font's createFont(int, InputStream) method. However, I need my application to work using Java 5.
I looked in the Java 6 source code hoping to find the solution. In Java 6, GraphicsEnvironment's registerFont(Font) method calls a static method also entitled registerFont(Font) on the platform class sun.font.FontManager. Based on the code in sun.font.FontManager, I created a class for use in my application which only contains the variables and methods necessary for the registerFont(Font) method.
But It doesnt works.
Hope someone suggests any solution..!!
Thanks,
shri

Ujjal wrote:
Hi All,
Need your help...
I have just started learning Java and JSP.
I was trying to write a simple Shopping Cart program in JSP. I have created a directory under my root context directory. But while I am invoking the JSP, I am getting a error like this:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 18 in the jsp file: /JspSessionCart/build/carts.jspMaybe you should look at that JSP. It's incorrect, obviously.
Look, here's a hint:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mycontext\org\apache\jsp\JspSessionCart\build\carts_jsp.java:66: package sessions does not exist
cart = (sessions.DummyCart) jspxpage_context.getAttribute("cart", PageContext.SESSION_SCOPE);Why isn't this a good enough guide?

Similar Messages

  • How to register created fonts in Java 5?

    Java 6 provides the registerFont(Font) method in GraphicsEnvironment to register fonts created using Font's createFont(int, InputStream) method. However, I need my application to work using Java 5.
    I looked in the Java 6 source code hoping to find the solution. In Java 6, GraphicsEnvironment's registerFont(Font) method calls a static method also entitled registerFont(Font) on the platform class sun.font.FontManager. Based on the code in sun.font.FontManager, I created a class for use in my application which only contains the variables and methods necessary for the registerFont(Font) method.
    There is only one problem: the registerFont(Font) method in sun.font.FontManager relies on the use of a native+ method to derive a Font2D object from the created font. The method is: public static native Font2D getFont2D(Font). Although my program compiles, I get the following error message at runtime:
    Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: getFont2D
         at MyFontManager.getFont2D(Native Method)
         at MyFontManager.registerFont(MyFontManager.java:105)
         at java.lang.Thread.run(Unknown Source)
    How do I derive a Font2D object from a Font object?
    OR
    Using Java 5, how do I register a created font such that I can reference that font via its family name, as in the following lines of code (the Java 6 solution is crossed out)?
    this.simpleAttributeSet = new SimpleAttributeSet();
    try {
    InputStream inputStream = getClass().getResource("fonts/FONT.TTF").openStream();
    Font font = Font.createFont(Font.TRUETYPE_FONT, inputStream).deriveFont(Font.PLAIN, 25);
    inputStream.close();
    GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font);
    MyFontManager.registerFont(font);
    StyleConstants.setFontFamily(this.simpleAttributeSet, font.getFamily());
    } catch (Exception exception) {
    System.err.println(exception);
    }

    Sure.
    My strategy was to create a class for use in my application which would only contain all the variables and methods necessary to execute the registerFont(Font) method in the Java 6 version of sun.font.FontManager. The registerFont(Font) method calls two static, native methods: isCreatedFont and getFont2D. Originally, I made the mistake of including these methods in the class I created. The solution: call these methods on sun.font.FontManager.
    The Java 5 version of sun.font.FontManager fortunately supports getFont2D, but does not support isCreatedFont. However, it is not necessary for my program to determine whether or not the font is a created font. Therefore, I replaced all instances of calls to isCreatedFont with the value true.
    NOTE: The solution works, but my font ended up looking worse than it did using Java 6 and I'm interested in learning why.

  • How to register a dll from the java code

    Hi,
    We can use windows utility Regsv32.exe to register a the components. Is it possible to register the Dll from the java code. If possible please try to provide me the code for the registring the dll.
    Thanks in adavance
    Aswad

    if a try this variant it doesnt work
    static {
            System.loadLibrary("shellExec.dll");
    but in this way it work (without .dll extension)
    static {
            System.loadLibrary("shellExec");
    }

  • How to register own Transport implementation inside java

    Hi,
    My application is running on a shared host where I do not have admin rights.
    I have written my own implementation of the SMTP Transport.
    In order to be able to use it, it appears that I have to register it in
    $JAVA_HOME/jre/lib/javamail.providers
    with the line
    protocol=smtp_my; type=transport; class=com.my.app.mail.SMTPTransportMy; vendor=Me;
    this, is however not possible in all environments I want to run my app.
    Is there a way to do it inside java similar to the MailcapCommandMap approach?
    Any hints would be highly appreciated!
    Ralf
    https://www.privasphere.com/e.do?email=hauser(at)acm.org
    Just for reference how it is done there!
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap
    .getDefaultCommandMap();
    mc .addMailcap("text/enriched;;x-java-content-handler=com.sun.mail.handlers.text_plain");
    //.addMailcap("text/*;;x-java-content-handler=com.sun.mail.handlers.text_plain");
    CommandMap.setDefaultCommandMap(mc);

    I don't understand what you mean by register a bean inside another bean.

  • How can I add new font to java available font list?

    how to edit font.properties file to add new font?
    thanks for any suggest.

    Can you help me, pls?

  • How to register the recipient when create job by function

    I am now use JOB_OPEN , JOB_SUBMIT and JOB_CLOSE to create a job in the program. And need to post the result of the report to the person by email.
    Can you tell me how to register the recipient when create the job.
    ( in sm36, it is easily to do but how to do in coding? )
    regards,
    slam

    Hi
    I think in Back ground using the above fun modules you can't send a mail to the receipient.
    see the use of the above fun modules;
      IF p_bjob = 'X'.
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT ybrep
                          WITH < sel Screen>
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              strtimmed            = 'X'
            EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              invalid_target       = 8
              OTHERS               = 9.
          IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
      ENDIF.
    Reward points if useful
    Regards
    Anji

  • How to save report in PersonalCategory  after creating it using java panel?

    Hi,
    Anybody knows How to save report in PersonalCategory  after creating it using java panel?
    I dont want to save it in public folder. I want to save report (webi) in user's personal category.
    can anybody send me source code?
    It will help me a lot.
    Thanks in advance
    Amol Mali

    Hi teda,
    i'm assuming that you have seen my post that i did successfuly save report in user's personal category.
    Actually the report is created in webi java panel using RE SDK and  is saved in Report Sample Folder then i'm saving it in user's personal category by following code
    string query = "Select SI_PERSONAL_CATEGORIES From CI_INFOOBJECTS Where "
                         + "SI_INSTANCE=0 And SI_ID=" + reportID;
                    InfoObjects infoObjects = infoStore.Query(query);
                    InfoObject infoObject = infoObjects[1];
                    Webi wreport = (Webi)infoObject;
                    ObjectRelativeIDs personalIDs = wreport.PersonalCategories;
                /personalIDs.Add(Convert.ToInt32(categoryID));
                   infoStore.Commit(infoObjects);
    But the report is presents in the Folder also and in user's personal category also.
    I dont want the report to be in the folder (Report Sample) if i saved it in user's personal category.
    How can i do that?
    any idea.
    Please help me.
    Thanks in advance
    Amol Mali
    Edited by: amol mali on Jan 9, 2009 7:55 PM

  • A friend created 3 accounts on his iPhone 5 but forgot the passwords. He can't reset the password as yahoo address is no longer valid. Erasing the phone doesn't solve the issue. How to register the phone with Apple?

    A computer illiterate friend created 3 accounts on his iPhone 5 but forgot the passwords. He can't reset the password as his yahoo address is no longer valid. Erasing the phone doesn't solve the issue as the Apple server identifies the hardware as registered. How to register the phone with Apple?
    I helped him create a new email address and new iCloud account on my Mac but when we try to register the phone with Apple it says: Maximim accounts limit reached for this device. How can he register the phone? I read different threads and found out that only Apple care can do that. We're in Romania and don't know where to call. Any suggestions on how we fix this?

    When I checked the support site for Romania, you apparently don't have an Apple Care contact center.  You "may" try calling the US Apple care number to verify the account and have the password reset sent to a different email address.  800-694-7466

  • I created a pdf form from a Word doc with 9 pt aerial font formatting; the text on the pdf form is aerial 9 pt, but the fields are formatted in courier 12 pt - How do I reformat the font in the fields??

    I created a pdf form from a Word doc with 9 pt aerial font formatting; the text on the pdf form is aerial 9 pt, but the fields are formatted in courier 12 pt - How do I reformat the font in the fields??

    You can set up a temporary button (or link, bookmark, etc.) and add the following JavaScript action:
    // Mouse Up script for a temporary button (or bookmark, etc.)
    // Change the font and font size for all text fields in this document
    for (var i = 0; i < numFields; i += 1) {
        var f = getField(getNthFieldName(i));
        if (f.type === "text") {
            f.textFont = font.Helv;
            f.textSize = 9;
    It also sets the font size, but you can remove that line if you don't need to do that.

  • Editting PDF documents that were created by a MAC doesn't work because of font incompatability.  How can we get MAC fonts and load in our Adobe Acrobat Pro 9?

    Editting PDF documents that were created by a MAC doesn't work because of font incompatability.  How can we get MAC fonts and load in our Adobe Acrobat Pro 9?

    If it's a Mac font and you're on Windows, you can't. If you are also on a Mac, you'll need to purchase the fonts (fonts are generally non-transferable, like software. One of the reasons pdf exists), install them and try your edits.
    But it's best to edit the original document and create a new pdf when finished.

  • How create indesign using Java Script

    I am new in indesign and want to create indesign application using JavaScript.
    When i use AppleScript to create Indesign Application i use this statement
    tell application "Adobe InDesign CS5.5"
    set myDocument to make document with properties
    end tell
    Indesign Application create sucessfully.
    How create Indesign Application using JavaScript ?
    or what is equivelent statement of ( tell application "Adobe InDesign CS5.5" ) in Java Script.
    There are some java scripting example given on forum or in sdk.These all example start with app.
    when I debug these java script using ExtendScript ToolKit 3.6 It give error on app (undefined app).I think this app ia application object.
    How create  indesign application object  app in javascript ?
    While this script run sucessfully when i put these script in C:\Program Files\Adobe\Adobe InDesign CS5.5\Scripts
    and to run these script use Scripts panel (choose Window > Utilities > Scripts), then double-click the script name in the Scripts panel in indesign application.But In this case first i start indesign application and then choose Window > Utilities > Scripts then double-click the script name in the Scripts panel.
    I want to create Indesign Application (instance) using JavaScript.When I run or (debug) my JavaScript in any javaScript tool like ExtendScript ToolKit 3.6 then Indesign application should start, like in Apple Script.
    Thanks

    Thanks Vamitul for reply
    For example when i run SelectObjects.jsx An InDesign CS5.5 JavaScript in ESTK  then message prompt "Target Adove Indesign CS5.5 is not running. Do you want to lanch." Then on click yes Indesign application start.
    I want to Know how indesign object "app" is created to start Indesign application on click yes.
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/In DesignScripting/InDesign-ScriptingTutorial.pdf
    Like in VB to create indesign object we use CreateObject("InDesign.Application"). In javascript how create object say "app" of InDesign Application.
    For example if  i write
    var myDocument = app.documents.add();
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
    myTextFrame.contents = "Hello World!";
    in a simple text file and save it with .js extention and to open this double click on this  it give error undefined "app".
    Source :Microsoft JScript runtime error
    So how define "app" or create indesign object ?
    Thanks

  • How to create a webservice in NWDI & How to register the webservice in AS?

    Dear all,
    Can you please explain how to create a webservice in NWDI?
    How to Register webservice in NetWeaver Application server?
    Please provide the details and useful links?
    Thanks
    Abdul

    The following link explains how to create webservice.
       a. How to import WSDl into NWDS
       b. How to user webservice proxy in Web application
       c.How to make the component dependency
       d. How to Configure in J2EE visual admin
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0cf9e42-ccb0-2c10-d0a4-f5aa8a79e19a
    Edited by: Abdul Gafar on Nov 13, 2009 8:28 AM

  • How to create reports in java or j2ee???

    I want to know how can we create reports in java or j2ee like we use crystal report in vb or .net.do we use jsp or servlet to generate the reports or is there any other tool to do the same?Members,please,do help me.

    Well, you can use JasperResports (http://www.jasperforge.org/) and Eclipse Birt (http://www.eclipse.org/birt/phoenix/)

  • How to create reports for java programs?

    Hi,
    I have planned to do a project using java,that will help to create reports for java programs. To create reports for java programs i used two options.
    1)Crystal reports
    2)Write the code to produce reports for each java programs
    The second one little cumbersome.SO i planned to develop a software that is compatible for creating java reports.
    I would like to know how i will do the project?Can you help me to made it a successful project.Hope you can help me.
    Expecting your reply
    PreethiRenjith

    Uggg... Crystal reports...
    I would personally write a generic report generator, It would probably be easier than fighting w/
    crystal reports (CR is popular, but painful :) )
    Anyhow, I've written report generators for many different applications. It is one of the simplest projects you
    can take on, and the results make you feel special --
    If your need nicely formated, portable, printable reports, you could have your report generator make PDF files (the format is open, and VERY simple, plus people like pdf files) you can get the pdf spec from adobe or from wotsit.org (the famous wotsit file format archive).
    enjoy!

  • How to create command line java client

    I have a java servlet FileClient.java and am invoking it thru POST method from the html file. How can I create command line java client so that I can execute this class file from windows command prompt.
    e.g. java FileClient <argument>
    TIA

    > .. there's also a "won't work".
    I could post a sample...I know that you can instantiate and call aservlet,
    or even write your own servlet container - butit's
    still a local instance. He can't invoke his remote
    servlet by calling its class on the client like he
    suggested.HttpURLConnection in main.Only if his Servlet has a main method. Which wouldn't really make it a servlet anymore.
    OP said he wants to invoke it from command-line using
    java -cp . TheServletClass
    He said he has a servlet called FileClient. And he can't invoke a servlet directly that way, without building a wrapper that starts it, making it more than a servlet, and it definitely won't execute on the server. That's my whole point. I never wanted to say you can't write a command-line program that invokes a servlet on a remote server. I do it myself after all.
    I guess I should have expressed myself more clearly.

Maybe you are looking for

  • File not getting posted at target directory

    Hi all, I am crearting a simple bypass scenario in which no mapping is involved. I simply have to pick up a file with particular naming convention from the FTP location and write it to other location at the target side with some different naming conv

  • Need help on install OBIEE 11g

    Hi I installed OBIEE11g on windows 2008 However, the last step of OCM fails. Then, I cannot find any service that I need to start or stop got register. So if I install OCM, would it install the service for that? Also it says the work-around is to ins

  • BPEL with TWO data base polling adapters????

    Hi, Can some one tell, Is it possible to have two data base polling adapters in one BPEl process?? What I am trying to do is , simultaneoulsy polling two independent data base tables in one bpel with two receive activities, but it did not work as BPE

  • Package java.nio package does not exists

    I am trying to move some steps in java environment. I am using a Windows98 O.S. I downloaded jdk1.3 for Windows from sun site and installed it in c:\jdk1.3.1_02 I have set path variable as .....;c:\jdk1.3.1_02\bin I am trying to compile a java source

  • Need to have ID in the format, "OSR000001" in a workflow

    Hi All we are having one column, if ID of the item is 1, then "Request ID" which should be in the format "OSR000001" , 6 digits shud be coming always.if the ID is 40 then it shud be "OSR000040".. so that for getting values in that column, i used item