Results 1 to 3 of 3
  1. #1
    siwelb is offline Member
    Join Date
    Apr 2010
    Posts
    2
    Rep Power
    0

    Default Compile problem when switching Java versions

    I am using alternatives to manager two versions of Java (1.5.0_10 and 1.6.0_16) on a RHEL5 machine. I hadn't been having any problems switching versions until just last week. When I executed "alternatives --config java" and changed the version to 1.6, I would run "java -version" but the version displayed would still be 1.5. So someone suggested removing JAVA_HOME (which had been set to the path of JDK 1.5) from the PATH environment variable. This actually solved the problem I was having but created another one. Now I am unable to compile any code (I get "-bash: javac: command not found"). I know for a fact that the path to JDK 1.6 is legit because "java -jar" is working (plus it wouldn't have even given me a version number if it had been wrong).

    Any suggestions?

    Thanks,
    Brian

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    The fact that java -jar works proves that the JRE paths are good, but doesn't give you any evidence about the JDK paths. If javac cannot be found, then your PATH environment variable is still wrong (or you don't have a JDK installed).

    -Gary-

  3. #3
    siwelb is offline Member
    Join Date
    Apr 2010
    Posts
    2
    Rep Power
    0

    Default

    I finally found a way to completely reset the java alternative symbolic links (rm /var/lib/alternatives/java) and then I went through the process of installing the various java versions. I did the same for javac (which I had never done before), and after this I was able to switch versions without any issues.

Similar Threads

  1. Java Versions
    By hiranya in forum New To Java
    Replies: 6
    Last Post: 10-27-2009, 01:42 PM
  2. Replies: 4
    Last Post: 01-01-2009, 05:21 PM
  3. Switching Careers to Java? It's never to late, is it?
    By /-ICEpik in forum Jobs Discussion
    Replies: 10
    Last Post: 12-30-2008, 06:03 PM
  4. Can I delete/uninstall older versions of Java?
    By LudwigKarl in forum New To Java
    Replies: 3
    Last Post: 03-19-2008, 11:23 AM
  5. Using different versions of Java
    By javaplus in forum New To Java
    Replies: 2
    Last Post: 01-04-2008, 09:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •