Results 1 to 5 of 5
  1. #1
    hamster is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Eclipse IDE JDK environment setup

    Hi Folks,

    I am currently fighting my Eclipse java IDE to compile:

    Java Code:
    public class PrintTest {
      public static void main(String[] args) {
        System.out.println("Start of Test");
        System.out.printf("% ,.2f\n% ,.2f\n", 1234567.123, -1234567.123);
        System.out.println("End of Test");
      }
    }
    This works in a terminal window fine but not in eclipse (anything not prinf() works). Old threads suggest to check jdk version. So i did that today removed OpenJDK packages and installed Oracle's. My platform is Ubuntu and it lives in /usr/lib/jvm

    I did verify the version is oracle's

    hamster@titan:/usr/lib/jvm$ java -version
    java version "1.7.0_04"
    Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

    hamster@titan:/usr/lib/jvm$ javac -version
    javac 1.7.0_04

    As i said compiling under a terminal was fine and was able to run the .class file. So i checked Eclipse and the only place i can find where i set the environment is under Window - Preferences - Java - Installed JREs.
    Only java-7-oracle is there and it matches up with oracle's folder in /usr/lib/jvm/java-7-oracle and no reference to OpenJDK

    back at the terminal i checked the java-7-oracle is right and yep. The cmdline compile does pick that. The other folders still exist after their removal via the ubuntu software center.

    hamster@titan:/usr/lib/jvm$ ls
    default-java
    java-1.6.0-openjdk-amd64
    java-6-openjdk-amd64
    java-7-openjdk-common
    java-1.5.0-gcj-4.6
    java-1.7.0-openjdk-amd64
    java-6-openjdk-common
    java-7-oracle
    java-1.6.0-openjdk
    java-6-openjdk
    java-7-openjdk-amd64

    I could manually remove the OpenJDK folders in case they are still making some reference but Eclipse seems to say it is using java-7-oracle's (1.7).

    Just wondering if anyone had the same issue?

    Thanks,
    Hamster
    Last edited by hamster; 05-07-2012 at 05:15 AM.

  2. #2
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: Eclipse IDE JDK environment setup

    What does it mean "It does not work"...? What is your error message?
    EDIT: Maybe there is a conflict between a 32-bit version and your 64-bit installation?
    Last edited by Sierra; 05-07-2012 at 10:51 AM.
    I like likes!

  3. #3
    hamster is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Re: Eclipse IDE JDK environment setup

    I'm getting the message below in bold when compiling. Im pretty sure Eclipse is still referring to OpenJDK somehow. From the commandline java/javac work fine for this code.
    The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double, double)

    Again, i checked Eclipse and the only place i can find where i set the environment is under Window - Preferences - Java - Installed JREs. And there it is using Oracle's JDK. Unless there is another location to check. Any search indicates there to check.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Eclipse IDE JDK environment setup

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    hamster is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Re: Eclipse IDE JDK environment setup

    Fixed.
    I did a manual install of Oracle's JDK and JRE with purge for OpenJDK afterwards.
    Cleaned out the existing /usr/lib/jvm folders (that had old incompletely removed folders).
    Created a custom /usr/local/java for both JRE and JDK (both tar.gz were precompiled binaries from their website ver u4 of 1.7)
    Set those paths in /etc/profile so could access them on login. Platform Ubuntu 12.04 LTS.
    I did a symbolic link inside the plugins folder of firefox afterwards to make sure applets werent affected.

    offtopic - i have to say - im impressed with Ubuntu..all the options are still there under the hood.

    Thanks,
    Hamster

Similar Threads

  1. Eclipse Setup
    By smartino in forum New To Java
    Replies: 5
    Last Post: 10-31-2011, 04:19 AM
  2. java environment setup with eclipse
    By sueperg in forum Java Servlet
    Replies: 4
    Last Post: 09-14-2011, 08:41 PM
  3. Not able to see apache2 server in Eclipse WTP Setup
    By anupindi007 in forum Eclipse
    Replies: 1
    Last Post: 05-28-2011, 05:57 PM
  4. setup oc4j server in eclipse 3.3
    By mamri in forum Eclipse
    Replies: 0
    Last Post: 12-23-2008, 12:33 AM
  5. Eclipse Environment setup
    By mudgil.gaurav in forum Eclipse
    Replies: 1
    Last Post: 09-18-2008, 08:10 AM

Posting Permissions

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