Compiling .java file on tomcat 4.1

i wana know where to store the .java file on the tomcat directory for tomcat to compile it?
and then after putting it in the appropriate place is this command gona compile it: javac -cp "c:program files\apache group\tomcat 4.1\common\lib\jasper-compiler.jar" yourservlet.java
if this is not the correct command then wat is the easiest way to compile the servlet?
thank you in advance.

Hi,
I've never heard about .java auto compilation in Tomcat, but anyway, that wouldn't be a goddo aproach, don't you think so? Why don't you publish your application in a single .war file? You could even sent you JSPs compiles, avoiding performance problems...

Similar Messages

  • How to compile java file in Tomcat ?

    Hi all,
    I have a java file named Ch1Servlet.java under project1/src directory
    there is classes directory project1/classes and web.xml under src directory
    project1/src directory.
    Now to compile i have to give %javac -classpath /your path/tomcat/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java
    What is this your path ? Tomcat 5.0 is installed in C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib with servlet-api.jar
    Please help me out.
    Best Regards
    Taton
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class Ch1Servlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    PrintWriter out = response.getWriter();
    java.util.Date today = new java.util.Date();
    out.println("<html>"+"<body>"+"<h1 align = center>HF\'s Chapter 1 Servlet</h1>"+"<br>"+today+"</body>"+"</html>");
    }

    understand 1 thing..ur tomcat is not a compiler as u
    think..its a poor web server only..
    Its not mandatory that u need to put the source files
    in tomcat folder.u can put ur java files where ever u
    want..put servlet.jar in ur classpath.
    then start compiling ur java files..once u are done
    with compiling copy the class files alone to ur
    web-inf classes folder.
    thats it!!!
    regards
    shanuservlets12.jar

  • Error while compiling java file

    Hi, im newby in java,
    i was trying to compile java files, and after that i will use it in JSP as javabean.
    I have 2 files already, the first file is a connection code, and its compiled successfully, it looks like this
    i named this as ConnectionBean.java
    package my_package;
    import java.sql.*;
    public class ConnectionBean {
         private Connection con;
         private static final String driver = "org.postgresql.Driver";
         private static final String url = "jdbc:postgresql://localhost:5432/PSQLDS";
         private static final String username = "postgres";
         private static final String password = "mypassword";
         public ConnectionBean() {
         public Connection logOn() {
              try {
                   Class.forName(driver); con = DriverManager.getConnection(url, username, password); }
              catch(ClassNotFoundException e) {
                   System.err.println("ConnectionBean: driver unavailable..."); con = null; }
              catch (SQLException e) {
                   System.err.println("ConnectionBean: driver not loaded..."); con = null; }
              return con;
         public void logOff() {
              try {
                   con.close(); }
              catch (Exception e) {
                   e.printStackTrace(); }
    as you can see above im using "package", and yes i have manage to put all my java files within the correct path (ROOT\WEB-INF\classes\my_package)
    And also, i have test this class as javabean on JSP file and it works.
    There for i continue to create the second java file, as a purpose to create a back engine for JSP. I use the same package as ConnectionBean.java, it looks like this
    i named this as ListPageEngine.java
    package my_package;
    import java.beans.*;
    import java.sql.*;
    public class ListPageEngine {
         public static void main(String[] args) {
              ConnectionBean conBean = new ConnectionBean();}
    on compiling process using command "javac ListPageEngine.java", i get this error message
    ListPageEngine.java:11: cannot find symbol
    symbol : class ConnectionBean
    location: class my_package.ListPageEngine
    ConnectionBean conBean = new ConnectionBean();}
    ^
    ListPageEngine.java:11: cannot find symbol
    symbol : class ConnectionBean
    location: class my_package.ListPageEngine
    ConnectionBean conBean = new ConnectionBean();}
    ^
    2 errors
    I think, i am pretty much sure that all my configuration (wheater its Apache TomCat, Environment Variable or PostgreSQL server) was good, as a prove, i was able to use ConnectionBean.class in my JSP file.
    I susspect the problem is related with "package", seems i cannot use ConnectionBean class within ListPageEngine class when i use package.
    For another information, i didn't install such thing as J2EE, i only install JDK 1.5, i also guess this might be the cause.
    Right now im all stuck, i try to find thread which might be related with my problem but i failed to find it, most of them get the same answer by UncleSAM which are
    Try the following forum (about JSP technology)
    http://forum.java.sun.com/forum.jspa?forumID=45
    JavaBeans spec contains nothing about JSP, but JSP spec describes using of beans.
    i hope my question is clear so anyone who might have experience or clue with this problem might be able to help me.
    Thanks before

    finally folks, i found answer to my own problem hehehehe..
    the problem is on the compiling command (javac ... my_file.java), i found that i need to add some parameter on the command to make it works.
    This problem solved.

  • Problem compiling java file to access web service! newbie troubles !

    I am new to web services and this is my first program...
    I am compiling java file which has import statement like:
    import org.apache.soap.util.xml.*;
    import org.apache.soap.*;
    import org.apache.soap.rpc.*;
    It says ----- package org.apache.soap.util.xml does not exist as one of errors..
    I have a folder that I named soap myself and I have activation.jar,serces.jar,mail.jar,soap.jar in it.
    I added c:\soap in my classpath and this was supposed to be the quickstart way to try an example out...
    but it gives me compilation errors... what should I do ?

    You'll need to specify each jar file in the classpath. c:\soap\xerces.jar;c:\soap\sax.jar;....

  • How to check the JDK version of a compiled java file

    can anybody tell me how to check the JDK version of a compiled java file ?
    Edited by: gbhatia8 on Sep 9, 2010 7:04 AM

    The major/minor version of the class file is the way to go.
    Also, it's not necessary to write a separate program to get to those. javap prints them out when being passed the -v flag.
    Note, however that "JDK version" is not a correct term, as I can create 1.4-compatible class files with a Java 6 JDK (by passing the -target flag to javac). Those won't look any different than .class files written with a 1.4 JDK.

  • Compiling java files in DOS window

    Hi,
    I have been writin a small Client Server Application. I am attempting to use java packages in order to put certain class files into particular directories, and then import the packages when needed.
    So far, i have started my 1st attempt at a very small application just to send / receive messages. My problem is however, that i can compile all the java files into specific directories & packages no problem, but when i try to compile the java files which make use of these classes, i keep getting the same error.
    OK, i will try to simplify,
    My Server program (called MyServer.java) uses 2 classes (called ProcessTransaction, and NumberValidator), I have compiled the generated class files from ProcessTransaction.java and NumberValidator.java files into a DIR called C:\JavaForm\serverstuff. i.e. my server program imports the package "serverstuff,*;" The problem is that when i try to compile my server program i get the error message:
    "cannot access ProcessTransaction
    bad class file: c:\JavaForm\ProcessTransaction.java
    file does not contain class ProcessTransaction
    Please remove or make sure it appears in the correct subdirectory of classpath"
    I am using the command:
    javac -classpath c:\JavaForm c:\JavaForm\MyServer.java to compile the server file
    All the java and class files are stored in the C:\JavaForm folder
    I dont understand why the ProcessTransaction call cannot be accessed because it is most definitely in the compiled java file!!!
    Any help would be much appreciated!!!
    Cheers
    Iain

    it's OK, i figured out that to compile the Server program successfully, you have to remove all the other java files from the DIR which the Server.java files exists, or else there is a conflict!!!! I dont know why, but that's what you have to do!!!!

  • Location of compiled java files

    Where are the compiled java files for jsps? Sometimes I get jsp errors in the log
    files like:
    D:\jsrv\my\WEB-INF\_tmp_war_myserver_myserver_my\jsp_servlet\_mypage\_cancelmembership.java:105:
    ')' expected
    However, the _cancelmembership.java file does not exist at that location. Only
    the _cancelmembership.class file exists at that location.

    You do NOT want to change the bundled CSS files. Create your own CSS and include it in the template after the built-in CSS include. Any classes you create in your own file of the same name and specificity as the built-in classes will override those classes. For example:<style type="text/css">
    td.myclass{color:red}
    td.myclass{color:blue}
    </style>The color of the text in a table cell with the class "myclass" will be blue, not red, since the same class was defined twice, it will use the one that came last on the page.
    If you change the classes in the built-in template CSS files, you'll change them for everyone using your APEX instance, which is not a particularly good thing to do.
    Tyler

  • Compiling java file in 11i

    I need to compile java file in CRM 11i .

    1003984 wrote:
    I need to compile java file in CRM 11i .Please see (HOW TO COMPILE JAVA FILES IN CRM APPLICATIONS [ID 468434.1]).
    Thanks,
    Hussein

  • Running a compiled java file

    Question: if a pc doesn't have the jre, how can it launch a compiled java file? For example, i create a program that calculates the expenses of a factory, i create the gui and i compile the file. Then i distribute my program. If a factory doesn't have jre, i suppose it can't launch the program...how can i do? can i create an exe file from java one?

    If the machine has a browser, it probably has a jre, but that is beside the point. No it cannot run without a jre. If there is not one, it must be installed.

  • Creating a .bat file to compile .java files

    Hi,
    I am trying to create a .bat file to compile java files. I have created the .bat in the same folder as teh .java file I am trying to compile. I know the path is set to the proper folder to find the compiler, but I keep getting an error saying the system can not find the specified file, or can not read fileName.java. Everything is spelled correctly, and I know it works because it will compile from the command prompt. Any suggestions?

    rather than including a sourcepath, just specify the full location. Using your example, this would read like
    javac "C:\Documents and Settings\Kevin\Desktop\School Stuff\AP Comp Sci\PowerPoints\Chapter 02\Executables\Section 2.2\Facts.java"Note that everything is inside the inverted commas " "
    I tried this on a hello world Java program inside a brief case and it works fine.
    The class file is created inside the briefcase.
    If you want to create a bat file to do this from anywhere, modify your batch file to look like this:
    c:\
    cd "C:\Documents and Settings\Kevin\Desktop\School Stuff\AP Comp Sci\PowerPoints\Chapter 02\Executables\Section 2.2"
    javac %1.java
    java %1Again, you would use this as follows
    mybat FactsDon't forget to leave out the .java extension.
    This will compile the java file and attempt to run it for you.
    If you don't want it to run, leave out the java%1
    If you create other java files in this same briefcase folder you can use mybat to compile them too.
    For example
    mybat Facts2

  • Cannot compile Java files or create Java Project

    Hi,
    I cannot compile java files and also didn't see any option
    for creating java project using flex 2 builder.
    Actually am trying to create a FDS project with an option to
    compile on the server. I am using Weblogic 8.1 SP5 as my server.
    thank you
    sun

    hi
    this is may jvm.config file. Can anyone tell me if it is
    right because all the fields are blank.
    # VM configuration
    # Where to find JVM, if {java.home}/jre exists then that JVM
    is used
    # if not then it must be the path to the JRE itself
    # If no java.home is specified a VM is located by looking in
    these places in this
    # order:
    # 1) JAVA_HOME environment variables (same rules as java.home
    above)
    # 2) bin directory for java.dll (windows) or
    lib/<ARCH>/libjava.so (unix)
    # 3) ../jre
    # 4) registry (windows only)
    java.home=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK 2.0\jre
    # Arguments to VM
    java.args=-ea -Xmx384m
    # Environment variables we care about, whitespace-separated
    env=
    # java.class.path - use this for adding individual jars or
    # directories. When directories are included they will be
    searched
    # for jars and zips and they will be added to the classpath
    (in
    # addition to the directory itself), the jar to be used in
    launching
    # will be appended to this classpath
    java.class.path=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK
    2.0\jre
    # where to find shared libraries, again use commas to
    separate entries
    java.library.path=
    thanks
    sun

  • Cannot compile java file after ..

    i installed java sdk 1.4
    uninstalled java 1.2 & java 1.3.1
    --after that i was not able to compile or run java file
    reinstalled java 1.3.1 and 1.2
    --now able to run previously compiled java file
    --cannot compile a new java file
    any help

    It would be helpful if you would exactly tell us what error message you get instead of just saying "I can't compile or run anything anymore".
    Things to think of: Did you add the bin directory of the JDK to your path? Is the classpath set correctly?
    Installation notes
    http://java.sun.com/j2se/1.4/install-windows.html
    Setting the class path
    http://java.sun.com/j2se/1.4/docs/tooldocs/win32/classpath.html
    Java 2 SDK Readme
    http://java.sun.com/j2se/1.4/README.html
    Jesper

  • Convert  strange  characters  to  compilance java file

    Hi guys
    I need help!
    How I can translate these strange characters
    into an compilance java file
    are these a memory locations ,machine language , or
    in which language they are written?
    thanks in advance.
    �� - y ��� � ()I ()J ()Ljava/lang/String; ()V ()Z (I)Ljava/lang/String; (IC)Ljava/lang/StringBuffer; (II)Ljava/lang/String; (J)V (Ljava/lang/Object;)Z &(Ljava/lang/String;)Ljava/lang/String; ,(Ljava/lang/String;)Ljava/lang/StringBuffer; (Ljava/lang/String;)V '(Ljava/lang/String;I)Ljava/lang/String; '(Ljava/lang/String;Ljava/lang/String;)V - 0000 <init> Code DC- Illegal key J
    SourceFile [DashoPro-V1.3BETA-091199] a append b c com/diginet/digichat/common/a3 com/esial/util/c d e equals f g h insert java/io/Serializable java/lang/Exception java/lang/IllegalStateException java/lang/Long java/lang/Object java/lang/String java/lang/StringBuffer java/util/Random length      longValue      substring toString 5 4 3 1 % / & 0 2 . 6      - 9 ! " $ ' ! # ,
    +
    '      (      $      ! ! ) 8 8 7
    : D
    ; E
    < F
    ; G
    ; H
    = I
    = H
    > J
    ; D
    ; K     > L     > M     > N     > O �
    > P
    > Q
    > R
    > S
    > T
    @ U
    A E
    > V
    < W
    < X
    < Y
    B D
    = E
    = Z 1 > B C ! # $ ' ! ? 3� :Y� [N� ;Y+� \:+� ]6� 0� ^W����� _� ! b V*� e     �� *� f     �� �� =Y*� f� `� aL� =Y*� e� `� aM*+� bL*,� bM� ;Y� c+� d,� d� _� # b V*� g     �� *� h     �� �� =Y*� h� `� aL� =Y*� g� `� aM*+� bL*,� bM� ;Y� c+� d,� d� _� $      * *� g i�<*� f i�= �� '      A 5*� h i�<*� f i�=*� f{ i�>�~6 �� (      D 8*� h i�<*� g{ i�=�~>*� e
    { i�6 �� *
    B .*� kW*� lW*� m� *� n� *� o � �L� + + ? +
    C 7*� g
    ��@*� f
    ��B!�� !     �� � �� AY� p� q� ,
    > 2*� g{
    �<*� e{
    �=
    � � �� AY� p� q� 1 9 � �*� rL+� s� �++� ]d� tM++� ]d� uN-� ]� !� ;Y� c-� ]d� t� d-� d� _N,� ]� !� ;Y� c,� ]d� t� d,� d� _M� ;Y� c� d-� d� d,� d� _� *� v� � �*� v� ;Y� c+� u� d+� t� d� _N,� ]6-� ]6*� =Y,d� u� w� x� g*� =Y,dd� t� w� x� h*� =Y-d� u� w� x� e*� =Y-dd� t� w� x� f�{code}{code}
    Edited by: vanpersie on Feb 9, 2008 12:35 PM

    This data is Bytecode of a Java class. Read about Java Bytecode structure in Java Documentation at SUN Site.

  • How does javac compile .java files?

    I dont know exactly what classpath javac uses to compile java files. i have set classpath to only tools.jar . and it compiles fine. i thought all standard java class files are present in tools.jar. But... when i opened tools.jar i didnt find most of the class files i expected to see there. In fact there was no java.lang, java.io ... so on packages in it. then how is that compiler compiled ? Of course i found rt.jar under jre/lib, which contained all the mentioned packages...but then i didnt give it in the classpath.
    Any body pls clear my doubts.

    Check out the doc "how classes are found" in the tool
    docs, it will explain how classes are found in
    detail.
    tool docs:
    http://java.sun.com/j2se/1.3/docs/tooldocs/tools.html
    I read the docs and understood that javac.exe loads dt.jar before it could compile .java files. but then what is the use of giving tools.jar in classpath.. i ve seen javac giving problems without it.

  • Error while compiling java file using J2SE 1.5.0

    Dear Sir,
    I'm getting the following error while compiling the java file.The code is also given.
    package test;
    public class TestRowSet {
    public TestRowSet() {
    "TestRowSet.java": cannot access java.lang.Object,bad class file: D:\Program Files\Java\jdk1.5.0\jre\lib\rt.jar\java\lang\Object.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 4, column 1
    Please help me out.
    --Suketu Naik.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    But I'm compiling within "Borland JBuilder 9.0". I've
    set the JDK path of the current project to point to
    the path of JDK 1.5.0 . I've also tried to compile at
    command prompt with "javac". I'm getting the same
    error of "Undefinedclassloader" with long StatckTrace.
    I don't know anything about JBuilder either. If you use the command prompt and enter the full path to the 1.5 javac.exe then that will prove whether the issue is using an older javac or not. For example "c:\j2sdk1.5.0_01\bin\javac HelloWorld.java"

Maybe you are looking for

  • Database or I/O error

    Hi everyone. I recently have a problem with logging into my account in skype. It was working fine for me for last 2 yrs. However, when I logging now I've got error message saying either "THERE IS A DATABASE ERROR" or "I/O Error, please login later".

  • Is Mavericks free for any Apple ID user?

    Hey guys, I am going to sell my MacBook Pro to a friend as part of an upgrade and since OS X installations handle somehow the Apple ID in terms of a legal check I think (same as a receipt is stored in downloaded MAS apps) I wanted to reinstall the ol

  • Javascript and loading of pages

    I have problems with using multiple websites 'opening in tabs' while loading about 15 sites concurrently, several sites have Javascript runtime errors that slow down the whole process. my questions are these: 1. How many sites should I expect to open

  • Cannot delete music off my phone that came from iCloud

    I upgraded my phone and all of a sudden a bunch of music appears on my phone that was not there before and is NOT in my iTunes.  Turns out that the music was purchased eons ago, somehow disappeared from my iTunes and then showed up on my phone becaus

  • D-link camera

    Is there a go around to view D-link camera with safari on a PowerBook G4?