How to access the *.java file corresponding to a TypeElement T?

Here is a problem:
How to access the *.java file corresponding to a TypeElement T from a AnnotationProcessor environment?
Let us say the hook method
public boolean process(Set<? extends TypeElement> annos, RoundEnvironment roundEnv)
is invoked with a TypeElement T such that T.getQualifiedname() = "a.b.c.X"
And the problem is how to locate the file that has the *.java source code for a.b.c.X?
That is the file that has the source code for a.b.c.X say "some/path/a/b/c/X.java"?
For simplicity, let us assume that TypeElement T corresponds to a top-level Java class.

Pinaki wrote:
That is not something you as the annotation processor author should be asking about. That is something you the person configuring the javac environment should set up via the -d option or its equivalent.
I strongly recommend using a separate output directory hierarchy.That is the way the current implementation is. The annotation processor takes a -Aout= <some directory path> to write generated output relative to a user-specified location (which defaults to the class output location).That is contrary to the design of the annotation processing facility. The intended use is for that information to be configured via options like "javac -d".
Additionally, IMO it is a serious configuration error to put generated files and input files, presumably tracked under version control, in the same directory. Interesting you said that. We are just running some "field trial" with these things and some users want them to be in the same directory of the original *.java files (especially when their source files are spread across many roots) .
Who knows what the user wants?The user does and the user is free to (mis)configure their environment however they like ;-) However, that is the user's option and the user has control of this via the javac command line. The annotation processor is not the proper place to configure this setting; see slide 7 of http://blogs.sun.com/darcy/resource/J1_2006-BOF-0606.pdf for some thoughts on different roles in annotation processing.
presumably tracked under version control, in the same directory.version control is another 'usability issues' that we are trying to get our heads around with this stuff. "To check-in or not?" - that seems to be the question. When presented these facilities without any cue, "the users" were divided -- some wanted them to be checked-in, some did not. The context where these generated files being used -- there exists some rationale to check them in a version control system.The right answer depends on the circumstances, but IMO generally generated files should not be checked in under version control, especially if they are derived from other source files. Checking in generated files of this nature just creates the opportunity for them to get out of date with the originating files.

