Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My java and javac exes are running on different versions...[unsolved]

 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I earier had JDK 1.4.2 and now using JDK 1.5.0 . But somehow I do not know that javac is running with JDK 1.5.0 version compiler and java is running with JDK 1.4.2 java.exe. How can I tell the java.exe file to use JDK 1.5.0 java.exe file???

Here is something I observed....


[ January 03, 2006: Message edited by: Raghavan Chockalingam ]

[ January 03, 2006: Message edited by: Raghavan Chockalingam ]
[ January 04, 2006: Message edited by: Raghavan Chockalingam ]
 
Praveena Jayanthi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use "java -version" at the command prompt to give you the version of java you are using.
 
Praveena Jayanthi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry for not completing my reply and it was submitted.

You could be having problems with PATH and CLASSPATH environment variables. The probable reason could be that you have appended the new path to java 1.5 but did not delete the prior path entry. So it always finds 1.4 first.
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already ran the command and the result is in the first post...pls look out for different versions reported by JVM...
 
Jeremy Botha
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

if you're running java under a windows environment, do the following:

click the start button, select 'run', hen type regedit and hit enter. This will launch the regedit program.

Browse through the keys till you find the key
HKEY_LOCAL_MACHINE/Software/Javasoft/Java Development Kit. Select this key in the left hand pane. In the right hand pane, ensure that CurrentVersion is set to 1.5. Also, check that you have a 1.5 key under the currently selected key in the tree.

Then, select the Java Runtime Environment key. Check this is also set to 1.5

What I suspect happened is that you installed the 1.4.x Development Kit, then installed the 1.5 Runtime Environment. From what I recall, javac runs from the development kit, and java runs from the Runtime environment by default

*shrugs* hope this helps.
 
Raghavan Chockalingam
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right...registry had full or 1.4.2 entries...I tried to replace them with 1.5.0 but did not work so I deleted all those 1.4.2 entries and installed jdk1.5.0 again now the registry has only 1.5.0 entries...

but I believe there is some problem lurking...cos when i try to run this program...it gives up this error...why is this error comin up..


Code for CreateTable.java
 
Mateus Hooker
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raghavan,

This is a classpath issue. The class you are trying to run is not specified in your classpath.

See : http://www.dynamic-apps.com/tutorials/classpath.jsp

Hope this helps
 
omar bili
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
you can set it in the envirement variables
which can be accessed from my computer -> propreties -> advanced -> envirement variables, edit the path variable and add:
<location where jdk 1.5 is installed> / bin ;
add it at the beginning of the path variable.
Omar
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raghavan,
If I were you I would invest the time in learning how to build and run your classes with ANT. Another tip would be to write unit tests for your classes and have ANT run the unit tests for you, so as to ensure that you logic is correct.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic