LinuxQuestions.org
Register a domain and help support LQ
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 11-28-2008, 10:38 AM   #1
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Rep: Reputation: 16
Wink Java Compiler in Ubuntu?


Hi to all, I have a brief question:

When I type something that should be put in terminal, I use quotations, DO NOT use the quotations, I only use them to emphasise that what is inside the quotations should be typed as it is viewed by the reader, or to display the exact message that appears due to a command given.

How do I know if I have a Java Compiler in my Ubuntu Distribution?

For example, I know that most Linux (IFF not all) Distributions come with a C compiler (in my case, GCC). So, in order to check for a GCC compiler, all you do is go to (in Ubuntu 8.10) Applications>Acessories>Terminal, and type in:

"gcc" (Without quotations, of course)

If the GCC compiler is installed, you get a message that says:

"gcc: no input files" (Again, you wont see quotations)

Is there any similar way to do something like that for Java? If you need more information to answer my question, let me know, in detail, and I will provide it.

Rock on dudes and dudettes!

Peace,

MexDeath
 
Old 11-28-2008, 10:46 AM   #2
nc3b
Member
 
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
Following your method , in the terminal try

Code:
javac
PS, you might want to look at

Code:
dpkg -l
(since you are using ubuntu), or at least
Code:
which javac
Running a command just to see if it's there is not quite the best way to get info.

Cheers
 
Old 11-28-2008, 01:30 PM   #3
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
java -version
 
Old 11-28-2008, 05:11 PM   #4
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by jay73 View Post
java -version
This is what I get...

Quote:
The program 'javac' can be found in the following packages:
* gcj-4.2
* jikes-sun
* jikes-sablevm
* kaffe
* jikes-kaffe
* java-gcj-compat-dev
* ecj
* gcj-4.3
* cacao-oj6-jdk
* openjdk-6-jdk
* jikes-classpath
* sun-java5-jdk
* sun-java6-jdk
Try: sudo apt-get install <selected package>
 
Old 11-28-2008, 05:13 PM   #5
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by nc3b View Post
Following your method , in the terminal try

Code:
javac
Well, I tried that, and this is what I get, and, I dont recognize any of those as Java Compilers, maybe you do?

Here is what I get:

Quote:
The program 'javac' can be found in the following packages:
* gcj-4.2
* jikes-sun
* jikes-sablevm
* kaffe
* jikes-kaffe
* java-gcj-compat-dev
* ecj
* gcj-4.3
* cacao-oj6-jdk
* openjdk-6-jdk
* jikes-classpath
* sun-java5-jdk
* sun-java6-jdk
Try: sudo apt-get install <selected package>
 
Old 11-28-2008, 05:16 PM   #6
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by nc3b View Post

PS, you might want to look at

Code:
dpkg -l
(since you are using ubuntu)
Well, I also tried that, and I saw a bit more than 1,000 lines of different programs and applications and other goodies. However, I saw nothing related to Java...
I wont quote 1k plus lines of terminal output on this thread
 
Old 11-28-2008, 05:31 PM   #7
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
You want the sun-java6-jdk or the open source openjdk-6-jdk.
 
Old 11-28-2008, 08:49 PM   #8
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Choosing one.

Quote:
Originally Posted by jay73 View Post
You want the sun-java6-jdk or the open source openjdk-6-jdk.


Well, what is the difference, actually, which is more reliable?
Sun's or Open?
Also, like with OpenOffice, is this openjdk-6-jdk some sort of a project by Sun?
In either case, what do I do to use it? Do I have to instal it? Im relatively new to Linux (6 Months) and I have no clue as to what I should do after choosing any of them.


"Them" being (for anyone that wants to kick into this subject and help me out):
1. sun-java6-jdk
or
2. openjdk-6-jdk

Basically, my questions are:
1. What is the difference?
2. Does it matter?
3. How do I instal (If it isnt already)?
4. How do I make it work?

Thank you all!

 
Old 11-28-2008, 10:59 PM   #9
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
1. The Java language was invented and developed by Sun (yep, the guys who are also involved in Open Office). For many years, it was a proprietary language, which meant that it could not be freely distributed. This gave rise to open source alternatives that sought to reimplement the Java API. Most of these, however, were incomplete or lagged or had some other drawback so the Sun JDK remained the standard. Just last year, Sun changed their mind and released their JDK as open source. Now the problem is that some of the code in the Java API is owned by others and cannot be open sourced whether Sun want to or not. That is where the openjdk comes in: it seeks to rewrite those proprietary componenents in order to produce a jdk that is 100% as functional as the whole sun jdk without any proprietary element whatsoever.
2. For most purposes, no. The sun jdk does remain the reference implementation, though.
3. sudo aptitude install name_of_package (e.g. sudo aptitude install sun-java6-jdk).
4. nothing, on ubuntu, it should just work after doing 3 if you have not got any java package installed yet. If you have, then you need to switch the default (you can use galternatives to do so).
 
Old 11-29-2008, 04:59 PM   #10
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Thanks Jay, I'll see what happens...

Everybody put your helmets on!
 
Old 11-30-2008, 02:26 PM   #11
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
About my Java Compiler.

Alright, so, as "Jay73" said, I ran the following command:
Code:
sudo apt-get install sun-java6-jdk
This isntalled my Java Compiler, I bet. Then, just to make sure, is this what I should be getting when I type:
Code:
javac
This is what I get:
Code:
mexdeath@mexdeath-desktop:~$ javac
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files 
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

mexdeath@mexdeath-desktop:~$
Thank you.
 
Old 11-30-2008, 03:01 PM   #12
MexDeath
Member
 
Registered: Nov 2008
Location: Dallas
Distribution: Linux Mint, Mandriva, Gentoo.
Posts: 65

Original Poster
Rep: Reputation: 16
Never Mind... that is it. I got it to work. Thank you all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How can I install Java on Linux and any C compiler for Ubuntu? Please Help. markryansquall Linux - Newbie 7 10-30-2007 06:08 PM
Java compiler ctu_bauer Linux - Software 1 06-15-2006 02:35 PM
Java 1.5 Compiler KissDaFeetOfSean Linux - Newbie 5 07-10-2005 09:45 PM
java compiler bluknight43 Linux - Software 3 05-11-2005 02:57 AM
java compiler athenerx Programming 33 06-30-2004 03:21 PM


All times are GMT -5. The time now is 08:16 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration