Compiling and running jsp-code on the fly.

I am intending to use jsp as a report engine. The 'templates' should be jsp-code stored in the db, loaded and executed as if they where inside a plain jsp-file in the application. I cannot write new files on the file system since this is prohibited on the production env - so I would like to compile and execute the jsp-code directly in memory.
Was hoping this could be done with the jee standard stack.
Does anybode know how to to this, if possible?

If you just want to run java applications, you just need the JRE: J2SE 5.0 JRE
If you want to compile java source code, you need the JDK: J2SE 5.0 JDK
It includes also the JRE. Recommended is also the J2SE 5.0 Documentation that contains the javadoc API that describes all the Java classes.
To start develeoping I recommend the Java Tutorial: http://java.sun.com/docs/books/tutorial/

Similar Messages

  • How to compile and deploy JSP code from Unix server command line?

    I am new to JSP technology. We are thinking to modify some of JSP code to meet our need. But I am not sure what I should do after I change JSP code. How can I compile the changed code? How to deploy? How to publish on the web?

    All files are regenerated if changed.
    That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
    Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
    Does this make any sense?
    Adam

  • How to compile and run sample code

    Hi All,
    I'm beginner in Javacard. I just installed javacard dev kit. I have followed the instruction to set up javacard environment (install javacard, install ant, set path)I
    I tried to compile Hello World sample. But I got many error messages. It's because it doesn't recognize javacard.framework. It doesn't recognize javacard API that is used in HelloWorld.java
    I think it's strange since I compile it under JC_HOME and I also have set up the paths (jdk, javacard, and ant).
    Could anyone help me? Is there anything need to set?
    Thanks.
    dpi

    Tried running the build.xml with ant from the sample directory?
    So at the location of build.xml, type "ant".
    Recommend using ant to compile, convert, scriptgen, concat different script files
    together. Save you headache.
    Edited by: kicklee on Aug 16, 2008 4:20 PM

  • Java compilation and running within jsp page

    hi,
    i need of a jsp page that has a textarea in which the java coding are entered and this coding is compiled and executed. The execution result is printed.
    Please guide me.

    I don't think you can invoke java compiler or run time environment at client side (browser). Even if you use applet, i think you will not be able to do it at client side. Moreover, though java virtual machine will be available in your target user's browser, but you should not expect a java compiler in users machine.
    I have seen exam sites where they have added java code compilation and execution ability. To achieve this you can do:
    1. In your JSP page use text area where user can edit java code.
    2. Provide two buttons - 'Compile' and 'Run'.
    3. On click of 'Compile' send the code to server side. In server machine create a file in a temporary location in disk and save the code content received from client.
    4. Invoke 'javac' command (as a separate process) to compile the java class created in step 3. This process will give you error/output back which you can send back to user.
    5. In case of 'Run' you must first invoke above mentioned 'Compile' service and then another service ('Run') to actually run you java class. You can build 'Run' service in similar way.
    Here you challenge would be managing multiple client requests (to compile and run java class) at the same time.
    Code to compile and run java classes:
    import java.io.*;
    * A class to compile and run java classes.
    * @author Mrityunjoy Saha
    public class JavaProcessor{
         public static void main(String[] args){
              // Option 1 to compile and option 2 to run.
              int option=1;
              if(args.length > 0){
                   option=Integer.parseInt(args[0]);
              JavaProcessor p=new JavaProcessor();
              if(option==1){
                   p.compile();
              } else {
                   p.run();
         public void run(){
              String file="FoodTest";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("java", directory, file);
         public void compile(){
              String file="FoodTest.java";
              String directory="C:/Users/mrityunjoy_saha/Documents/Test";     
              executeCommand("javac", directory, file);
         public void executeCommand(String command, String directory, String file){
              try{
                   String[] envp=null;
                   // Make sure that you have done Java setup in your machine.
                   // To test this try invoking javac command in command prompt.
                   Process p=Runtime.getRuntime().exec(command+" "+file,envp,new File(directory));
                   BufferedReader errorStream=new BufferedReader(new InputStreamReader(p.getErrorStream()));
                   String readData="";
                   while((readData=errorStream.readLine())!=null){
                        System.out.println(readData);
                   BufferedReader outStream=new BufferedReader(new InputStreamReader(p.getInputStream()));
                   readData="";
                   while((readData=outStream.readLine())!=null){
                        System.out.println(readData);
              catch(IOException ioe){
                   ioe.printStackTrace();
    }Thanks,
    Mrityunjoy

  • Help:Compiling and running Java Midlets?

    Hello,
    I am a fresh learner in Java.I am finding it very difficult to compile and run Java Midlets on the Computer system.Also,i will like to tranfer the Sourcecodes to a PDA i.e install it on the PDA and have the application walking well.Please help.Thank you.

    You will get all the detailed steps ( have a look at the ff link) to configure the sun wireless toolkit on a PC , midlet compiling, running , uploading to the Palm PDA and testing it on the device. As for the connection, you can use the hot synch cable or a bluetooth hot synch.
    http://developers.sun.com/techtopics/mobility/midp/articles/palm
    Cheers!,
    Birhanu

  • How to Set up the  variables and others to compile and Run Java Programs

    Hello,
    I have just downloaded the jdk1.6.0_07 and jre1.6.0_07 and installed it in C:\Program files\Java in my Windows XP ,So please tell me how to sett up the enviroment variables etc to compile and run Java Programs from Command Prompt.
    thanks

    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
    1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
    2. Click Advanced > Environment Variables.
    3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin

  • 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]

  • How to compile and run package programs in Java

    Hi,
    I want to know how to compile and run the package programs in Java using -d. instead of creating the package folder manually.
    eg:
    package Test;
    class test1
    public void disp()
    //Any code;
    I want to compile this without creating the folder ' Test ' manually. that is if we use -d with javac the Test folder will be created automatically. I need the format of -d
    could anyone please help me.
    Thanks in Advance ,
    Ambika

    My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
    I've given my pgm and the thing I've got when I compiled it.
    Test.java
    package com.cert;
    public class Test
         public void display()
              System.out.println("Hai");
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files
    -cp <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
    Plz help me.
    thanks in advance
    Ambika

  • How to develope, compile  and run soap service

    we want to implement the soap sevice in our concern.So its very diffcult to develope the soap program.I dont know about the soap service.please give me a input about soap and how to develope soap programs.Pls also give some sample programs and how to compile and run those programs.In our concern we are using UNIX operating system.
    Thanking you
    Yours faithfully
    Saran

    You should start by posting questions regarding web services on the correct forum ;)
    Next go to xml.apache.org and read the documentation regarding Apache Axis.
    You could also take a look at the Spring Framework's support for web services.
    You could even take a look at the Sun Web Service tutorials.
    The above resources have plenty of examples and sample code.

  • Compiling and running problems

    Dear Friends:
    I believe I encountered a very difficult situation when I try to run Fortran
    files in Sun Sparc Solaris 8.0.
    I would like to describe it, hopefully someone can give me some suggestions.
    The the files I try to run is fortran 77 files developed originally for VAX
    machine, later on there are Linux and Unix adaptions (but not for Sun
    Solaris). The source code is open source from the link:
    http://www.webmo.net/support/mopac_linux.html. I have compiled and run
    successfully in Redhat 9.0 (means same results as the samples). The linux
    dependency is gcc (or egcs) glibc (or libc) f2c.
    Also it is compatible with SGI IRIX unix system with the dependency MIPSpro Fortran 77 and MIPSpro C as the link http://www.webmo.net/support/mopac_sgi.html. I havenot tried it yet.
    In sun solaris, I have tried g77, but even cannot compiled. With Apogee's
    F77 (www.apogee.com), it can be compiled, but cannot run completely (terminate in the middle
    process, i.e. without the complete output as the samples).
    Could anyone take a time do a analysis and provide me any suggestions?
    thanks a lot,
    Justin

    Justin,
    I downloaded the mopac tarball and compiled it on Sun Solaris using the Sun Studio 10 compiler. The code compiles successfully with only a small change to the included Makefile.
    Change the original unix target as follows:
    unix:
         f77 -w -O -static *.f -o $(EXE)
    becomes
    unix:
         f90 -f77 -w -O *.f -o $(EXE)
    I noticed during the compilation that there were a number of BLAS and LAPACK routines that are being compiled into the application. The Sun Studio compilers include a high performance BLAS/LAPACK library called the Sun Performance Library which provides highly tuned versions of the BLAS/LAPACK routines called by this application. I would be more than happy to help you modify the source and makefile so that you can use these tuned routines and realize increased performance in this application.
    I ran several of the data sets in the examples directory and they appeared to complete successfully. Since none of them run for more than a second or so, it's hard to say whether or not the tuned Performance Library will have a large impact on the performance or not.
    If you are interested, please contact me : [email protected]

  • Compile and run java programs in different directroy

    Hi,
    I often encounter many problems when I run java programs in the different directories. Like
    javac -d dir_name a.java
    java -cp dir_name a
    Something wired often happens, such as, there is not a.java file in some directory, but javac -d dir_name a.java can still work or "java -cp dir_name a" often doesn't work. Moreover, file_name.jar is also a tough problem and solving compiling problems is often time-consuming.
    So I hope to read something about how to compile and run java programs in different directory properly.
    Could you pleae give me a detailed description for that or recommend a book or website?
    Thanks a lot.

    Can you post a small amount of code that does not work, including the directory structure, and the error messages? Some one here can likely explain the problem.

  • How to compile and run a matlab program?

    Hi,
    I have a college matlab code that i want to compile and run and take an output of. Can anyone guide me with this in xcode?
    Neerav

    Hi,
    I already googled it and went through that website before posting here and as you can see the software is paid. And thats exactly why I asked in my original post as to whether there is a way to do it with xcode.
    And the idea that xcode might be of any help too came after some experimentation. I double clicked the .m file and it opened in xcode. So I guess there must be a way to compile and run it too.
    Thanks for you recommendation anyway.
    Neerav Kothari

  • How should I compile and run my jdbc application ?

    I need help about how is the correct way for compile and run my application conecta.java using a driver postgresql-8.3-603.jdbc3.jar for connect to my database under Postgresql 8.1.4, . I have compiled as follow :
    javac -cp postgresql-8.3-603.jdbc3.jar conecta.java
    and I have compiled with sucessful obtaining conecta.class
    but when I try using :
    java conecta
    a message display an error :
    java.lang.ClassNotFoundException: org.postgresql.Driver
    I didn find the cause , I try modifing the classpath onto .bash_profile :
    # User specific environment and startup programs
    JDK_HOME=/usr/local/jdk1.5.0_01
    JAVA_HOME=/usr/local/jdk1.5.0_01
    PATH=$JAVA_HOME/bin:/usr/lib/pgsql/bin:$HOME/bin:$PATH:.
    CLASSPATH=$JAVA_HOME/lib/postgresql-8.3-603.jdbc.jar:$CLASSPATH.
    export PATH CLASSPATH JAVA_HOME JDK_HOME
    unset USERNAME
    but the message is the same . I have downloaded the driver into the same directory where is sited concecta.class and conecta.java . I don't understand why netbeans works fine runnning my application. I will be glad if anybody help to me.
    Thanks

    Miguel231152 wrote:
    I need help about how is the correct way for compile and run my application conecta.java using a driver postgresql-8.3-603.jdbc3.jar for connect to my database under Postgresql 8.1.4, . I have compiled as follow :
    javac -cp postgresql-8.3-603.jdbc3.jar conecta.javaActually, you probably don't need the JAR in the CLASSPATH to compile. You shouldn't refer to PostgreSQL classes in your code, just java.sql interfaces.
    and I have compiled with sucessful obtaining conecta.class
    but when I try using :
    java conectaGotta have the JAR in the CLASSPATH at runtime. That's why you get that exception, and that's always what it means.
    a message display an error :
    java.lang.ClassNotFoundException: org.postgresql.Driver
    I didn find the cause , I try modifing the classpath onto .bash_profile :
    # User specific environment and startup programs
    JDK_HOME=/usr/local/jdk1.5.0_01
    JAVA_HOME=/usr/local/jdk1.5.0_01
    PATH=$JAVA_HOME/bin:/usr/lib/pgsql/bin:$HOME/bin:$PATH:.
    CLASSPATH=$JAVA_HOME/lib/postgresql-8.3-603.jdbc.jar:$CLASSPATH.Useless. Java ignores CLASSPATH environment variable.
    export PATH CLASSPATH JAVA_HOME JDK_HOME
    unset USERNAME
    but the message is the same . I have downloaded the driver into the same directory where is sited concecta.class and conecta.java . I don't understand why netbeans works fine runnning my application. I will be glad if anybody help to me.
    ThanksUse the -classpath option at runtime. That'll fix it.
    %

  • How do I compile and run Java programs on a Mac?

    To clarify my earlier post, I know that you can write java in any text editor but with the PC you compile and run everything through the MS DOS prompt, what is the Mac equivalent?

    See this question :-)
    http://forum.java.sun.com/thread.jsp?forum=54&thread=289574

  • It compiles and runs, but scrollPane doesn't work.

    Bah. Why doesn't my scrollPane work? It compiles and runs but my scrollbars for the text area are nowhere to be found. This is the code I'm using to handle my scrollpane.
    public Display() {
                   setLayout(null);
                   setPreferredSize(new Dimension(270, 300));
                   setSize(270, 300);
                   items = new JTextArea(5, 5);
                   items.setBounds(5, 5, 270, 260); //x,y,width,height
                   items.setEditable(false);
                JScrollPane scrollPane = new JScrollPane(items);
                scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                scrollPane.setVerticalScrollBar(new JScrollBar(Scrollbar.VERTICAL));
                JScrollBar vScrollBar = scrollPane.getVerticalScrollBar();
                vScrollBar.setAutoscrolls(true);
                scrollPane.setVerticalScrollBar(vScrollBar);
                add(scrollPane, BorderLayout.CENTER);
                   add(items);
                   amount = new JTextField(".00");
                   amount.setBounds(5, 275, 266, 25);
                   amount.setHorizontalAlignment(JTextField.RIGHT);
                   amount.setEditable(false);
                   add(amount);
              }I'm also having a problem with this one. Apparently, my I uncomment this, the compiler says "cannot find symbol getImage()" which is odd because I've imported the proper package with this method.
    private ImageIcon icon = new ImageIcon("BKLogo.gif");
              public void paintComponent(Graphics background)
                   background.drawImage(background.getImage(), 0, 0, null);  
                   //setOpaque( false );
                   //super.paintComponent(background);
                   }

    You know what you need to do then: post an SSCCE (Short, Self Contained, Correct (Compilable), Example). For info on what this entails, look at these two sites:
    http://javafaq.mine.nu/lookup?22
    http://www.physci.org/codes/sscce.jsp

Maybe you are looking for