Shivaji Marathe

Ranch Hand
+ Follow
since Jan 11, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shivaji Marathe

You are creating a new thread, but you are not really doing anything with it. When you run your program, the main() method runs on one thread. If you want to start another thread and execute some code on that thread, you have to either
extend a thread,
override it's run method and put the code you want to execute on the separate thread in the run method
and then call the Thread.start to execute the code.
OR you can create an object that implements the runnable interface,
provide a run method to this object and
then create a thread with this object as an argument and then call the Thread.start to execute the code on a separate thread.
HTH
18 years ago
I encountered the following code and explanation in Core Java2 ( page 97 )

The hashcode for both strings is same and the hashcode for both the string buffers will be different from each other. The explanation is that the hashcode of the String object is based on the contents of the String . And the hashcode of the StringBuffer is basically calculated by the hashCode() function of the Object class, which uses the memory address to calculate the hash code.
I thought that the compiler will encounter two identical String literals and therefore, both Strings s and t refer to the same memory location and so their hash codes are identical.
Can someone shed more light on this ?
TIA
18 years ago
Mike :
Thanks for the Tip on deleting and adding my own commands to the TOOLS menu. First I tried the default "Add JDK commands" option. But no luck. The commands used Jbuilder files even though Jbuilder is nowhere in my PATH, CLASSPATH, JAVA_HOME, J2EE_HOME etc.
So finally I just added the commands myself, selecting the appropriate java.exe and javac.exe from the JDK1.3.1 folder.
Thing seem to be working fine now.
Thanks once again
If I type java-version from the command prompt it shows me the correct version of JDK ( JDK 1.3.1) which I have installed and not the Jbuilder version ( JDK1.2.2).
And I have used the same setting last week without any problems. Have not installed any new sodtware nor have made any changes to the textpad or Jbuilder configuration.
I have been using Textpad 4.5 to write,compile and run small java proagrams for quite some time now. All of a sudden it seems that each time I run the program using the Tools/Run Application option, a .BAT file is getting created. The .bat file contents are as follows.

[B]
@ECHO OFF
D:
CD "\Download\Test\Working files\starting"
D:\JBuilder35\jdk1.2.2\bin\java.exe Test
PAUSE
[B]
Even though I have Jbuilder installed on the same PC, I don't want to use the java.exe that comes with Jbuilder. My PATH, CLASSPATH and JAVA_HOME variables do not have any reference to JBuilder. I have JDK1.3.1 installed on the PC and all the environment variables point to the JDK1.3.1 installation.

Does anyone have any idea why this is happening and how I can fix it so Textpad stops generating these mysterious .BAT files?
Thanks
First of all the package statement needs to be the first executable statement of your code.
After you compile the first class, you need to create directory structure that mimics the package path and move the class there.
If your class B is in C:\myprogram folder and you are importing db.dbconnect, there needs to be a dirtectory db in c:\myprogram. The db directory should contain a dbconenct directory which should contain the class you are trying to import.
Hope this helps
18 years ago
Off course I have added a context entry in the tomcat_home/conf/servlet.xml file . This is what I have added
<Context path="/Jsptut" docBase="webapps/jsptut" debug="0" reloadable="true" />
Incidentally, when I installed and ran the examples from Sun's site, they did not add anything to the tomcat_home/conf/servlet.xml file. How do those examples work then?
18 years ago
The last part of the for loop ( the one after the second semicolon ) is executed after each iteration of the loop, not before.
In the first example the assignment to i and the comparison happen before the println statements and the assignment to the array happen after each iteration.
In the second example the print statements are executed in a separate for loop, that executes after the first one is complete and therefore all the assignments to the array are complete.
HTH
18 years ago
Another good site to find introductory information about any computer related terms is
http://whatis.techtarget.com
You can always check out SUN's website at java.sun.com
HTH
18 years ago
I am having similar problems with running my jsp's under tomcat.
I am using tomcat 4.0.3 under windows NT.
I have a folder
tomcat_home/webapps/mytutorial
I have created a web-inf folder under this and copied a web.xml file from the
tomcat_home/webapps/root/web-inf folder .
I have shutdown and restarted tomcat server after doing this, I have rebooted the machine , to no avail. I get the 404 error message each time I try to access localhost/mytutorial/Hello.jsp.
The same file works fine under tomcat_home/webapps/root.
I copied and installed some examples from SUN's quick start guide (http://java.sun.com/products/jsp/html/jsptut.html) and I notice that the first time I access those samples, tomcat creates a folder under tomcat_home/webapps/<sun'sSample>/web-inf. But that folder does not contain any xml file.
What I am missing ?
[ March 07, 2002: Message edited by: Shivaji Marathe ]
18 years ago
Check this out
http://www.moreservlets.com/Using-Tomcat-4.html

The book More Servlets by Marty Hall is great for beginners. Check out the book review section of Java Ranch to get an idea about other books on Servlets, JSP and J2EE in general.

At SUN's site , take a look at the J2EE tutorial
http://java.sun.com/j2ee/tutorial/
HTH
18 years ago
Jason :
I tried that :
I recompiled the source file with a
package mypackage; statement and then copied the class file to tomcat_home\webapps\ROOT\WEB-INF\classes\mypackage folder
and I have the following import statement in my jsp file

<%@ page import="mypackage.*" %>

But I still get the error
"Class org.apache.jsp.UserData not found.". Why is the compiler looking for org.apache.jsp package structure?
Also how can I get this code to work under some other folder in the webapps folder ?
Thanks
18 years ago
JSP
OK, I am sorting my way through the minimalist documentation that comes with Tomcat 4.0, the JSP QuickStart Guide (http://java.sun.com/products/jsp/html/jsptut.html)- which refers to Tomcat version 3.0, and the great tutorial at jsptut.com.
I have managed to run all the samples that come with Tomcat, I can run the samples that come with the Quickstart guide. I have even managed to follow through and write JSP code, based on the tuotrial at jsptut.com.
It is the JSP using Bean class that is giving me grief for almost one whole day.
I am using JDK 1.3.1, Tomcat 4.0.1 on a windows NT 4 PC.
I was running all the examples from the JSPTUT.com by placing them under the
tomcat_home/webapps/root folder , without any problem.
I created a bean class and placed the .java and the .class files under
tomcat_home/webapps/root/web_inf/classess folder,
but the compiler does not see the class.
Here is the error I get
Class org.apache.jsp.UserData not found.
After looking at the example from Sun's Quickstart, I changed the directory structure so that the .jsp and .html files are under
tomcat_home/webapps/mytutorial folder and the .java and .class files for the bean class are under tomcat_home/webapps/mytutorial/web-inf/classes folder. No luck still. In fact I am not even able to bring up the html file. I get the famous 404 error.
So my questions are :
How can I set up another folder under tomcat_home/webapps to contain all the code I am writing?
Where should I place the bean class files so that the JSP compiler can see them ? I saw in some examples that included an applet, they had used the "codebase" attribute. Do I have to use something similar with bean classes as well?

Thanks
18 years ago
JSP
Can you give some more details. Where/ how is tomcat installed ? Have you left the samples in the original place or have you moved them around ? When you say not working , what error messages are you getting ? There are several examples - which of these are not working?
What troubleshooting have you done so far?
18 years ago
JSP