1 2 Previous Next 17 Replies Latest reply on Nov 25, 2002 8:54 PM by 807549

    java program

    807549
      Hi,
      i have a problem with a file:ExampleTag.java

      package coreservlets.tags;

      import javax.servlet.jsp.*;
      import javax.servlet.jsp.tagext.*;
      import java.io.*;


      public class ExampleTag extends TagSupport {
      public int doStartTag() {
      try {
      JspWriter out = pageContext.getOut();
      out.print("Custom tag example " +
      "(coreservlets.tags.ExampleTag)");
      } catch(IOException ioe) {
      System.out.println("Error in ExampleTag: " + ioe);
      }
      return(SKIP_BODY);
      }
      }
      When i try to compile i receive an error message:

      ExampleTag.java:4: package javax.servlet.jsp.tagext does not exist
      import javax.servlet.jsp.tagext.*;
      ^
      Normally i puted this file in :c:\jswdk1.0.1\webpages\WEB-INF\servlets\coreservlets\tags

      I think that all i need is installed in my machine.
      I will appreciate if somebody could tell me where is the error.
      Thanks in advance.
      Michel
        • 1. Re: java program
          807549
          Do you have installed (and is running) a webserver and the j2ee api?
          • 2. Re: java program
            807549
            Yes, i installed the JSWDK server and J2dkse1.4.0_01 and J2sdkee1.3.1 and i have configured my environments variables. i don't understand what happens.
            If there are more advises i will appreciate.
            Thanks
            Michel
            • 3. Re: java program
              807549
              I continue to have the same problems with my program. But is strange because why when i compile no problem with import javax.servlet.jsp.*, but i have problems with import javax.servlet.jsp.tagext.*;
              Somebody can help me please?

              Thanks in advance
              Michel
              • 4. Re: java program
                807549
                I need a help!!!!!!!!!!!!!!
                Thanks a lot.
                Michel
                • 5. java tag program compilation problems!!!
                  807549
                  When i compiling my proram below i receive this error:

                  ExampleTag.java:4: package javax.servlet.jsp.tagext does not exist
                  import javax.servlet.jsp.tagext.*;

                  I installed the JSWDK and J2sdkee1.3.1 and J2sdse1.4.0.0_1 in the right way. Please i need a help.
                  Thankls a lot.
                  Michel
                  • 6. Re: java program
                    807549
                    http://forum.java.sun.com/thread.jsp?forum=31&thread=271751
                    • 7. Re: java program
                      807549
                      Which directory are you in when you try to compile.
                      What is the value of your CLASSPATH and J2EE_HOME environment variables.

                      Have you confirmed that the javax.servlets.jsp.tagext package is indeed in the j2ee.jar at $J2EE_HOME/lib/ by doing "jar tf j2ee.jar" and reading the results. (I can't imagine why that class would not be there but who knows.)

                      Some possibilities.
                      • 8. Re: java program
                        807549
                        Hi Erick:
                        i tried your advise and receive the following message:

                        Microsoft Windows XP [Version 5.1.2600]
                        (C) Copyright 1985-2001 Microsoft Corp.

                        H:\>jar tf j2ee.jar
                        java.io.FileNotFoundException: j2ee.jar (The system cannot find the file specifi
                        ed)
                        at java.io.FileInputStream.open(Native Method)
                        at java.io.FileInputStream.<init>(FileInputStream.java:103)
                        at java.io.FileInputStream.<init>(FileInputStream.java:66)
                        at sun.tools.jar.Main.run(Main.java:185)
                        at sun.tools.jar.Main.main(Main.java:904)

                        When i try to compile i am in :Myservlets\coreservlets\tags\Exampletag.java

                        CLASSPATH=c:\j2sdkee1.3.1\lib\tools.jar;c:\jswdk-1.0.1\lib\servlet.jar;c:\jswdk-1.0.1\lib\jspengine.jar;%CLASSPATH%

                        J2EE_HOME : PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.0_01\bin;c:\j2sdkee1.3.1\bin


                        Thanks a lot
                        Michel
                        • 9. Re: java program
                          807549

                          I would suggest setting your J2EE_HOME env variable to something like "c:\j2sdkee1.3.1" and then try the jar -tvf command from the subdirectory that contains your j2ee.jar file (most likely not the root of your H drive, though who knows...)

                          Lee
                          • 10. Re: java program
                            807549
                            I think that my configuration is good?
                            • 11. Re: java program
                              807549
                              but when i type your command jar tf j2ee.jar in
                              c:\j2sdkee1.3.1\lib i found the class.
                              • 12. Re: java program
                                807549
                                When i try to compile i am in
                                :Myservlets\coreservlets\tags\Exampletag.java

                                CLASSPATH=c:\j2sdkee1.3.1\lib\tools.jar;c:\jswdk-1.0.1\
                                ib\servlet.jar;c:\jswdk-1.0.1\lib\jspengine.jar;%CLASSP
                                TH%
                                Try adding your Myservlets directory to the CLASSPATH environment variable by doing something like:

                                set CLASSPATH=%CLASSPATH%;######

                                Except substitute ###### with the full (absolute) path to your Myservlets directory.

                                What this does is it puts the Myservlets directory into the classpath so that the package "coreservlets" and all subpackages of that can be recognized.

                                I do not think this will solve your problem, but why not try it and see?
                                • 13. Re: java program
                                  807549
                                  I can't to compile, i am affraid. I don't know what is the problem!!!!!!
                                  I need another solutions, i tried all till now, but nothing.
                                  WHO CAN HELP ME!!!!!!!!!!
                                  tHANKS
                                  • 14. Re: java program
                                    807549
                                    Is not possible to compile this program, i tried severals ways but nothing yet. There is somebody that can help me please?
                                    Thanks a lot.
                                    Michel
                                    1 2 Previous Next