ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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
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?
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).
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:~$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.