×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

I am very thankful that so many teachers teach me! :-)

本文发表在 rolia.net 枫下论坛Although I am very slow and green, you always have patience to answer me.
Since CGI development is very different than Java ,I just edit my code on my PC,then upload my program to the Linux server and debug it on server and Perl program don't need compile on my PC .So I don't need any good PC. It save money!( But I know that is disadvantage of CGI. ) Anyway,many programmer in China don't believe window2000 is good. In fact ,I know there are many bug in WINNT ,whatever which version.
And It always demands the users to change their computer quickly. It cost more and more money. You know, In China ,programmer is poor. :-( :-( So , I don't want to install window2000, since I have it one year ago.
It makes my pc run very very slowly.

Anyway,It's ok that I did what you have told me.
But I have more questions. Please have more patience ,thank you.
I still want to know the process of compile java program with the JDK1.2.2 and how it can run on Tomcat .
Since I import javax.servlet in my program.But when I use "javac testservlet.java",It can't find the class package. Shall I need more pieces of cake or just need some configures?
I have no idea.
How do you debug your program?
In C++,you can compile it and follow every step of the code in debug tool.But I don't know how you do it in JAVA.
And I think java development envirment rely on the system envirment very much.
But I think the OOD method is good for programmer.It must replace the traditional
programming mode.It makes the programming easy and fast and easy to read.....
But I just have no idea about the development envirment.
I read some articles.They told me,"you need install this,....oh,you need that,....no ,you need install another kit because it has....."
oh, I head is bigger and bigger. :-)
Yes,I am very slow to learn it . Please forgive me ask that stupid question. There're lots of jobs these days. I just do programming and maintain the server and the database , fix the print and Lan in my comany or whatever....
I just want to sleep when I go home. :-)

I think I will get use to the java development soon.But I need your help my dear teachers.
:-) :-) :-)更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / hi,Japper, what's about error 500?
    I can ran the JSP examples of the Tomcat 3.1.
    before I download and installed the java plug-in . The example plugin.jsp recommend me to download it, so I download it It works after I installed it. But It doesn't work after I restart my computer.
    When I executed every JSP example(just like date.jsp) , it showed:
    Error: 500
    Location: /examples/jsp/dates/date.jsp
    sun/tools/javac/Main
    But the Servlet examples are still OK .
    If I uninstall the plug-in ,and install Tomcat again ,everything is OK.
    Maybe I just leave the plug-in away.I just west my time for it. It's not important for me.
    You know, as a beginner .I am intersted for everything about Java. :-) :-)
    I only want to know why?and What is 500?
    • What is "sun/tools/javac/Main"?
      JSP compiler needs to use the sun.tools.javac.Main class to translate JSP into servlet code and then compile it into .class file. This class is in tools.jar file.
      To make this tool.jar file available to Tomcat,
      you need to set Windows environment variable JAVA_HOME.
      Tihs can be done in either of the following ways:

      1) In MS-DOS, issue: set JAVA_HOME=C:\jdk1.2.2

      2) At the very beginning of tomcat.bat,
      add JAVA_HOME=C:\jdk1.2.2

      I took Windows as an example. You owrk on Linux, but things are similar. For instance, you work on tomcat.sh file.

      You can visit www.apache.org and find FAQs.
      • some questions
        I don't have the file named tools.jar under anywhere of c:\jdk1.1.8. It's so strange.
        And I have no idea ,then I just uninstalled the runtime java and I intalled tht Tomcat again then everything was ok again. I think the error mabye came from the class file or the classpath, I don't know. Anyway,I always set the values of the path and CLASSPATH in my autoexec.bat of my window.and I didn't set the JAVA_HOME in Tomcat.bat
        Shall I must set the values of the JAVA_HOME?
        I compiled my program in command line use "javac"(JDK1.1.8) Would you tell me more about the process of the compiler?
        Such as compile the Jsp programs to Servlet application or other situation. How can a compiler know the program is a jsp program or Servlet program?
        I am reading that book. yes, that book is good.
        He talks about the foundation of the OOD method a lot. So I think reading that book and do some test at the same time can be more helpful to understand java .
        • You need to use JDK1.2.2. JDK1.1 does not match Tomcat...Ooops!
          • Dear Jabber's student, I appreciate your humor
            I just want you to know that not all of my stusents can answer the question your handled. Probably, you should be my teacher.
            • All of you are my teachers. :-)
              I want to ask you that why it doesn't have classes.zip file in jdk1.2.2?
              And I also want to know why it shows me "out of envirment space" in the window each time when I startup my Tomcat ?
              Does it relate with my PC RAM?
              I have only 64M . :-(
              • You asked the right questions
                Dear Alwaysgreen,

                You are using Windows 95or 98, which is not for professional programming. You should set up Windows NT server, workstation, or Windows 2000 professional.

                Tomcat is lightweight, so you can run it on Win 95/98. However, you need to expand
                "virtual memory". Here is how to do it:

                1) Find C:\config.sys, add a line

                shell=c:\command.com /e:16384 /p

                Then, restart the machine.

                2) Another way to do thigs is to open
                MS-DOS, and isuue a command

                command.com /e:16384 /p

                Then, do to c:\jakarta-tomcat\bin and run startup.bat.


                Good luck.
          • After I installed jdk1.2.2,but I still met the same problem although I set path=c:\jdk1.2.2\bin,CLASSPATH=c:\jdk1.2.2\lib
            • You need set JAVA_HOME
              Aha, tomcat gets to know java compiler according to Windows environment variable
              JAVA_HOME, not from CLASSPATH. Once it knows JAVA_HOME, it will reach java compiler in tools.jar. You just need open tomcat.bat and add a line:
              set JAVA_HOME=C:\jdk1.2.2

              You will be OK.

              PS: I think my student Jabber has ever told you this sometime earlier.
              • Thank you for answering questions on my behalf.
                Dear Teacher, :-):-):

                Yes, I did pointed out the necessities of setting JAVA_HOME. Ms. AlwaysGreen needs to read my posting No. 12918 again.

                I hope you can come often and enlight your students....
              • I am very thankful that so many teachers teach me! :-)
                本文发表在 rolia.net 枫下论坛Although I am very slow and green, you always have patience to answer me.
                Since CGI development is very different than Java ,I just edit my code on my PC,then upload my program to the Linux server and debug it on server and Perl program don't need compile on my PC .So I don't need any good PC. It save money!( But I know that is disadvantage of CGI. ) Anyway,many programmer in China don't believe window2000 is good. In fact ,I know there are many bug in WINNT ,whatever which version.
                And It always demands the users to change their computer quickly. It cost more and more money. You know, In China ,programmer is poor. :-( :-( So , I don't want to install window2000, since I have it one year ago.
                It makes my pc run very very slowly.

                Anyway,It's ok that I did what you have told me.
                But I have more questions. Please have more patience ,thank you.
                I still want to know the process of compile java program with the JDK1.2.2 and how it can run on Tomcat .
                Since I import javax.servlet in my program.But when I use "javac testservlet.java",It can't find the class package. Shall I need more pieces of cake or just need some configures?
                I have no idea.
                How do you debug your program?
                In C++,you can compile it and follow every step of the code in debug tool.But I don't know how you do it in JAVA.
                And I think java development envirment rely on the system envirment very much.
                But I think the OOD method is good for programmer.It must replace the traditional
                programming mode.It makes the programming easy and fast and easy to read.....
                But I just have no idea about the development envirment.
                I read some articles.They told me,"you need install this,....oh,you need that,....no ,you need install another kit because it has....."
                oh, I head is bigger and bigger. :-)
                Yes,I am very slow to learn it . Please forgive me ask that stupid question. There're lots of jobs these days. I just do programming and maintain the server and the database , fix the print and Lan in my comany or whatever....
                I just want to sleep when I go home. :-)

                I think I will get use to the java development soon.But I need your help my dear teachers.
                :-) :-) :-)更多精彩文章及讨论,请光临枫下论坛 rolia.net
                • I suggest you first forget about JSP things
                  本文发表在 rolia.net 枫下论坛Dear AlwaysGreen,

                  I suggest you first learn servlets. After you are familiar with servlets, come back to learn JSP. JSP is based upon servlets.

                  1) There are some Java debugging tools, but I seldom use them. Java error messages are easy to unserstand, so it is a better idea to learn what's wrong from error messages.

                  2) javax.servlet.* and javax.servlet.http.* packages are hidden in C:\jakarta-tomcat\lib\servlet.jar. Tomcat can run servlets because it can load these libraries. Otherwise, .....

                  3) As you compile your servlet, you should add C:\jakarta-tomcat\lib\servlet.jar to the CLASSPATH. Otherwise, you cannot pass
                  the compiler

                  4) I cannot agree on your points of view about Windows 2000, Linux, NT, 95/98.
                  Linux is hot in China because of China's
                  special circumstances. According to my experiences, one has little luck in doing server-side programming if he/she uses 95/98. Since I began to teach people, I have been telling poeple to throw away 95/98.
                  95/98 are only nice to housewives and kids----they just use 95/98 to connect to internet.

                  5) Java is both a lanaguge and platform.
                  Configuring system is not easy to learn.

                  6) package issues. Let me say you have succeded in compiling a servlet with a package structure com.jabber.ecommerce,
                  and its classname is HelloServlet.
                  ACTUALLY, its fullname is com.jabber.ecommerce.HelloServlet.
                  To run it in Tomcat, you should but it
                  as C:\jakarta-tomcat\webapps\Root\WEB-INF\classes\com\jabber\ecommerce\HelloServlet. (Is your head becoming bigger??? ;-):)
                  To access it, you need hit the following URL:
                  http://localhost:8080/servlet/com.jabber.ecommerce.HelloServlet. I hope you are not overwhelmed...

                  7) Just a friendly piece of advice. NO question is stupid. Most poeple in this formum is patient and nice.. The usage of English is different from that of Chinese. You may say...
                  sorry for bothering again... sorry for occupying your time... But please do not ask others to have more patience. This can lead to misunderstanding ---- it seems you think poeple are impatient. Of course, I understand waht you mean because I am a native Chinese speaker.

                  8) To run Java, you may need have more RAM. At least you need have 128 MB.
                  64MB can run tomcat but that's all.

                  9) Be sure to get the manual under ..\uguide\.
                  Be sure to print out FAQ about tomcat which you can get from www.apache.org.

                  good luck.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                  • oh, you are my english teach too! :-) :-)
                    Yes, you are right, my dear teacher.
                    I am very happy that I can learn more from you. My head is smaller and smaller now.:-)
                    wow...
                    I am thankful about what you said .
                    If I can meet with you,I want to cook the hot food for you. :-) I am a good cook.
                    No, I didn't overwhelmed.There are many troubles in my life. But I can face it with a smile.I never give up.
                    I just kidded last night.

                    oh,you know what ? I made a silly mistake .
                    I import "javax.Servlet ", not "javax.servlet" .
                    So It's impossible pass the compiler.
                    :-)_ Bu Hao Yi Si La. I am a most silly student of yours.
                    I did many trouble by myself ! I should check myself at first.
                    Anyway,my dear teacher, I will bother you the next time.
                    Have a nice day! :-)
                  • Question
                    本文发表在 rolia.net 枫下论坛I create a servlet program named
                    HelloWorldServlet.java

                    import java.io.*;
                    import java.util.Date;
                    import javax.servlet.*;

                    public class HelloWorldServlet extends GenericServlet
                    {
                    String initString;

                    public void init(ServletConfig config)
                    throws ServletException
                    {
                    super.init(config);
                    initString=new String("I have been initialized");
                    }
                    public void Service(ServletRequest req,ServletResponse res)
                    throws IOException, ServletException
                    {
                    Date today=new Date();
                    ServletOutputStream out=res.getOutputStream();
                    out.println("Hello World");
                    out.println(today.toString());
                    out.println(getServletInfo());
                    }
                    public void Destroy()
                    {

                    }
                    public String getServletInfo()
                    {
                    return "Create a page that says Hello World and send date back produced by djf";
                    }
                    }

                    When I compile it ,it shows me "Class HelloWorldSerlet must be declared abstrat.It dose not define void service...."
                    It seems that I didn't success declare the class HelloWorldServlet at first.
                    I just want to test the method of GenericServlet.
                    So please tell why I got that error.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                    • javax.servlet.GenericServlet is an abstract class because its service(...) method is abstract.
                      Your servlet extends javax.servlet.GenericServlet , so you must extend service(..) method. You did not do that so the compiler complained and did not let you go through.
                      • ?
                        Since I service is a method of the class GenericServlet, and I extended the GenericServlet already.So I can use the its service method.
                        I don't understand what you mentioned.Please talk more about it ! :-)
                        • Please pick up your Java books and see what people mean by "abstract class".
                  • Some topics
                    Do you mean that when you use the url
                    http://localhost:8080/servlet/com.jabber.ecommerce.HelloServlet in explorer, in fact , Tomcat will locate the file HelloServlet.class
                    in C:\jakarta-tomcat\webapps\Root\WEB-INF\classes\com\jabber\ecommerce\ ?

                    It just like the CGI method. We always put it into a path on the server which the user don't know.But the web server can find it .
                    I read many html files on sun web site,I researched how to run java programs in html. It looks similar like what I did in cgi. And I found servlet have more methods to pass data . It's interesting! And java has higher safe level !

                    oh, I don't understand what you said about "structure com.jabber.ecommerce", I think if your class file is HelloServlet.class, you java program must be HelloServlet.java ,isn't it?
                    I am a little confuse about it.
                    Would you tell me more about it ?
                    By the way, please tell me about more java web site, I want to research them. how about your application web server?
                    • Servlets can do all things that CGI can do
                      In production, people need to configure the servlet so that they can offer the users a user-friendly url. This can be done using some XML files. You are just touching the tip of iceberg.


                      For instance, as I hit
                      http://www.abcdef.com/hello,
                      I really don't have an idea what kind of servlet that hello is.

                      Java classes have full name, including package structure. As we say String, we mean java.lang.String. Sometimes, we can simply say String, Hashtable, HashSet, URLConnection, .... because we have imported the library package. As we refer to a Java class from outside of Java, we have to use the full name. Full Name!

                      Here are some useful websites:
                      http://www.servlets.com/
                      http://www.javasoft.com/
                      http://www.gamelan.com/
                      http://www.javaworld.com/
                      ....
                      You can find more.
                      • How can I run a Servlet in Tomcat?
                        If I finish compiling my servlet program,
                        I want to run it in my browser.
                        Which absolute path shall I put?
                        Does Tomcat have any profile file that set the value of the path .
                        Just like Apache web server, we can set the value of the path: /home/httpd/cgi-bin/
                        so only the file in cgi-bin can run cgi programs.
                        I guess it's in Servlet path of Tomcat.
                        I copy my files(.java and .class) into the servlet example files path.But we I run it in my browser ,but the server didn't find it.
                        just like "http://192.168.1.20:8080/example/servlet/HttpExample"
                        (My file is HttpExample.class)

                        ?
                        • Just a few comments
                          本文发表在 rolia.net 枫下论坛1) You never run servlets in browsers. You saying of running servlets in browser is incorrect. We run servlets on the server, and use the browser to observe the effects.


                          2) If you want to generate the HTML stuff, web pages, your servlet should extend javax.servlet.http.HttpServlet. Then, you need to extend doGet() or doPost(), or both of them. javax.servlet.GenericServlet is generally used to do some tasks behind the curtain, not for generating html stuff.


                          3) I suggest you look through all the files under C:\jakarta-tomcat\webapps\example. In particular, look into C:\jakarta-tomcat\webapps\example\WEB_INF\web.xml,
                          in wich you can learn how to configure servlets.

                          4) In Tomcat, there are several "Contexts". If
                          your context is named chengdu, it means there is C:\jakarta-tomcat\webapp\chengdu.
                          For this context, its servlet context is C:\jakarta-tomcat\webapps\chendu\WEB_INF\classes\.
                          Now if your servlet is called com.abc.greeting.Hello, the class file should stay at C:\jakarta-tomcat\webapps\chengdu\WEB-INF\classes\com\abc\greeting\Hello. To access this servlet, you should hit
                          http://127.0.0.1:8080/chengdu/servlet/com.abc.greeting.Hello. If you think this URL is ugly-looking, you should edit C:\jakarta-tomcat\webapps\chengdu\WEB-INF\web.xml to give this servlet a better-looking name.
                          Yoou may compare what I said here to the examples in tomcat.

                          5) It seems that you have not used the user manual in the tomcat. If you look into the manual in detail, you would have saved a lot of time on guessing work.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                          • I need more time to read java book. xixi...
                            Yes, I know that Servlet runs on the server ,not in my browser. My expressions have some problem.
                            Yes, you are right . I read few java book cause busy work. In fact , you are very good teacher.
                            I need more time to read it and think it over by myself. I found I just relyed on your answer so much. So I should change the way .
                            But I will ask you some questions if I have some problems which I can't solve it by myself.
                            silly student
                            Ivy
                            :-)