Similar Messages

  • How to access the java stack table "xi_af_msg" from the ABAP engine.

    Hello Guys,
    How to access the java stack table "xi_af_msg" from the ABAP engine.
    I need to access this table.

    These 3 are the tables that are for XI Adapter in ABAP Stack.
    SWFRXICNT
    SWFRXIHDR
    SWFRXIPRC
    You can also try the following tables.
    SXMSAEADPMOD                   XI: Adapter and Module Information
    SXMSAEADPMODCHN                XI: Adapter Module Chains
    SXMSAEAGG                      XI: Adapter Runtime Data (Aggregated)
    SXMSAERAW                      XI: Adapter Runtime Data (Raw Data)
    Cheers,
    Sarath.
    Award if helpful.

  • How to make the java files compile for a project created outside of Eclipse

    Hi^^,
    I have created a project outside of Eclipse. It has the following folders
    1. config
    2. source
    3. WEB-INF
    I want to execute the project on remote server. Will it compile automatically creating a new folder for .class files corresponding to the source folder or do i need to include a build.xml to enable the project to create a new folder for .class files. Also pls tell me how do I write this build.xml
    Please advise.

    Hi^^,
    Actually I have created a project without using eclipse.
    My source files are inside WEB-INF/source
    Now I want to compile the files using build.xml so that I can create class files. I am using the following build.xml
    <project name="jsp" default="all" basedir="./">
      <property environment="env"/>
      <property file="ArmorJSP.properties"/>
      <!-- set global properties for this build -->
      <property name="source" value="."/>
      <target name="all" depends="copy, jspc, testservlet"/>
      <!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
        APP and places the compiled jsp classes into it -->
      <target name="jspc">
        <!-- Run ejbc to create the deployable jar file -->
        <java classname="weblogic.jspc" fork="yes">
          <arg line="-webapp ${APPLICATION_HOME} -compileAll -d ${APPLICATION_WEB_CLASSES} ${source}/*.jsp"/>
          <classpath>
            <pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
          </classpath>
        </java>
      </target>
      <!-- Creates jsp_servlet directory under WEB-INF\classes of the Examples Web
        APP and places the compiled Servlets classes into it -->
      <target name="testservlet">
        <!-- Run ejbc to create the deployable jar file -->
        <javac destdir="${APPLICATION_WEB_CLASSES}" srcdir="${source}" includes="*.java">
          <classpath>
            <pathelement path="${WL_HOME}/lib/weblogic_sp.jar;${WL_HOME}/lib/weblogic.jar;${ARMOR_HOME}/ARMORSecurity.jar;${ARMOR_HOME}/ARMORUtil.jar"/>
          </classpath>
        </javac>
      </target>
      <target name="copy">
        <copy todir="${APPLICATION_HOME}">
          <fileset dir="${source}">
            <include name="*.jsp"/>
          </fileset>
        </copy>
      </target>
    </project>I do not know how to compile the project using this build.xml
    The motive of doing all this is to understand how is Eclipse doing the build project step. I simply cannot find any build.xml inside any of my projects created in Eclipse however when right click on the project and choose build project, it compiles excellently. ???
    Edited by: pksingh79 on Nov 24, 2008 1:19 PM

  • How to access the Java plugin certifcate store from a signed applet?

    Is there any easy way I can access the certificates in the Java plugin certificate store?
    I think I can load the C:\Documents and Settings\<login user>\ Application Data\Sun\Java\Deployment\security\trusted.certs into a KeyStore and examine the certificates that way.
    But I just wonder if there is more robust way to do this without loading up an external file since an applet is executed within a Java plugin.
    Thank you :)

    Is there any easy way I can access the certificates in the Java plugin certificate store?
    I think I can load the C:\Documents and Settings\<login user>\ Application Data\Sun\Java\Deployment\security\trusted.certs into a KeyStore and examine the certificates that way.
    But I just wonder if there is more robust way to do this without loading up an external file since an applet is executed within a Java plugin.
    Thank you :)

  • How to access the C# file in server from Lightswitch HTML Client

    Hi,
    In that LightSwitch HTML Application i have some c# file in the server project.How can i access those C# file in the screens (HTML Client project )
    thanks,
    goblalakrishnan s
    gobalakrishnan S

    Hi,
    with implementing Generic File Handlers (.ashx)
    See follow link:
    http://lightswitchhelpwebsite.com/Blog/tabid/61/EntryId/174/Full-Control-LightSwitch-ServerApplicationContext-And-Generic-File-Handlers-And-Ajax-Calls.aspx
    regards
    j.nord

  • How to access the selected file in your desktop

    My project involves a Java program running in the background which is used to copy files that I have selected on the desktop or file explorer.
    I have a slight problem. Suppose i have a file selected on my desktop or on a a windows folder. Is there anyway that I could determine what that selected file is using Java?

    Seems a complex feature, wouldnt be easier if the Java app uses his own file dialog explorer to get the file?

  • How to access the local files (Excelsheet) in bsp application

    Hi sdn,
    I created a bsp application my requirement is if i click the link it should display the excelsheet and if i perform any updations those updations will be modified int that excel sheet so can any one plz help me out in solving this issue.

    Hi,
    I think you shouldn't try to modifiy local files from a server application for security reasons.
    But, let's say you have your reasons.
    In your BSP, you have a link that points to an MS Excel file. Clicking this link will open the file in MS Excel and users will be able to modify and register it (and save the file in another path/name...).
    Another solution would be: create a table form (like ALV?) from the Excel file and save any modifications of the table form into the Excel file. Maybe HTMLB can supports such approach but I don't know HTMLB. I only use HTML and ABAP.
    All I said here is just overview of potential solutions. I'm not sure I exactly understood your need. Perhaps other Experts would have better answer for you.
    But I hope this will help you.
    Good luck!
    Thomas.

  • How to write the java file and number line where execution point is?

    I'd like to log errors encountered by a home made java server to a file.
    To be effective, here is how I'd like to build the string to log, roughly :
    String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
    I doubt so but I'd like to make sure.
    Thanks

    bestam wrote:
    I'd like to log errors encountered by a home made java server to a file.
    To be effective, here is how I'd like to build the string to log, roughly :
    String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
    I doubt so but I'd like to make sure.
    ThanksNot quite sure what you mean here. Are you trying to print out the contents of an actual Java error? If so, Throwable.getStackTrace() or Throwable.printStackTrace() are probably what you want.
    Winston

  • Camera attached with USB - How to access the flash file system?

    OK...this is maddening for someone that is so used to using a Windows file system that can be enumerated on any device, whether a hard disk or attached USB flash device. All I want to do (at this moment) is see the file system on the flash in my camera so I can delete certain images. None of the Leopard utilities seem to be able to access this as a "device". Perhaps this can be done from the terminal with Unix/Linux commands...not something that I want to do.
    Can someone help me?
    Thanks.

    Scott Radloff wrote:
    This has more to do with the camera than OS X. Some cameras use communication protocols that do not play well with the Finder. For these cameras, support is built into iPhoto.
    It is also built into the included Image Capture utility, which is more flexible than iPhoto in some ways for simple downloads. You can preview and select individual pics, and set the folder where the pictures go.
    Terence Devlin wrote:
    Almost all Canon and some Kodak cameras refuse to mount in the File System. It’s a characteristic of the brands.
    In the case of Canon it is lack of support for USB Mass Storage which almost all other brands do. But as stated it is much better and safer to use a card reader instead of the USB cable. A card reader always shows up on the desktop for drag-and-drop.

  • How to run the java file from notepate or jedit

    i hope u will solve my probs

    JEdit has a JCompiler plugin to allow compilation and a Console plugin to allow execution.

  • Access generated JAVA files in JDev10g

    Is there a way to access the JAVA files that are generated when a view object or an entity object are created? For example, the file ARandomViewViewImpl.java.
    It was very easy in JDev 9i, but know a can't find the way to do it. Is there a way to do it, if not, will there be a way to do it in the production version?
    Thanks
    J�r�

    Click on the ViewObject in the Navigator, then in the structure pane you'll see the java files associated with it. You may then open it from the structure pane.
    Hope this helps,
    Rob
    Team JDev

  • How To Access a jar file present outside the war file through a jnlp

    Aoa
    I m new to this forum
    I m having problem with my jnlp file
    i want to know is there any way to access a jar file through jnlp.The problem is that my jnlp file is present in the war file
    and i want to know how to acess a jar file through this jnlp.The scenerio is as below
    I m using ear file on jboss.Its hirerchy is as
    -PAN-war.war
    -launch.jnlp
    -PAN-app-client.jar
    my jnlp file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/" href="PAN/launch.jnlp">
    <information>
    <title>PanEmirates</title>
    <vendor>M Fazal Ur Rehman</vendor>
    <description>PanEmirates</description>
    <description kind="short">PanEmirates</description>
    <homepage href=""/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="PAN-app-client.jar" download="eager"/>
    <jar href="lib/javafxrt.jar" main="true" download="eager" />
    <jar href="lib/Filters.jar" download="eager"/>
    <jar href="lib/javafx-netbeans-fxuserlib.jar" download="eager"/>
    <jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
    </resources>
    <application-desc main-class="net.java.javafx.FXShell">
    <argument>pan.Main</argument>
    </application-desc>
    </jnlp>
    when i run launch.jnlp file it says unable to download resource http://localhost:8080/PAN/PAN-app-client.jar
    how to access this jar file
    Any help or comment would be highly appreciated
    Regards
    M Fazal Ur Rehman

    Excellent question. I don't see any client-jar in your EAR file structure. So I am assuming you are writing a separate client application which will talk to the ejbs deployed as part of this EAR. You need to do the following:
    Write another EAR file with the following structure:
    ear:
    META-INF/application.xml
    util.jar
    client.jar
    client.jar should have a META-INF/MANIFEST.MF and that should contain Class-Path:util.jar and value for Main-Class attribute.
    Now deploy this new ear to your application server and execute it using Application Client Container that comes with your app server.
    If you don't want to write another EAR file, then bundle th client.jar in your original EAR file.
    Points to note are:
    you have to repackage util.jar again inside this ear file.
    For portability reason, you should use Class-Path manifest entry in client.jar. Refer to http://java.sun.com/j2ee/verified/packaging.html and J2EE platform spec section #8.2.
    Hope this helps,
    Sahoo

  • How to access the database jar file using the derby 10.2.1.6 database ?

    Hi,
    How to access the database jar file using the derby 10.2.1.6 database ?
    I have used like below. And i am getting the following the error:
    "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)"
    My context.xml file looks like this:
    <Context crossContext="true">
    <Resource name="jdbc/derby" auth="Container"
    type="javax.sql.DataSource" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    url="jdbc:derby:jar(\CalypsoDemo\database.jar)samples"
    username="xxx" password="xxx" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </Context>
    What could be the reason.?
    Any suggestions will be appriciated.
    Thanks in Advance,
    Gana.

    ya, I have restarted. Can you please tell me whether the path which i am giving is right or not in the context file?
    Thanks,
    Gana.

  • How to read the java class file to convert it in java.

    hello all,
    i m developing the java application which generated the java code from the java 'class file' .
    Can anybody please help me, Is any java support for reading the class file? or how to know the class file format?
    I know the application javad, jad, javap which is doing the same thing.
    thanks for reply,
    - Jayd

    do you mean decompiling? there are tons of java decompilers available out there, what exactly are you trying to do here?

  • I have converted a pdf to word. How can I access the Word file from my online account?

    I have converted a pdf to word. How can I access the Word file from my online account? When it says 'download the converted file' I choose a location on my PC and click, but nothing happens. It seems that it can only save the converted file to my online account. I went to my online account but I see no way to look for the file

    Hey Fabrizio,
    You might need to sign up at "https://cloud.acrobat.com/exportpdf" using your Adobe ID credentials to convert your PDF file to Word.
    Do you get the 'download' prompt?
    Also, you can find the converted files by clicking at the 'Files' tab. 
    Please try the same using a different browser and check.
    Hope to hear from you.
    Regards,
    Anubha

Maybe you are looking for