Compile and call the class during the runtime

Hi guys,
I am struggling with a project, which allow user to modify the behavior of the program.
To do this, my Java code must be able to compile the Java code (*.java) and call the class from the code during the runtime.
Here are my code:
com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main();
String[] options = new String[] {"d:\\javaExternal\\RunTimeCompilation.java"};
System.out.println(Main.compile(options));This allows me to compile the .java file into .class file. However, I can't find the way to access/use the .class file.
Do you guys have solution for this?
Thanks a lot.

You will also need to investigate class unloading and proxies since presumably they can modify the file and compile it again.
Might note that in general this seldom works for business solutions. It seems like allowing the users to add their own functionality would be a good idea so the programmers don't have to keep doing it. But the reality is that then the users must become programmers. And often must be pretty good at it as well since they must not only know the programming language but also the framework too. The second problem is that it also becomes a maintenance nightmare for the real developers to upgrade the existing system.

Similar Messages

  • After the upgrade to 10.10.3 Foto doesn't run and call the error of the plugin PhotoFoundation

    after the upgrade to 10.10.3 Foto doesn't run and call the error of the plugin PhotoFoundation

    Try opening iTunes while holding down the option key. When you get a dialog box with "create a new library" or "choose a library", select the choose option and navigate to the library on your external HD.
    BTW: If your external HD is not powered on and mounted before opening itunes, iTunes will create a new blank library.

  • How to compile and run the servelt

    how to the compile and run the servlet programmes and how should i deploy them
    and is there any site for the tomcat server free download

    your first question is too general. you'll need a tutorial a Hello World on a servlet...google it.
    for the second one go to [http://tomcat.apache.org]

  • Somehow ejbCreate method of an Entity EJB is not inserting a record into the database. I'm using BMP and calling the Entity bean method from a servlet. I'm using NAS 4.0 sp5 on Win 2k.

    Also if I call the insert query from within the servlet it works fine. I have disabled global transactions. Am I missing something out ? Please
    any help would be greatly appreciated.

    May be your servlet is not able to lookup the EJB. You can use some print statements and see whether lookup ok or not.
    Just a guess.
    Plese get back, if any queries.
    Thanks,
    Rakesh.

  • We want to deploy Servlet/JSP in JServ and call the EJB's deployed in iPlanet App Server 6.0 SP2. How do we make the getInitialContext Call be able to access the EJB's.

    Additionally what configurations do we need to make sure we have on JServ (Third party Servlet container) to make sure that the iPlanet EJB's can be accessed.

    Let me preface my instructions with the comment that this isn't a good idea. Although the J2EE specification allows you seperate your web container from your EJB container, in practical deployments it is a bad idea. The overhead of doing RMI/IIOP calls to an external container as opposed to making inter-JVM calls means that you can expect roughly an order of magnitude less performance than if you colocate your web and EJB containers. (This is why all EJB containers are also web containers, or at least have the provision to install themselves in the same JVM as a web container.)
    That said, if you do not have the option to move the servlets to iAS, you can access EJB's in iAS from JServ the same way that you would from any remote client. Take a look at the following information for more detail:
    Chapter 9 of the developer's guide ( this shows you what changes you need to make to the remote JVM (at JServ) and in the EJB's that you are exposing).
    The RMI/IIOP sample application. This gives you an example of how to access EJB's from outside the container.
    (To answer your direct question, the following code will get the initial context. But if you don't take all of the other configuration steps, this code won't work:
    env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url", "iiop://" + host + ":"+port);
    Context initial = new InitialContext(env);
    I'd also suggest that you approach the task with the following approach. (Assuming that I haven't managed to convince you that this is a really bad idea.)
    1. Get your EJB's working on iAS. Test them with servlet harnesses running on iAS.
    2. Get your servlets working on JServ, if they aren't already.
    3. Create a simple standalone Java application as a test harness for EJB's. Follow the RMI/IIOP instructions until you get this test harness working.
    4. Create a simple servlet test harness in JServ to access your EJb's. Follow the JVM setup instrucitons until you get this working.
    5. Actually integrate the EJB's with your production application.
    I say this because there are about five trillion things that can go wrong in this process. Although the troubleshooting steps in the docs are helpful, I find that it helps to get one thing working at a time. It's very frustrating to spend a day trying to resolve JNDI issues only to find out that you have your CXS configured improperly.

  • Compiling and installing the AUR Blacs-mpi package

    I'm trying to install blacs-mpi (dependance for mumps) and have run into the following issue:
    make[1]: Leaving directory `/usr/local/src/blacs-mpi/src/BLACS/TESTING'
    libblacs.a(BI_BlacsErr.o): In function `BI_BlacsErr':
    BI_BlacsErr.c:(.text+0x138): undefined reference to `__stack_chk_fail_local'
    libblacs.a(BI_BlacsWarn.o): In function `BI_BlacsWarn':
    BI_BlacsWarn.c:(.text+0x128): undefined reference to `__stack_chk_fail_local'
    ==> ERROR: A failure occurred in build().
    Aborting...
    If my understanding is correct, this is a run-time stack overflow verification error and is possibly occurring because blacs-mpi is pointing to some non-existent library. However, I have no idea what library this could be (or if I'm right).
    Can anyone point me in the right direction?
    Thanks!
    Link to AUR package: https://aur.archlinux.org/packages/blacs-mpi/

    MoonSwan wrote:I have a desktop system and a netbook that I would like to have hibernating when they aren't being used.  The wiki outlined roughly how to accomplish this with this page:  https://wiki.archlinux.org/index.php/Tuxonice
    I downloaded from the AUR the kernel26-ice 2.6.38-4 to compile and install.
    Hm... netbook.
    If you don't mind trying bfs and bfq too, then you could give the pf-kernel that is mentioned in the wiki too a try:
    http://aur.archlinux.org/packages.php?ID=50956
    It has a repository here:
    [pfkernel]
    Server = http://dl.dropbox.com/u/11734958/$arch
    and a thread: https://bbs.archlinux.org/viewtopic.php?id=103462
    I'm not quite sure how netbook performance is affected by BFS...
    It has the bonus to already be based on 3.0.
    Last edited by Cdh (2011-07-28 20:35:50)

  • Putting code to my Jsf and Jsff pages and calling Java class

    I want guidance on how to write simple code on adf pages
    1. I have adf pages (.jsf and .jsff) where I have input text fields and command buttons, I want to put custom code on the command button such that when you click on any of the buttons at runtime, the code will be executed.
    2. In my application, I have a java class which I have written, I need to click on any of the buttons at runtime, the application will call the java class and execute the class. Essentially, taking parameters from my adf page(s) (.jsf and .jsff) to the java class and also returning parameters after execution.

    The version of my Jdev. is 11.1.2.3.0
    Which docs?.... I will be grateful if you can point to the particular doc fro me.
    1) Can you pls tell me in one of few sentences how to add method and set the actionListener property.
    2) in question number 2, I am totally lost... Let me explain my self again to clarify the situation. In my adf page, I have a button and three input texts,my purpose is that at runtime, when a user click on the button, the values in the first two input texts will be passed to the java class as parameters, it is expected to use these parameters to process some form of calculations and return a value which I will place on the  third input field.

  • Compiling and putting java classes in database schema

    hi..good evening to all...
    I have total 7 java classes which i have to compile and put in the database schema. those 7 classes are interdependent on each other thats why there is a particular order of execution.
    i want to compile and put them in the schema thorugh the command line.
    i have tried doing this one by one by executing the following command in cmd...
    D:\>loadjava -u username/password@sid -v -resolve javaclassname.java
    then its working fine..
    But i have to do this in one time i.e i have to compile and put all the 7 classes in schema by a single command.
    Thats why i have put all the 7 classes one by one in the required order...save the file as 'java_sources.java' and then run the following command...
    D:\>loadjava -u username/password@sid -v -resolve java_sources.java
    but it is not working... :(
    please help...thanks in advance

    Hi,
    It is not required to load one by one class files into the schema. Can create a jar file for all the class files and load the jar file using the '-o' option in loadjava
    eg:
    loadjava -u username/password@sid -v -r -o jar_file_name.jarI hope you might use any IDE to develop the java class files. All the IDE have option to develop jar file if not get oracle JDeveloper for easy option.
    Check the version of jdk used in your oracle server and use appropiate version of Jdeveloepr and compile the classes.
    If your class files use any builtin library jar files those also need to be loaded.
    As thomaso said if pasted with errors can resovle easier
    NB:
    http://download.oracle.com/docs/cd/B10500_01/java.920/a96659/02_load.htm

  • Passing values and calling other classes?

    Hello all.
    I have 2 classes(separate .java files). One is a login class and the other is the actual program. Login class(eventually exe file) should open the other class and pass the login parameters if you know what I mean. Is this possible, or do the 2 classes need to be part of one file?
    Thanks alot
    Milan D

    Login class can be another class in another file
    wht u have to do is to make an instance of login class in the class u want to use that class
    like login lg = new Login();
    and call method of login class
    lg.setUser(username);
    where setUser(String user); is a method of login class
    this way u can pass the parameters to login class
    i hope this might be helpful
    regards
    Moazzam

  • Ios7 drops calls and calls random people during phone conversations

    Is anyone else having this problem.  My phone will mute, call random people, facetime randome people, all while I am trying to talk to the person I called.

    I'm getting this too.
    Random calls even when the phone is locked and in my pocket.
    Got a call from someone in my recent calls list saying I had just rung them.
    My phone was in my pocket and locked, looked at it and sure enough I had rung them for 23seconds.
    Another one is, if the phone drops a call, the other caller calls you back and you end the call and conversation etc, the home screen shows call failure from the previous call, when you unlock the home screen, it tries to automatically dial the number of the dropped call. Whats worse, sometimes it wont allow you to end the call until it has gone through.
    Whats going on at Apple?
    Apple hardware used to be reliable and bug free, recently its just been bug laden, rushed out rubbish with no real thought.
    The fact that IOS7 has only been out a few weeks and we are already at IOS7.03, shows just how badly Apple are testing their products before release.
    What happened to the Apple slogan of - "It just works"???????

  • Gettin the field valus on double clicking and calling the transaction

    Hi
    how to use call transaction after  clicking on a particular line on the output list with the field values of that line ?
    I am using MIR4 transaction .Once the output list is displayed when i double click on any line i have to pass the belnr and the gjahr values of that line to the transaction MIR4 to display the document.
    AT LINE-SELECTION.
       get cursor field s_belnr value gw_final-belnr_mm.
       get cursor field p_gjahr value gw_final-gjahr.
      SET PARAMETER ID:  'BEL' FIELD GW_FINAL-BELNR_MM, 'GJA' FIELD GW_FINAL-GJAHR.
      CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
    I used a code like this . What is the problem ? Can anyone help me ?

    Hi,
    What u can do is while displaying the ouptut list, u can use HIDE statement.
    e.g. LOOP at itab.
    write : itab-belnr,
              itab-gjahr.
    HIDE : itab-belnr, itab-gjahr.
    endloop.
    then when u use AT LINE-SELECTION, u can use:
    AT LINE-SELECTION.
    SET PARAMETER ID: 'BEL' FIELD ITAB-BELNR, 'GJA' FIELD ITAB-GJAHR.
    CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
    It should work.
    Regards,
    Himanshu

  • How to create context sensitive help and call the role based help from my Java Project?

    Hello All,
    I am new to Robo Help. I have created a Robo help for my Java Web Applicaion. My application is role base i.e some user's will not see some of the pages of the application. So I want to hide those pages in Robo help as well. I tried creating multiple TOC for different Roles.
    My Question is
    How to call robo Help from my application?(I will be calling using java script. If it is with RoboHelp_CSH.js where can I get that and How to implement it in my project)
    How to implement role based help?
    Thanks,
    Siva.

    I answered that. My point in asking whether it matters was that if it does, then you cannot use content categories and point different users to different categories and not allow them to see the others.
    The alternative, as I said, would be to produce different outputs for each role.
    As it does matter, then using webhelp you will have to use your RoboHelp project to produce a number of outputs, one for each category. Your app would install each webhelp into different folders and when your app determines the user role, you will link to the appropriate help.
    There is another thread running where it has been explained by Willam van Weelden that you can achieve what you want using browser based AIR help. If that form of help can be considered, then the thread is at http://forums.adobe.com/message/4914753?tstart=0#4914753
    Browser based AIR help must be run from a web server. It cannot be installed locally.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How to compile and link the LabView program(G) with some function written in C?

    Before, some employee in our company developed some program which was written in LabView (G). Now we want to add some new function with has already been done in C++. Can we combine them together? how to do it?

    Hi;
    To use external code in LabVIEW, you can create a dynamic link library (.dll) that you can call from LabVIEW or a Code Interface Node (CIN). The instructions on how to make any of those are in National Instruments manual Using External Code in LabVIEW, which is included with LabVIEW, or you can download it from NI website.
    Also, in the knowledge base there is a "External Code for LabVIEW - CIN / DLL - Starting Point" page.
    If, on the contrary, you want to use LabVIEW code on your C application, you can build dll's in LabVIEW. Depending on your version of LabVIEW, you may need Application Builder to do so.
    Of course, you can also use other techniques like, for example, making that your LabVIEW application save the data in a file and then your C++ application read the file and continues from there, or vice versa. You can also use the "System Exec.vi" in LabVIEw to do that, assuming your C code is an executable.
    Regards;
    Enrique
    www.vartortech.com

  • How can i set the dos can compile and excute the jar file?please help?

    How can i set the dos prompt can compile my .java file and execute my jar file.

    Go to where you downloaded your Java SDK. Look around for a button labled "Installation." Click the button. Download the installation instructions. Read them. Then read them again.

  • Saving images on my database and calling the open file dialog

    i want to be able to save image in my database or alternatively save them on a file system. meanwhile i want to allow them choose the name of the image in the folder by using the win_api_dialog.open_file. My platform is win2000. do i need to add any other thing to this like a particular library or just anything. please i need this help urgently.database os is unix ware.

    Hello,
    You can do this without using library. Suppose you have a table with BLOB data type column and one form which has image box to display and store image boxes.
    Now by using READ_IMAGE_FILE read picture file. To write picture to file use WRITE_IMAGE_FILE. and
    if you want to give users open file dialogue box then use GET_FILE_NAME builtin.
    All the best.
    Adinath Kamode

Maybe you are looking for

  • Hi, my "adobe application manager" files are damaged, can't download

    Hi, my "adobe application manager" files are damaged, when I try to download an adobe application it just won't start because of that damaged "adobe application manager", I tried to find how to (re-)download/install "adobe application manager" but wi

  • Can I adjust the video image I receive when making a Skype call?

    I have made my first Skype call and the video image I see on my computer is very dark and I am wondering if there is some way to make adjustments? Do I need to get some specific software for viewing? I don't really understand the whole thing but I su

  • Code EJB : Lesson - 10

    3.     SportsNewsBean DistributeSportsNewsMDB.java import javax.ejb.*; import javax.jms.*; public class DistributeSportsNewsMDB implements MessageDrivenBean,MessageListener protected MessageDrivenContext ctx; String text; public void setMessageDriven

  • Correct JDBC url using IPC protocol

    What is correct url to connect to db with orcl SID using IPC protocol? Couldn't find this in documentation.... jdbc:oracle:oci:@[WHAT GOES HERE?]

  • Diff bw Easy Splitter container and Splitter container..

    hi experts,    Can anyone plz tell me the diff bw Easy Splitter container and Splitter container in ABAP objetcs..