gunjan

Ranch Hand
+ Follow
since Jan 28, 2000
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 gunjan

Friends:
It was missing tools.jar in the classpath. Now it works fine with tools.jar in the classpath
Gunjan
19 years ago
Friends:<br>
Greetings to all.<br>
I tested Tomcat 3.1 on Windows NT. It works great.
But our developers use Windows 98 laptops with JDK1.2.2. So I have been trying to get Tomcat 3.1 working on Windows 98. But it is getting very frustrating as I keep on getting errors on startup.
<br>
This is NOT a out of environment space problem. I have already fixed that.
<br>
Also I have my JAVA_HOME set to c:\JDK1.2.2 and TOMCAT_HOME set to C:\jakarta-tomcat as per my machine setup. Also I have the classpath set up to contain c:\jdk1.2.2\lib\tools.jar
<br>
Details of the error:
1. I started Tomcat 3.1 using startup bat file<br>
2. It starts another window. Gives the some exception and shuts down the new window. I cannot record the exception as I do not know how to increase the window height to more that 50 lines and the exception goes to more than 50 lines. The exception is for sure related to XML as I see that org.apache.jasper being mentioned<br>
3. To record the exception, I edited the tomcat.bat file to remove the start command in front of java and hence know the startup process takes place in the same window. <br>
4. Now I do not get the exception. But my JSPs do not work and I get the following exception:
Unhandled error! You might want to consider having an error page to report such
errors more gracefully
java.lang.NoClassDefFoundError: sun/tools/javac/Main
at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.ja
va:128)<br>
at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled C
ode)<br>
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)<br>
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessar
y(JspServlet.java:149)
<br>
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspSer
vlet.java:161)
<br>
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:2
61)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compile
d Code)
<br>
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
<br>
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
va, Compiled Code)
<br>
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559
)
<br>
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:160)
<br>
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.j
ava, Compiled Code)
<br>
at java.lang.Thread.run(Thread.java:479)
<br>
<br>
Any help will be appreciated.
<br>
Best Regards<br>
Gunjan
19 years ago
Check out the errata for the RHE. There are lots of modifications mentioned for the book. Every one using RHE should get the errata. They modify the statement transient variables cannot be static and final.
Remember transient variables can be static and final.
Only thing that is important from serialization point of view is that transient and static variables are not serialized.
Regards
Gunjan
Vijay
We usually use the term overriding in context of polymorphism. Private methods do not participate in this. So the answer of 1 should be false.

Gunjan
Deepa:
This is the case of conversion. At compile time the true nature of the class is not evaluated. The check is made between reference types.
Therefore at compile time obj is of type Object and hence it is wrong to assign it to Observer type as Object does not implement Observer.
Regards
Gunjan
Deepa:
It really helps to think that there are two criteria that you have to check
1. Whether it is conversion. If it is, then there are only compile time rules
2. Whether it is casting. If yes then there are compile time and run time rules
Regards
Gunjan
Deepa:
A]In the first case, the obj of type Object. The true nature of the class that the obj reference points to is ApBase . But at compile time the true nature of the class is not evaluated. Checks are made only between the reference type. Here you are trying to assign a Object type to Runnable.
Java is a strongly typed language. It does not allow assignments of subclasses or interfaces to superclasses. You have to use the casting operator
B] This is OK. At compile time you can always cast between any non final object and interface. But at run time if the new type is a interface, then the class must implement that interface. Both of which are happening here. So it is right.
C]At compile time you can always cast between any interface and any non final object. There is no problem. However the rule at runtime says that if the new type is a interface then the class must implement that interface. And hence is a error
D]Here you are not casting. It is a conversion. The rules for conversion say that if the new type is a interface, the class on the right hand side must implement the interface
Regards
Gunjan
Hi:
So the child thread can keep kicking even when the parent dies.
FYI, JVM also dies when the System.exit or exit method of Runtime is called.
Regards
Gunjan
Hi:
I ran across a question that asked about non sorted and ordered collection. What is non sorted and ordered together mean. I used to think that all ordered classes are sorted ones.
Can anyone please list some of non sorted ordered collection classes. I felt all the classes that implement the Set interface are ordered.
One more thing, does enumerated class mean the class that provide iterator methods.
Thanks in advance
Gunjan
Referring to Java API http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html
read() method is abstract.
The other two overloaded methods
read(byte[] b, int off, int len)
read(byte[] b) are not abstract.
But read() is abstract. That means when you say System.in.read() you are calling a abstract method. Why does read method still work.
Gunjan
Friends:
System.out is a static reference to the PrintStream class. PrintStream class has println methods which are non static. That is System.out.println("test");
println is a non static method of class PrintStream.
My question is that can one invoke a non static method using a static reference, without the instance not even existing
Any help appreciated.
Also look at other post on read method.
Thanks in advance
Gunjan
Friends:
'in' is a static and final member of the System class.
in is a reference to the InputStream class
InputStream class is itself a abstract class and read method of the InputStream class is itself abstract.
My question is how can you invoke a abstract method of a abstract class and still get the desired working. abstract methods do not have any method body.
THat is System.in.read() works.
My second question will be in another post regarding System.out
Any help appreciated
Gunjan
Can anyone please explain the difference between the two types: green threads and native threads
Any help appreciated.
GUnjan
As of c, I am also confused. In fact a program below
class TestFinalize
{
protected void finalize()
{
System.out.println("JavaRanch");
}
public static void main(String[] args)
{
TestFinalize tf = new TestFinalize();
}
}
runs fine, no errors.
However, the java tutorial, last paragraph says that http://java.sun.com/docs/books/tutorial/java/javaOO/garbagecollection.html
"If you override finalize, then your implementation of the method
should call super.finalize as the last thing it does"
Regards
Gunjan
public modifer is not required in main with Java 2. It even compiles and runs without public, that is static void main(String args[]) is enough.
It has to be static
It has to be return type as void.
It has to have a array of string as parameter. { Without this argument, the program will compile, but not run.
Regards
Gunjan
[This message has been edited by gunjan (edited February 19, 2000).]