"Java file" & "Jsp file" compilation issues in Eclipse

Hi,
Eclipse
Question 1:
I have set the value for preference->java->Installed JREs as : j2re1.4.2_07 not to jdk
When I write a java file, its compiling, how? From where its using "javac" exe file for compilation.
Question 2:
Whereas in prefrence->Tomcat->JVMSettings -> JRE(drop down box) set value as j2re.1.4.2_07
When I write a jsp file as follows
index.jsp
<html>
<body>
<%java.util.Date d = new java.util.Date();%>
Todays date is <%= d.getDate()%> and this jsp page worked!
</body>
</html>
when i try to save this file & strat tomcat I got exception as follows:
Exception:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
Please clear my doubts.
Thanks,
Hari

Try going into your TOMCAT_HOME/conf/web.xml and look for this section:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>WARNING</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
Change the <param-value> for fork from false to true and see if that helps.
Otherwise it's a problem with your JSP.

Similar Messages

  • JSP precompilation and my .java files compilation issues /  building WAR file using ANT

    Hello.
    I am new to working with WAR files and the whole process of it. A little
    background on what we are using. We are using, WLS 6.1 SP3. I am using the
    ant.bat that is supplied in the bin directory of the WLS install.
    I am trying to work with ANT and getting it to build the file. I am making
    progress, but at a point where I am having trouble getting my java code
    files to compile using ant. I am having one issue and looking to do one
    other item.
    1) I would like to precompile the JSPs if possible prior to putting into the
    WAR file. Not sure if this is done or not, but there was a utility when I
    was working with ibm's app server that gave us the ability to do a batch
    complile. Was thinking that maybe a similair concept is possibly here.
    2) Having issue getting ant to compile code properly. In the compile
    section of the build.xml file for ant, I tell it where the source files are,
    and the destionation folder for the compiled class files. I then try to set
    the classpath so that it finds the .jar files that are necessary for my
    source files to complile. But, it won't find them. And not sure how come.
    I may be going about this all wrong, but dont know. Here is the compile
    section of the build.xml I am using:
    <target name="compile" depends="prepare">
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    classpath="$(lib.home)"
    debug="on" optimize="on" deprecation="off"/>
    </target>
    One note, I've tried many different items in the classpath line, which
    don't work. if I do *.jar it fails at complie time, invalid argument. As
    well as if I use *.* and so on. if I list the explicit file names, it still
    doesn't seem to find them.
    I was wondering if anyone could help, if you need anymore information let me
    know, I can send the entire build.xml if necessary. I may be missing
    items, seeing that this is my first try at using ANT.
    Any help is appreciated and thanks in advance. Hopefully not sounding too
    off the wall. Hopefully get some clarification and understanding.
    Thank you.
    Kevin.

    Kevin Price wrote:
    Hello.
    I am new to working with WAR files and the whole process of it. A little
    background on what we are using. We are using, WLS 6.1 SP3. I am using the
    ant.bat that is supplied in the bin directory of the WLS install.
    I am trying to work with ANT and getting it to build the file. I am making
    progress, but at a point where I am having trouble getting my java code
    files to compile using ant. I am having one issue and looking to do one
    other item.
    1) I would like to precompile the JSPs if possible prior to putting into the
    WAR file. Not sure if this is done or not, but there was a utility when I
    was working with ibm's app server that gave us the ability to do a batch
    complile. Was thinking that maybe a similair concept is possibly here.you can use weblogic.jspc
    http://e-docs.bea.com/wls/docs70/jsp/reference.html#57794
    or just set the precompile flag in weblogic.xml
    You can configure WebLogic Server to precompile your JSPs when a Web
    Application is deployed or re-deployed or when WebLogic Server starts up
    by setting the precompile parameter to true in the <jsp-descriptor>
    element of the weblogic.xml deployment descriptor.
    >
    2) Having issue getting ant to compile code properly. In the compile
    section of the build.xml file for ant, I tell it where the source files are,
    and the destionation folder for the compiled class files. I then try to set
    the classpath so that it finds the .jar files that are necessary for my
    source files to complile. But, it won't find them. And not sure how come.
    I may be going about this all wrong, but dont know. Here is the compile
    section of the build.xml I am using:
    <target name="compile" depends="prepare">
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    classpath="$(lib.home)"
    debug="on" optimize="on" deprecation="off"/>
    </target>
    maybe because you are not using curly braces there on lib.home??
    if you do it the way above, you would have to list all your jars
    classpath="$(lib.home)\lib1.jar:$(lib.home)\lib2.jar"
    or you can nest
    <javac srcdir="classes" destdir="${deploy.home}/WEB-INF/classes"
    debug="on" optimize="on" deprecation="off">
         <classpath>
              <fileset dir="${lib.home}" includes="*.jar" />
         </classpath>
    </javac>
    One note, I've tried many different items in the classpath line, which
    don't work. if I do *.jar it fails at complie time, invalid argument. As
    well as if I use *.* and so on. if I list the explicit file names, it still
    doesn't seem to find them.
    I was wondering if anyone could help, if you need anymore information let me
    know, I can send the entire build.xml if necessary. I may be missing
    items, seeing that this is my first try at using ANT.
    Any help is appreciated and thanks in advance. Hopefully not sounding too
    off the wall. Hopefully get some clarification and understanding.
    Thank you.
    Kevin.

  • How to compile Java files using Ant in Eclipse

    Hi All ,
    I would like to compile all Java files using Ant in Eclipse.Since am very new to Ant and Eclipse can someone help me to create a build.xml file and let me know how to compile all the java files.
    For ex , I have placed my java files inside the path C:\HEC\Terab.Initially the Terab folder holds 7 jar files which i had decompiled using JD compiler and placed the unzipped 7 folders (which contains the java files ).Now i have imported the HEC project into Eclipse using New ->Project ->Java Project.after importig it throwed me an error saying missing jar files.again i copied the jar files and placed inside Terab folder with other 7 folder.
    Now How i can compile the java files and convert in to class files.Then after compiling the files i will again need to jar all the 7 folder.
    Please tell me the steps i need to follow.How to write an build.xml file ? where i should keep it ? only one build.xml file is enough or should i write 7 build.xml file for each folder ? Please help me out...
    Thanks & Regards
    Kar1983

    put it another way, what I am trying to do is to compile David Brackeen's ch 18 code from his book. The java sourse files can be downloaded here:
    http://www.brackeen.com/javagamebook/
    my question is that how would I complie all of these file so that I can get the program in ch18src\src\com\brackeen\javagamebook\test\ to run?

  • Where are the .java files compiled from .jsp files stored?

              hi,
              I'm new to weblogic server. When I use Tomcat as the jsp server, it compiles .jsp
              files to .java files and then .class files. So when an error reported I can track
              it in the .java file.
              But what should I do with weblogic? It only saves the .class files in the work
              dir. Or is there a better way to trace errors in jsp files?
              Thanks!
              

    This should give you the information you need to set the keepgenerated flag:
              http://e-docs.bea.com/wls/docs60/jsp/admin.html#53346
              Also, the .java files will be right next to the .class files with are under
              a tmp directory in the /WEB-INF directory under the WEB-INF if it is an open
              directory or in the
              config/mydomain/applications/.wl_temp_do_note_delete/WEB-INF directory if it
              is .war file.
              Sam
              "Raymond" <[email protected]> wrote in message
              news:3b931619$[email protected]..
              >
              > Thanks, but can you tell me more about it? where to set this flag? I'm
              using WLS
              > 6.0sp1.
              >
              > "Sam Pullara" <[email protected]> wrote:
              > >You can turn on the keepgenerated flag if you want to keep the .java
              > >files.
              > >How you do this depends on what version you are using.
              > >
              > >Sam
              > >
              

  • .java files compile but cannot execute

    Hello,-
    I have a small problem in that the compiler can find the .java file (javac javaFile.java), however the execute command (java javaFile) does not work (Exception in thread "main" java.lang.NoClassDefFoundError: javaFile). I'm using Windows Vista and JDK 1.6.0_02. Which one of the environment variables is responsible for file execution?
    Thanks beforehand, Vahagn

    @ smithberry: Now it executes! Thanks for pointing that out and apologies for not seeing the space before the filename. But how come this is at all necessary? Do I have to run all my java programs with this command from now on, including the JUnit TestCase extensions?

  • .java file compiling but not executing in jdk6

    Using javac in jdk6 I can compile a .java file but cant executing the same using java command from my own directory. I can still compile and execute the same file from jdk\bin directory. I am using windows XP Home. While executing the .java file from my own directory, it fires a message: "The Java class could not be loaded. java.lang.UnsupportedClassVersionError: Myfilename (Unsupported major.minor Version 50.0)". i have set path in environment variable as "C:\sun\sdk\jdk\bin" where jdk placed in sun\sdk.
    Please help me to solve the problem

    This isn't information we can give you. You have to set it up based on your system.
    Do you understand how execution paths work? There's a list of filesystem paths, separated by a semicolon or a colon depending on the system, all concatenated into one big string. The entries earlier in the string are looked in first.
    So if your path has this:
    c:\Windows\java;c:\sun\sdk\jdk\bin
    Then if you type "java" from the command line, the Windows one would be executed, not the JDK 6 one.

  • 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

  • Weblogic restart when java files compiled

    when ever i compile java filesi need to restart my weblogic server to effect the compiled classfiles.
    to avoid this what i need to do?
    Do we need to change any properties in xml files or in weblogic administrator

    Make a shortcut to http://dev2dev.bea.com/index.jsp (dev2dev) and http://forums.bea.com/cgi-bin/dnewsweb (Weblogic forums)

  • Forte crashes Win98 when java file compiled

    Have just installed Forte 2.0 in my Win 98, 450 MH P4, 320 MB RAM. Have been using MS Dos command window to compile and run. Can use Forte to edit and save changes to existing programs but when compiled system crashes. PATH point to JAVAC.exe directory. Have set up Project and mounted directory java programs reside in. Need suggestions? Reinstall Forte? Uninstall first? Other? Appreciate e-mail answer as well as forum answer as I am not familar with forum.

    Try uninstalling and reinstalling Forte. Check you have the latest stable release of the JDK and Forte. If all else fails, forget forte, and try another free IDE, to see if you get any similar problems (unlikely).
    Be aware that Forte is not G*d's gift to programmers (IMHO) - think of it more as a curse. You could try JBuilder4 Professional if you are prepared to spend some money. Although not free, the professional version is streets ahead of Forte.

  • JSP pre-compilation issues

    Hi,
    I'm trying to pre-compile one of our web applications using Jasper2 and i'm getting build failures. Our setup is like this,
    In A.jsp
    -- defines a use bean 'test'
    --- includes B.jsp
    In B.jsp
    -- uses the bean 'test' to perform some operations
    The pre-compilation steps fails effectively because b.jsp doesnt know about the use bean 'test'. Is this approach fundamentally wrong or is there any flag in the compiler settings we can use to solve this case. This is a third-party web apps which i'm trying to integrate into our solutions. Any help is appreciated.
    Thanks
    Mustafa

    Hi,
    I'm trying to pre-compile one of our web applications using Jasper2 and i'm getting build failures. Our setup is like this,
    In A.jsp
    -- defines a use bean 'test'
    --- includes B.jsp
    In B.jsp
    -- uses the bean 'test' to perform some operations
    The pre-compilation steps fails effectively because b.jsp doesnt know about the use bean 'test'. Is this approach fundamentally wrong or is there any flag in the compiler settings we can use to solve this case. This is a third-party web apps which i'm trying to integrate into our solutions. Any help is appreciated.
    Thanks
    Mustafa

  • Missing java file via eclipse.please help

    There is a java file missing in my eclipse when i do an update
    via svn.
    the error class the class shows 'Trade cannot be resolved to a type
    How do I import via SVN fo that specific file that is missing?
    I tried doing a fresh update but still its missing?
    please help

    Suresh,
    there are multiple ways to achieve that. If it is a "pure" java application create a java project.
    If you put java files into portal, webservice etc projects, they be compiled with the projects build process.
    To compile a single class you have also the option to configure an entry in the tool section (which points to javac for example) and run the tool, when your file is open (like in Visual Studio).
    -kai

  • How to get .java files in iStore

    Hi,
    I do have .class files in my server.How do i get .java files.
    Do i need to create a .java file in jDevloper ,copy the content of the .class and paste it in jDeveloper and compile on the linux server.
    Thanks,
    Sabitha

              Set the 'keepgenerated' parameter in weblogic.xml to 'true'
              <jsp-descriptor>
              <jsp-param>
              <param-name>
              keepgenerated
              </param-name>
              <param-value>
              true
              </param-value>
              </jsp-param>
              </jsp-descriptor>
              thanks,
              Deepak
              "Chris Cooper" <[email protected]> wrote:
              >Hi,
              >
              >I wanna read the .java file compiled from JSPs in Web applications
              >deployed in Weblogic server, and I know that Weblogic delete them
              >after compiles the JSPs. how to get the java file?
              >
              >TIA
              >
              

  • *Added* code to existing source file, compiled it, and class file shrunk

    Another newbie here. Fortunately, my classpath is ok, so I'm able to compile a .java file.
    I added one line of code (System.out.println) to write the value of a variable to a log. After compiling with javac, I noticed that the resulting [new] class file was smaller than the existing class file. I looked at each of the class files with Textpad. It's gibberish, but I quickly saw that a large block of code was missing in the new class file, even though the size of the source file had been increased.
    There is a difference, however, between how the two class files were created. The existing class file was compiled (along with many others) by exporting an .EAR file from a development environment (WSAD) to the WebSphere Administrator Console. Conversely, I am now compiling the same source file with javac on my machine.
    I suspect that this is the reason why I can add code to a .java file, compile it, and have the resulting class file actually lose code. Even if I am correct, I don't know what to do about it.
    Does anyone have an idea?
    Regards,
    Daniel T.

    Thank you both for your replies. I've read many posts over the past few months, and I know how important it is to provide as much info as possible, when asking a question here. That said, I have another tasty tidbit...
    After replacing the existing (larger) class file with the new (smaller) class file, my application now produces this:
    "*Error 500: LinkageError while defining class*..." [name of class]
    *"...(Unsupported major.minor version 50.0) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader@6bd156d5 Local ClassPath:"*
    ...[the entire classpath]...
    Original exception--- java.lang.UnsupportedClassVersionError:
    I'm guessing that my focus should mostly be on the 'Original exception', and maybe I need to revisit the JRE or JDK or JVM (these terms are somewhat nebulous to me, so please forgive me using them interchangeably) on my machine. For now, I'll just keep trying stuff. Thanks again for the replies!
    Regards,
    Daniel T.

  • Oracle EBS R12 - how to compile jsp and keep .java file

    Hello.
    When I compile the jsp file, it will create the _pagename.class file into $COMMON_TOP/_pages directory. Some of the time it also keep _pagename.java file in there.
    How can force the compiler to keep the java file always.  I am using following command which creates _pagename.class file. 
    perl $FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'ptcResponse.jsp' --flush
    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.

    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    This is an expected behaviour.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.
    The "perl ojspCompile.pl" command doesn't offer this -- Issue "perl ojspCompile.pl" and you will see what options are available.
    Your option is to keep/save the java files in a different directory.
    Thanks,
    Hussein

  • Compiling / Running a Java file in JSP

    Hi,
    ok, I have a jsp page, which we will call page 1. Once I go to that page, I all I want it to do is compile a certain file.java, and then run the file.java. The user doesn't actually know that this is going on in the background. Page 1 automatically redirects the user to page 2 (also a jsp page).
    The java program that I created (that was previously compiled and ran) creates a special javascript file. After running the file.java in page #1, the java file creates a javascript file that will be used in page 2 to display a tree node (group of information).
    so, right now, I'm trying to figure out how to write the jsp code that will tell how to compile and run a java file. I was thinking about using javabeans before, but I think you HAVE to actually display the contents of the java file into the jsp (I think). Anyhow, thanks for the help!

    sorry about being ambiguous before. What I mean by
    running a java file was that I already created a java
    file. I don't want to hava my java statements inside
    the jsp file. I just want the jsp file have a command
    in it that would call a java file, tell the java file
    to compile and run. All the jsp file would do
    (hopefully) is just give commands for a seperate java
    file to compile and run. Thanks again for any help!Ok, so this other java file has some entry-point method, like main(), right? So call it...
    <%
    YourJavaClass.main(appropriateArgumentsGoHere);
    %>
    or better yet, it's an object you can use:
    <%
    YourJavaClass x = new YourJavaClass();
    x.callSomeMethodHere(withAppropriateArgumentsHere);
    x.callAnotherMethodMaybe();
    %>
    You don't need the jsp file to "compile" this java file, you'd already have compiled it beforehand, and it's class bytecode needs to be in your classpath (on the server side) of course.

Maybe you are looking for

  • Itouch 2.2 update doubt

    I have an ipod touch,but the older version, and I have just tried for the first time to download an application, and a sign popped saying I must first download the 2.2 update. My doubt is, is this update for the old version of ipod touch or just for

  • Need to delete an unsent message in Mountain Lion Mail

    I attempted to send a mass e-mail in Mountain Lion mail to over 300 recipients.  The application would not let me do so, so I broke the mailing list up into smaller lists and sent multiple e-mails, which worked.  But now mail constantly notifies me t

  • How do I download CS6 extended?  I only see CS6.

    How do I download CS6 Extended trial?  I only see CS6. David

  • OWB - write lock - OMB01118: Could not connect to repository!

    Hi We have sheduled a job to run the DWH workflows nightly . We are on version 11.2.0.2.0 We are struggeling with this error that apperas randomly in our development environment . OMB01118: Could not connect to repository! API0262: Cannot place write

  • Hl2_osx craches on portal launch (steam)

    hi i have this problem for launching portal for mac on steam : Process:         hl2_osx [9942] Path:            /users/riomar/library/application support/steam/steamapps/riomar45/portal/hl2_osx Identifier:      hl2_osx Version:         ??? (???) Code