Hi I am compiling a java class which does not have any reference to StringBuilder calss. When I compile it is creating StringBuilder reference in .class file. Once I compiled successfully then I ran the java class file then I am getting run time error " java.lang.StringBuilder classdef not found error. Then I search all the files for "StringBuilder" in the file system then it shows the .class file which I compiled. Then I opened the file and be able to see reference for StringBuilder.
My Question: Why it is creating a reference to StringBuilder ? I am using java 1.4 compiler. Also, I have previous version of .class file for this java file . I opened that file but surprisingly that file does not have any reference to StringBuilder. previous version and the version I used for compilation have exactly same source.
Ohh I see, some how I am using ver 5 ? Here is my results. What is teh difference between javac -J-version and java -version ? One is compiler and another is for JAVA ? How can I use 1.4 for both compiling and running ?
Thanks very much for your reply.
java version "1.4.2_12" ============================= Java(TM) 2 Runtime Environment, Standard Edition (build 1.4 Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
When I say javac -J-version ============================== java version "1.5.0_11" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03) Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
How can I use 1.4 for both compiling and running ?
First, you need to confirm that you actually have the java 1.4 compiler installed. If your path points to Java 5 for the compiler and Java 1.4 for the JVM, I am guessing that you don't have the 1.4 JDK installed.
Joined: Sep 09, 2008
I do have both 1.4 and 1.5. Now I chnaged my PATH setting so that it can look only 1.4. Now it's working. Both java and javac are looking for 1.4.
Thanks veru much for your time. Your comments definitely helped me. thanks very much.