LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-03-2012, 02:29 AM   #1
hitesh03
LQ Newbie
 
Registered: Mar 2012
Location: India
Distribution: ubuntu 11.10
Posts: 2

Rep: Reputation: Disabled
Unhappy installation and configuration of java in ubuntu 11.10


hii there, i have recently installed java from the package that i've downloaded from oracle's site manually.
but when i try to complie any java program,terminal says 'javac not found'.probably it may be arised due to no path set for java.

i've also installed open jdk-7 also.
so please help me out in this topic.
 
Old 03-03-2012, 03:32 AM   #2
cin_
Member
 
Registered: Dec 2010
Posts: 281

Rep: Reputation: 24
gcj()

What command are you using to compile your java program?

gcj() should come standard with all up to date linux environments... certainly your Ubuntu 11.10.

check out ...
Code:
man gcj
An example of use...

Code:
class QuickOut{
	public static void main(String args[])
	{
	try{
	    String QCK_OUT = "hazzah";
	    System.out.println(QCK_OUT);
	}catch (Exception e){System.err.println("Error: " + e.getMessage());}
	} 
}
Code:
# gcj --main="QuickOut" quickOut.java -o quickOut
# ./quickOut
hazzah

Last edited by cin_; 03-03-2012 at 03:34 AM. Reason: gramm`err
 
Old 03-04-2012, 06:51 AM   #3
hitesh03
LQ Newbie
 
Registered: Mar 2012
Location: India
Distribution: ubuntu 11.10
Posts: 2

Original Poster
Rep: Reputation: Disabled
it says in terminal -"The program 'gcj' is currently not installed. You can install it by typing:
sudo apt-get install gcj-jdk"

but i'm asking for how to make use of 'javac'.
 
Old 03-04-2012, 07:38 AM   #4
cin_
Member
 
Registered: Dec 2010
Posts: 281

Rep: Reputation: 24
$PATH

I use gcj().

But as far as your problem it doesn't sound javac() specific. Just sounds like a PATH issue.
You can check with...
Code:
# which javac
which: no javac in ($PATH)
# whereis javac
javac:
My results because I do not use javac().

If you manually installed it, that is, not from a package manager like apt-get(), you may need to update your PATH to include the folder where you placed the necessary binaries.
A simple process, just type...
Code:
# PATH=$PATH:/dir/to/JDK/binaries/
This tells your system that if a command is called you should look in all of the places you normally look and now also look in this directory as well.

Or, you could use ln() to create a link...
Code:
# ln -s /dir/to/YOUR_JDK/bin/javac /usr/bin/javac

Last edited by cin_; 03-04-2012 at 07:46 AM. Reason: gramm`err
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
suggested addition to java installation instructions under Mint Ubuntu micheletrecaffe Linux Mint 4 03-13-2012 03:26 PM
Java EE installation gets stuck at 45%!!! Ubuntu 11.04 mprogrammer Linux - Software 1 05-26-2011 02:13 AM
JAMES (Java Apache Mail Enterprise Server) - Installation/Configuration Problem kazmiM Solaris / OpenSolaris 2 02-23-2011 02:24 PM
Having Java installation Problems on Ubuntu 10.10 Mentate Linux - Newbie 1 02-06-2011 12:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration