Results 1 to 5 of 5

Thread: javac

  1. #1
    Join Date
    Feb 2012
    Beans
    3

    javac

    Hello !

    I have problem with my java instalation, i can compile java code with Eclipse IDE but i cannot compile on terminal ( with javac ) ... i couldn't find any solution on older posts and i'm a bit confused...
    i think i have messed up my system :S

    related commands & output:

    Code:
    username$ lsb_release -r
    Release:    11.10
    ubuntu 11.10 (x64)
    .

    Code:
    username$ java -version
    java version "1.6.0_23"
    OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
    OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
    username$
    .

    Code:
    username$ javac
    The program 'javac' can be found in the following packages:
     * openjdk-6-jdk
     * ecj
     * gcj-4.4-jdk
     * gcj-4.6-jdk
     * gcj-4.5-jdk
     * openjdk-7-jdk
    Try: sudo apt-get install <selected package>
    username$
    .

    Code:
    username$ sudo apt-get install openjdk-6-jdk
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    openjdk-6-jdk is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    username$
    .

    Code:
    trying to compile with Geany i get the msg:
    
    javac "HelloWorld.java" (in directory: /home/username)
    Compilation failed.
    /bin/sh: javac: not found
    .

    Code:
    username$ cat HelloWorld.java 
    class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World!");
        }
    }
    username$ 
    Last edited by uburudu; February 3rd, 2012 at 12:12 PM.

  2. #2
    Join Date
    Sep 2011
    Location
    UK
    Beans
    76
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: javac

    It looks like you have javac already installed. If you execute

    $ which javac

    Does it show you the installation path?

    I've found java 7 to be better. Have you tried using that version?

  3. #3
    Join Date
    Feb 2012
    Beans
    3

    Re: javac

    Code:
    username$ which javac
    username$
    it doesn't give me any output

    but with " $ locate javac " i can see a path " /usr/lib/jvm/java-6-openjdk/bin/javac "

    -

    i tried
    sudo apt-get openjdk-7-jdk
    yesterday with the same results

  4. #4
    Join Date
    Feb 2012
    Beans
    3

    Re: javac

    not sure if there is a better solution

    but i made manually a javac link at "/usr/bin/" dir and it fixed my problem

    Code:
    username~$ sudo ln -s /usr/lib/jvm/java-6-openjdk/bin/javac /usr/bin/javac

    thnx for the reply @doobrie, and my friend MITSARAS !

    KOSEOS!
    bb

  5. #5
    Join Date
    Sep 2011
    Location
    UK
    Beans
    76
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: javac

    For some reason you have the compiler installed, but it wasn't in your path (hence making the link worked).

    Making the link is a good solution.

Bookmarks

Posting Permissions

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