Bytecode generation

Hi,
Does exists any API for bytecode generation? I read internal API for proxy objects generation and I like it. But that was specific API. Generally speaking I want to create a proxy object for some abstract class (java.awt.Graphics, etc).

Yes, but generating and compiling is made through file system and it isn\t very good.
I\ve already seeked solution for this problem in tools.jar in package com.sun.tools.javac.v8.code. But client must have whole JDK, not only JRE and it is not very good too. Of course, I can try redistribute separately, but it is about 4.8Mb - too much!

Similar Messages

  • Java bytecode generation

    I am a student and am doing a project on converting java syntax which is in english into my own language which is urdu. the problem is that i am not able to read a single word from java class file inorder to get the specified bytecode. please provide me guidance.

    My interpretation of your question, is that you want to extract the constant strings out of a class file, translate them from English to Urdu, and rewrite the class file ?
    Basically, localisation, without the source code ?
    Here's a link to the detailled format of the class file format.
    http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80961
    You probably only need to know how to read the constant pool.
    It stores all the constant strings in a class file.
    You won't need to touch the byte code itself.
    ( The byte code is the actual instructions stored in a code tag within the method attribute )
    So, in theory, you could read in the constant pool, translate the strings and write out the translated string to a new classfile.
    ( has to be same name, but in a different directory )
    It would require at least intermediate Java skills though.
    regards,
    Owen

  • Just upgraded to jdk1.4 from 1.2 do I need to recompile all my class files?

    Just upgraded to jdk1.4 from 1.2 do I need to recompile all my class files?
    They run fine, but is there any benefit of recompiling all my class files?

    Nope. AFAIK you would experience exactly zero benefits from just recompiling the code. All that would do is regenerate the bytecode within the .class file(s), and as far as I know, the class file specification did not change. I am not aware of any modifications to the bytecode generation process in the 1.4 release that constitute actual changes in what's generated (for example, generating more efficient or optimized bytecode).
    (any other respondents feel free to correct me on this, as I admittedly spend very little of my time down at the bytecode and classfile level)
    -dSn

  • How to compile a java class via SQL?

    Hello,
    What is the pl/sql command-line syntax for compiling a java class uploaded to the database?
    I'm looking for a command i can use to compile some java code manually similar to:
    ALTER TRIGGER SCHEMA.TRG_MYTRIGGER COMPILE;
    Thanks

    could try dynamic code generation, cglib, asm, eg
    http://68.142.231.85/myresults/mycache?u=http%3A%2F%2F
    www2.sys-con.com%2FITSG%2Fvirtualcd%2FJava%2Farchives%
    2F0702%2Frichards&docid=FToU9dUOIw4HRHa%2F26Zi5Q&.intl
    =us&.done=http%3A%2F%2Fmyweb.yahoo.com%2Fmyweb%3Fei%3D
    UTF-8%26tag%3Dcode%2Bgenerationhmmmm, yes, bytecode generation is so much simpler, isn't it :-)

  • Fields initialization : initializers vs constructors

    I've just come to thought that I might be doing the wrong thing using initializers instead of initializing fields in the constructor. Of cause I'm speaking of DPL..
    I'm used to do something like this:
    @Persistent
    class Compound
       private final Map<Integer, Integer> elements = new HashMap<Integer, Integer>();
       private Compound() {} //dummy private default constructor to be used by BDB
       //actual constructor to be used in the code
       public Compound(int initialValue)
         //some specific initialization...
         //e.g.:
         elements.add(initialValue, initialValue);
    }But while thinking about what will BDB actually do when demarshaling the object instance, I came to idea that it would re-construct the elements map and forget the one I carefully create in the initializer.. So to avoid the useless object instantiation I'd have to initialize the field in constructor like this:
    @Persistent
    class Compound
       private final Map<Integer, Integer> elements;
       //dummy private default constructor to be used by BDB
       private Compound()
         //now I have to assign something to elements field because it's final..
         // or just remove the *final* modifier???
         elements = null;
       //actual constructor to be used in the code
       public Compound(int initialValue)
         elements = new HashMap<Integer, Integer>()
         //some specific initialization...
         //e.g.:
         elements.add(initialValue, initialValue);
    }So my question is: is there any actual difference between the first and second approaches? Or I just thinking the wrong way?..

    Hm.. Yes, I'm pretty sure it's working with JE. I was thinking that reflection allows bypassing the "final" modifier.. Hm.. Quick googling gives this for example: http://stuffthathappens.com/blog/2007/10/13/you-can-change-final-fields/. While reading this article it seems that it's still a bad idea to rely on it..
    Interesting, thanks. I was probably remembering tests I performed on Java 1.4, which does not allow setting final fields, according to one of the comments.
    Yes, relying on this behavior can get you into trouble for two reasons.
    1. If the field happens to be public, JE will not call setAccessible.
    2. If you're using the bytecode annotator, JE does not use reflection to set fields, and the generated code that changes the final field will fail.
    The second issue is insidious, if you use the default reflection mechanism during initial development and then switch to bytecode generation later on.
    I think JE should always throw an exception if the final modifier is set, to guard against this.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Output generation options in InDesign server... generate SWF without bytecode

    Hi,
    We have a server-side InDesign application to generate SWF and JPEG and PDF assets based on a number of IDD files - generated and manually built.
    The issue is, we are trying to move to an iOS supported product where SWF loading is restricted and default, generated SWF from InDesign contains a rake of unused and unwanted ActionScript that has no relevance to our application but which is also likely to complicate or block app approval.
    So... I need to find some options here.
    Can anybody comment on the feasibility of any of the following;
    1. Modify SWF generation to generate _without_ the InDesign ActionScript (we don't need it... we just need the display assets that InDesign creates)
    2. Generate a lossless PNG output on a transparent background (needs to be lossless to support colourisation, needs to be a transparent background as moving from SWF would mean the inability to remove the big white rectangle it always puts in a SWF)
    3. Generate a PDF in a format that can be manipulated to provide us access to individual display assets within an AIR / Flex app
    Thanks in advance,
    G

    PS: Yes, I am aware of the export with and without interactive media settings, but they don't seem to make any difference whatsoever to the SWF as it still includes a rake of unneeded ActionScript (including a wide range of fl.video code for some bizarre reason...).
    I have just found some export as PNG options in InDesign 6, but the server is still on an older version of InDesign (4, I think) do you know when the export as PNG feature was introduced? I have been assured that we can't generate PNG with the current setup... though will dig a bit deeper to check.

  • Problem related to generation of header file

    hi guys,
    I am getting Exception during the generation of the header file,
    using "javah -jni HelloWorld"
    I am refering jni.pdf (java.sun.com/docs/books/jni/download/jni.pdf )
    I have given that error below
    Exception in thread "main" java.io.IOException: can't find class file HelloWorld.class in java.net.URLClassLoader
    {urls=[file:/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/lib/rt.jar],
    parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./],
    parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
    at gnu.classpath.tools.javah.Main.getClass(libgcj-tools.so.8rh)
    at gnu.classpath.tools.javah.Main.run(libgcj-tools.so.8rh)
    at gnu.classpath.tools.javah.Main.main(libgcj-tools.so.8rh)

    ejp wrote:
    GCJ is what you get in Linux (definitely Ubuntu anyway) as the default Java implementation.GCJ isn't a Java implementation at all, as you will discover when you read its documentation attentively. This is because it doesn't pass the Java certification tests. Ergo whatever it may be it isn't Java.
    This is because of the license for Java not being compatible with the Ubuntu distro license.That may be so, or have been so, but it still isn't Java.I guess if you want to label it, it is the GNU Compiler for Java and associated runtimes. As an open source project for when Java licensing was not very compatible with Linux it served a purpose (even if it served it badly).
    The following is from the GCJ web site. I guess they don't really claim to be 100% Java compliant.
    GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.
    Compiled applications are linked with the GCJ runtime, libgcj, which provides the core class libraries, a garbage collector, and a bytecode interpreter. libgcj can dynamically load and interpret class files, resulting in mixed compiled/interpreted applications. It has been merged with GNU Classpath and supports most of the 1.4 libraries plus some 1.5 additions.The first step for me with Linux was always to install the Sun JDK so never really found out how bad it really was :)
    Cheers,
    Shane

  • Solution manager 7.1 sp4 , error @Bytecode adpater installation

    HI All,
        I am facing the below issue while executing the managed system wizard @ Bytecode adapter installation.
    Error @ Managed system
    Failed to create Introscope Agent Connector at: /usr/sap/SMD/SMDA98/SMDAgent/applications.config/com.sap.smd.agent.application.wily/BytecodeAgent/ISAGENT.8.2.3.5-2011-09-13/wily/connectors: - java.io.IOException: Cannot run program "null/bin/java" (in directory "/usr/sap/SMD/SMDA98/SMDAgent/applications.config/com.sap.smd.agent.application.wily/BytecodeAgent/ISAGENT.8.2.3.5-2011-09-13/wily/connectors"): java.io.IOException: error=2, No such file or directory.
    Error @ Diagnostic agent level
    Jun 6, 2014 10:52:31 AM [Thread[Thread-19,5,main]               
    ] Error
    Operation Failed :
    [EXCEPTION]
    com.sap.smdagent.vmmanager.VMManagerException: Failed to get Instance properties - 48161
    at com.sap.smdagent.vmmanager.impl700.VMManager._getSettings(VMManager.java:170)
    at com.sap.smdagent.vmmanager.impl700.VMManager.getSettings(VMManager.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sap.smd.server.exec.asio.AsioInvocationHandler$1.call(AsioInvocationHandler.java:94)
    at com.sap.smd.server.util.concurrent.FutureResult$1.run(FutureResult.java:90)
    at com.sap.smd.server.exec.asio.AsioInvocationHandler$AsioRunner.run(AsioInvocationHandler.java:285)
    at com.sap.smd.server.exec.TaskRunner.run(TaskRunner.java:46)
    at com.sap.smd.server.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:785)
    at java.lang.Thread.run(Thread.java:679)
    Caused by: java.lang.SecurityException: User is not authorized to access Configuration Manager.
    at com.sap.engine.services.configuration.ConfigurationRuntimeInterfaceImpl.checkAuthorization(ConfigurationRuntimeInterfaceImpl.java:62)
    at com.sap.engine.services.configuration.ConfigurationRuntimeInterfaceImpl.getConfigurationContext(ConfigurationRuntimeInterfaceImpl.java:48)
    at sun.reflect.GeneratedMethodAccessor392.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:331)
    at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:159)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:336)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:201)
    1. As per standard note , patch levels are on sap recommended level only.
    2. Created connector manually as per wily documentation , but still no use.
    3. Given the permissions for temp,<SID>cluster etc.. as per sap notes and restarted all the services including sapstartsrv
    4. Assigend SPML roles as suggested by note.
    5. checked java environment and umask  for diagnostic users , everything looks ok.
       Checked couple of notes related to the above issue ,
       1616058 - XSRF possible in SPML Services in AS Java
       1820230 - Byte Code Adapter Installation error in Solution Manager 7.1 Managed System Configuration step Configure Automatically
        1752441 - Introscope Agent Connector generation is done using JDK at: null

    I would like paste few more error lines,
    Jun 9, 2014 6:43:33 AM [Thread[FileSystemService_4cdecd7c,5,main]
    ] Error 
    [WHS] Failed to find javaPath for node 5818350
    [EXCEPTION]
    com.sap.smdagent.vmmanager.VMManagerException: Failed to get Instance properties - 58183
    at com.sap.smdagent.vmmanager.impl700.VMManager._getSettings(VMManager.java:170)
    at com.sap.smdagent.vmmanager.impl700.VMManager.getSettings(VMManager.java:156)
    at sun.reflect.GeneratedMethodAccessor298.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sap.smd.server.exec.asio.AsioInvocationHandler$1.call(AsioInvocationHandler.java:94)
    at com.sap.smd.server.util.concurrent.FutureResult$1.run(FutureResult.java:90)
    at com.sap.smd.server.exec.asio.AsioInvocationHandler$AsioRunner.run(AsioInvocationHandler.java:285)
    at com.sap.smd.server.exec.TaskRunner.run(TaskRunner.java:46)
    at com.sap.smd.server.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:785)
    at java.lang.Thread.run(Thread.java:679)
    Caused by: java.lang.SecurityException: User is not authorized to access Configuration Manager.

  • Java bytecode manipulation (help!)

    I would want to do the following but do not know which tool is able to provide the facilities.
    1) A class with 2 methods with instructions inside e.g. a=b+c; c=2+b; a=5+c;
    2) Randomly choose one of the instructions from each method
    3) Swap the 2 instructions
    4) Create a new class that contains the 2 new methods (with one of their instructions swapped)
    Is objectweb's asm able to achieve this? Or cglib would be easier? I am still researching the feasibility of implementing such cases.
    Thanks in advance!
    Stan

    Hi, I agree it is a good model for building expressions (tree like structure), but in this case there will be alot of instances being created thus consumes alot of memory for genetic programming. This is why I wanted to go into explore the ways of manupilating at the bytecode level (the idea a class is a generation, its methods are the individuals). I wanted to operate without having to consume too much memory. But of course, to do this there is a high trade off in terms of extensibility.
    Nevertheless thanks for the reply, now I had learned it is also possible to do it using Composite.
    Recently I had managed to find out how to swap the instruction codes using asm. Next is to see whether I can group the bytecode instructions as one expression in the source level e.g.
    at source level
    a = 3.5 + b
    at bytecode level
    LDC 3.5
    DLOAD 2
    DADD
    DSTORE 1
    and do the swaping by group. It seems like there is no easy way on this if I still want to enforce to build a lightweight engine.

  • Open vi error for report generation toolkt

    Originally it works fine.
    Now I upgrade to win7, LV9 and office2010.
    To open the old program by 8.6.1, I reinstalled LV 8.6.1 and report generation toolkit.
    But still got the error as attached.
    Any suggestion, thanks.
    Attachments:
    ss.png ‏184 KB

    1. MS Office 2010 is not yet supported, since it's still just a beta. I believe there are couple of changes that Microsoft make, and it could cause a problem.
    2. LabVIEW 8.6.1, and all its toolkit is not supported on Windows 7. This could cause a problkem also.
    In conclusion, you should use LabVIEW 2009, Report Generation Toolkit 2009, Windows 7, and downgrade office to XP, 2003 or 2007.
    More information: http://digital.ni.com/public.nsf/allkb/C9408B9F08D​711E786256F3300701D01

  • 1st Generation iPod Touch No Longer Recognized by Windows 7 PC

    I have a 1st generation iPod Touch (no camera) that can no longer connect to my Windows 7 pc. Plugging in the iPod via USB does not trigger any sort of dialog box in Windows and it doesn't trigger a message saying a device has been connected; the iPod does not show up in either iTunes, Computer, Device Manager or Devices and Printers, either as an Apple mobile device or an unrecognized device, and does not charge when connected to USB (though the wall-charger still works). As far as my computer is concerned this iPod does not exist. I had successfully synced this iPod as recently as one week ago and am ready to pitch the thing in the garbage if I can't find a solution.
    I have the latest version of iTunes as well as the most up-to-date Windows updates. I have already followed all the steps listed here (iOS: Device not recognized in iTunes for Windows) multiple times with no success.
    I also have tried following the instructions listed here (Re: For those Windows users who suddenly cannot see their device in iTunes. Here's a solution that has worked.) but this also hasn't worked since the iPod isn't recognized in the Device Manager and I am not given the option of updating the drivers, manually or otherwise.
    I have uninstalled/re-installed iTunes and all related Apple services multiple times. The Apple Mobile Device Service is functioning normally. iTunes diagnostics indicate that there is no device connected no matter what I do. I have reinstalled my Windows USB drivers and changed the settings on the USB Root Hub in the Windows Device Manager to disable power saving options.
    I have tried connecting the device to another PC which detects and syncs another apple device (iPhone 5) with no issues, and had the exact same result: the computer doesn't even recognize an iPod is connected.
    I can't update the Apple Mobile Device Drivers because the device is not recognized by my machine in any way.
    I even completely reset my iPod and that just left me with a unactivated iPod that still isn't detected.
    I am really unbelievably fed-up with the useless "try checking your USB cable"-style advice that people seem to offer on this forum. If anybody has dealt with this issue and has any serious advice other than "re-install iTunes," it would be much appreciated.

    You said "I am really unbelievably fed-up with the useless "try checking your USB cable"-style"
    - Did you try another cable?
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    Try on another computer

  • Issue with PTO (Paid Time Off) quota generation

    Hi All,
    We have an issue with quota generation of PTO for our employees.
    The issue goes like this:
    We have a Paid time off for employees 5weeks( 200 hrs) for employees who have worked less than 5 years.
    we have  paid time off for employees 6 weeks ( 240 hrs) for employees who have worked more than 5 years.
    we have the following logic that has to go in this config:
    -- Our fiscal year starts on Feb 1st and ends on Jan end or Feb starts which has a full week of working days. ( ex: if 01/31/2012 falls on a Thursday the following Monday which has full 5 day working week would be the end of the fiscal year).
    -- Depending on the working hours of  the employees and the date of joining for the first year ( for new hires)0041 info type the eligibility gets varied and reduced. Ex( employees who joins on start of fiscal year and works 40hrs per week schedules is eligible for 200hrs of PTO. Employees who join in the month of august and works for 35 hrs per week ( i.e mid of fiscal year) would get 91 hrs of PTO.
    I need to put this in the system. I am thinking this could be done with out tweaking PCR.I need help in configuring this in Absence quotas as to what are the things i need change in system config and how do i do it. Please help with some screen shots if possible.  I really need this to get it done ASAP. Looking forward for help.
    Thanks,
    Chowdary.

    We use TM00 schema. Can i call TS15 and TS 12  rules into TM00 acheieve my issue of quota entilements?
    Iam doing this because my businees needs to see if an employee chages his work schedule from 40 to 30 or 20 etc.. the PTO has to vary accordingly.
    As the minimum eligibility is to work for 20 hrs to avail the PTO days. If at any point the employee drops it under 20 he will not be eligible till he work any this >= 20hrs per month so the evaluation has to check periodically to update the quota availability.... I need help plz suggest ...

  • I'm trying to get the ios 4.2.1 on my second generation iPod . Is there a way to install it directly on my iPod touch because my iTunes on my computer is not working. Please help Apple! I need the update. Just give me a link.

    Im trying to get the ios 4.1.2 on my iPod touch 2nd generation. Can I install it directly on my iPod . My iTunes on my computer isn't working!

    you have to have itunes installed but check out http://support.apple.com/kb/ht4623.

  • Report generation toolkit and signal express user step : problem of closing reference in "Stop" event

    Hi all,
    I'm trying to make a package of Vis to easily make Excel reports with Signal Express. I'm working on LabVIEW 8.2.1.
    I'm using the report generation toolkit, so I build a .llb from my project which contains all the hierarchy of my steps, but also the hierarchy of dynamic VIs called.
    I have made some steps, like "Open Workbook", "Write Data", etc.
    My steps run well, excepts one step : "Close Workbook".
    If my "Close Workbook" step is firing on "Run" Signal Express event, I have no error, so my reference is properly closed.
    But if my "Close Workbook" step is firing on "Stop" Signal Express event, I have an error "1", from "Generate Report Objectrepository.vi".
    I feel that I'm trying to use a reference which has been killed in the "Stop" step...
    I would like to know what exactly do Signal Express on "Stop" event and why my close function does'nt run well.
    Thanks,
    Callahan

    Hi Callahan,
    SignalExpress (SE for short) does the following on the Stop event:
    1. Takes the list of parameters that SE found on your VI's connector pane, and sets the values that the user set from the "Run LabVIEW VI" configuration page, if any.
    2. Then tells the VI that SE is running the Stop event by setting the Enum found on your VI's front panel. This in turn should produce some boolean values telling your VI to execute the Stop case.
    3. The VI is then run, with those values and states.
    4. SE checks to see if any errors where returned.
    5. Since this is the Stop event, SE releases the reference to the VI which it possesses.
    Questions for you would be, is the reference to your Workbook linked to a control on your connector pane, or held in a uninitialized Shift Register. If it's held in a Shift Register, SE would not be aware of it, and would not be able to affect that reference.
    Hope that helps. Feel free to post your LLB if it doesn't.
    Phil

  • Report Generation: New Report.vi

    Running applicaion in development mode works fine.
    After compiling however I get Error 7: Open VI Reference in New Report.vi
    Why am I getting this error?

    Has the version of Office on your machine changed since you installed the Report Generation Toolkit?  The VIs will become broken if the ActiveX interface changes, and this can happen when the Office version changes.  I recommend uninstalling and reinstalling the toolkit.  Also, what version of Report Generation Toolkit are you using?  The latest version is 1.1.1.
    -D
    P.S. - I'm going to respond to your other thread that you started with a link to this one.  Instead of creating multiple messages on the same question, just wait for a response to your initial thread.
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

Maybe you are looking for

  • Is this good? (RAM test)

    sandra screen: i can't compare it as you can see, i get N/A :( don't know why, but maybe someone else can tell me how im doing for an Nforce2 system i would like to know how this is compared with a Intel Pentium 4 system.

  • 10.4.6 update question(s)

    I've read so much negative stuff about this update, not only here but elsewhere on the internet, that I'm reluctant to even go there. It doesn't help that there are so many conflicting bits of advice on prepping for the update, which updater to apply

  • Project Server (SharePoint) - Database Collation question.

    Hi, I have been looking at the performance of our SharePoint database server and one of its uses is Project Server. Our databases are set as follows Project Server Databases (Latin1_General_CI_AS) SharePoint Server Content Databases (Latin1_General_C

  • Fail when creating routing through bapi.

    what are the mandatrory steps to create routing using bapi fm ( bapi_routing_create )? when i create routing using bapi it is showing the routing is created succesfull  but it is not updating in the standard table plko .

  • How to insert a field in Structure

    hi, i have a Structure which is been used in SMARTFORM and SCREEN PAINTER.The problem which i'm facing is that,if i want to add a field gaves me this error. Structure change at field level (convert table NAME OF TABLE). Thanks.