How to compile other java files and run them from my own programs?

I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
Hope you can understand what I mean.
Thank you in advance.

When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
(ajc is the compile command for the java file and aj file.)
Thank you in advance.

Similar Messages

  • How do I process multiple files and turn them from raw to jpeg

    How do I process multiple files and turn them from raw to jpeg. Ive tried and it seems to go through the files but doesnt seem to process them or store them in the selected folder

    Yes that was the first thing I did. Then I used the process multiple files and selected a new folder to put them in and selected use open files and selected to turn them into jpeg. The images flash on the screen like they are being processed, but the folder never appears in library. Is it possible because there are a couple 16 bit files open that this corrupts the task. Do I need to create the folder first. Will elements not create the folder on its own.
    Thanks Vince

  • How to compile a java file with specified jdk version in a program???

    hi,
    if we want to compile a program in another program with a particular
    jdk version as an option, how to do that,plz reply and with example.

    Hi,
    To compile from a program, read this (I've never tried, but I think it
    will work):
    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Compiler.html
    To get the jre version:
    System.getProperty("java.version");
    To get the vm version:
    System.getProperty("java.vm.version");
    Other properties at:
    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html
    Hope it helps,
    ANeto

  • How to compile a java file which is in memory?

    how to compile a java file which is in memory?
    such as:
    String s="class MyClass {....}";
    how to compile the string?
    thx

    come on ...That was a perfectly valid solution.
    Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that.

  • How to compile a java file in J9 for windows mobile 5.0

    I have downloaded J9 for windows mobile 5.0 and need help on how to compile a java file.

    You can compile your source code using J2SE ;)
    may be this is important for you:
    http://awareness.ics.uci.edu/~rsilvafi/pocketPC/index.
    html
    Regards!!!Actually i am using some eSWT related classes also.. so is there any way to compile from the J9 environment using J9 console..

  • How to compile a java file(Servlet) in J2EE v1.3.1

    This is my first time using J2EE instead of J2SE!!HOw to compile a java file in J2ee\bin because there is no javac in j2ee and when i compile in J2se i got
    G:\j2sdk1.4.1_01\bin>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    This mean it doen;t support servlet in J2se!!so how can /what command to compile a servlet java file in j2ee.Thanks

    You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
    For example (using weblogic):
    javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
    HelloServlet.java

  • How to compile a Java file

    Hi All,
    I am extending a seeded CO and when I try to compile it in JDev , it asks for many class files the seeded CO imports.
    I have copied all those imported files to my local system and when I try to compile , it still throws an error that some class files used by the classes imported in seeded CO are missing. Now this goes on and on. ( Seems entire server needs to be on my local system).
    Now I decided to port the custom CO to server and compile it there. Even this seems to be a hard task for me as the javac command is not working on the server. It throws following exception
    Exception in thread "main" java.lang.ClassFormatError: com.sun.tools.javac.main. Main (erroneous method access flags)......................................
    Pls suggest how to compile a java file , as downloading entire server classes is a herculean task for me.
    Thanks,
    Srikanth

    Hi Avajain & D.Ram ,
    Thanks for the reply.
    I have downloaded around 70 dependent class files to local system. Now the CO is getting compiled correctly.
    I am extending a region level controller in Payroll page where in I have to default the salary to a predefined value.
    This field is having a VO attribute to it. Now can I go ahead and set a value to the MessageTextInput or should I extend the VO to replace the desired value in the place of already queried value.
    Thanks,
    Srikanth

  • ItunesU videos not playing in Itunes but play ok if you download to laptop's drive and run them from windows directory

    I'm having a problem playing some ItunesU videos, some play okay, some just show black screen and don't play, others show a still image but then doesn't play when trying to view them from itunes store. The audio files play with no issues.
    I am using windows 7.
    However, if I download the videos that don't play to the laptop's drive and run them from the windows directory they play okay. I don't want to have to download videos to see if they are something I'd like to watch.
    Just for reference, an example of a video that plays okay is by UC Berkeley Math 16A 001, Fall 2011. Another is Introduction to Robotics by MIT.
    An example that just shows blank screen is Stanford's Iphone & Ipad development, Fall 2011, both HD and SD versions.
    While an example of a video that just shows the initial image but doesn't play is Harvard's Statistics 110. If you adjust the time of the video, the video moves to that part of the video but only shows the image at that time, ex. at 13:02, but doesn't play.
    I've tried reinstalling quicktime first, then itunes. I've also tried putting directdraw in safe mode, but the problem videos still won't play.
    Could it be some setting, since it plays when the file is downloaded but won't play straight from itunes store online (ie. pressing the play button beside the video in the itunes list).
    Help pls.

    You might have more luck asking on a general Windows troubleshooting site, but my guess would be an invalid or old audio or CD driver (or firmware in the drive). You might try checking those to make sure you have the correct and most current drivers.

  • How to compile a java file Dynamically !!!!

    Hi all
    The problem is
    I have a dynamically created java file ,and i want to compile that file dynamically itself. The file name is stored in a string,
    I am using ECLIPSE editor..
    How do i compile this java file (which is stored in a string) dynamically?
    Pls help me, already wasted a lot of time,
    Thanks in advance

    In every Tutorial regarding Dynamic Compilation,
    It is told to import javax.tools.*..
    But i cannot find this package
    I am using jdk1.4, is this the reason?
    Actually the following packages are needed fro this
    import javax.tools.DiagnosticCollector;
    import javax.tools.JavaCompiler;
    import javax.tools.JavaFileObject;
    import javax.tools.StandardJavaFileManager;
    import javax.tools.ToolProvider;
    but i cant finad any..!!!
    Please help me

  • How to compile a java file in a java program

    Hi,
    I don't know to compile a java file in a java class.
    Could somebody help me?
    Thanks.

    if ur using windows...
    goto ur directory and then type
    javac FILENAME.java
    and ur done!

  • How to remove a font file and its mapping from XML Publisher Administrator

    Hello,
    I am trying to remove a font file and its mapping from the XML Publisher Administrator. If this is not possible, is there a way to disable it?
    The reason why I am asking this is because we just got a new check printer, and I was able to print just fine. However, the MICR font was not coming up properly on the check, so I went ahead and configured the font with the XML Publisher Administrator. Now my check output is coming up blank after running the XML report publisher program. The only change I did was to upload the MICR font and mapped it.
    My template and rdf report file are working fine in another environment we have, so I know that's not the problem.
    Any help is appreciate it.
    Thanks.

    This is how you do it
    Font
    DELETE FROM xdo_lobs
    where lob_code like '<Font_name>';
    Font Mapping Set
    DELETE FROM xdo_font_mapping_sets_TL
    WHERE mapping_code like '<MAPPING_CODE>'

  • How do I select multiple songs and uncheck them from compilations (itunes 10.5.2)

    So I found to my annoinance that itunes has recently moved much of my music to compilations that shouldn't be there. I tried searching online for how to turn compilations off or select multiple songs and uncheck them from compilations all at once and although I found both answers, they must have only worked for older versions of itunes. I no longer can find the option to turn off compilations under preferences and when I try to select multiple songs at a time then press "Get Info" the "part of a compilation" checkmark is not there. It is only there when one song is highlighted. This is very frustrated. In fact I would venture to say I've never been so angry with Apple. There are 609 songs "stuck" in my freaking compilations! I don't have time nor should I have to take the time to go through every single song right clicking it, pressing "Get info", unchecking "part of compilation" then clicking ok. WAY TOO MUCH TIME! If anyone has any good news on a faster way to do this I'd be VERY THANKFUL!

    This was a life saver! I even started to manually tick the box as well!

  • How to call the css file and its images from our application......

    hai,
    Im uploading a .css file and some images in Apex shared components ,now how to call the css file and images from my Application.... plz tell me detailed.....
    Edited by: anoo on Nov 3, 2008 12:51 AM

    Hi Anoo,
    Sorry, didn't see that you'd started a new thread, so have answered this in 'undefined' is null (or) not an object "
    Andy

  • Can I put apps on an external drive and run them from there?

    I want to know can I put apps downloaded from the Mac App store onto an external hard drive and launch them from there? The storage on my mac is full and I want to put apps onto an external drive to create more space on my mac.

    Bad idea.  See this:
    https://discussions.apple.com/thread/3472949?q=run apps on an external drive
    Ciao.

  • HOW TO INSTALL JDK1.4 ON LINUX PALTFORM AND HOW TO COMPILE A JAVA  FILE

    SIR PLZ KINDLY TELL ME THE PROCDURE OF INSTALL JSDK1.4 ON LINUX .
    1.I HAVE DOWNLOADED IT ONA I HAVE INSTALL IN
    /usr/local
    but
    2: do nt know how set the CALSSPATH and JAVA_HOME(ENV VARIABLES)
    3:HOW TO COMPILE AND RUN THE JAVA FILE(JSP)

    2.
    export JAVA_HOME=/usr/local/jdk1.4.0
    export CLASSPATH=.
    (amending for your set up.)
    Placing these in your /etc/profile file will make them run automatically on log in of a user.
    3.
    You need tomcat, probably, http://jakarta.apache.org.
    Bhav

Maybe you are looking for