Difference between pages "User:Psychopatch" and "Installing Java"

From Funtoo
(Difference between pages)
Jump to: navigation, search
 
(Options for JRE and JDK)
 
Line 1: Line 1:
{{Person
+
== What is Java? What purpose does it serve? ==
|Full name=Patrick Creech
+
|Email=psychopatch@funtoo.org
+
|Nick=psychopatch
+
|Geoloc=35.529051, -77.4010762
+
|Location name=Winterville, North Carolina, United States of America
+
|Roles={{Role
+
|Role type=Staff
+
|Role desc=Core Team
+
|Start date=2012/11/20
+
}}
+
|Maintains=
+
|Blogs=
+
}}
+
== Personal History ==
+
I was born Jan 7, 1985 and raised outside of Zebulon, NC in a small community known mainly for farming.  I grew up drawing images with basic, and did my first ram upgrade on the family 386 when I was 8. I got my BS in Computer Science from East Carolina University (GO PIRATES!!!), and haven't left the Greenville/Winterville area since.  I have been professionally developing in .NET for the past 2 years.
+
  
== Linux History ==
+
"Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!" ([http://www.java.com/en/download/faq/whatis_java.xml Oracle page on Java])
I heard about Linux in high school while trying to learn c/c++. I have tried many versions of linux, from ubuntu to lfs, and am looking forward to lending my skill set to Funtoo.
+
 
 +
=== JRE vs. JDK ===
 +
* '''JRE''': Just the Java Virtual Machine.
 +
* '''JDK''': The Java Software Development Kit - this includes command line tools for launching <code>.jar</code> files, the JRE, compilers, and tools for creating Java-based programs.
 +
 
 +
== Installing java ==
 +
=== Options for JRE and JDK ===
 +
On Funtoo, there are several different java packages that you can emerge:
 +
* '''{{Package|virtual/jre}}''' - When you emerge this, it pulls in the java runtime environment for your current profile.
 +
* '''{{Package|virtual/jdk}}''' - When you emerge this, it pulls in the java development kit for your current profile.
 +
* '''{{Package|dev-java/icedtea}}''' - A Gentoo-made binary of the IcedTea JDK, this is the JDK pulled in when you emerge <code>virtual/jdk</code> on the desktop profile.
 +
* '''{{Package|dev-java/oracle-jdk-bin}}''' - Oracle's version of the Java Development Kit. This package and <code>dev-java/oracle-jre-bin</code> both require you to manually download the file and place it in <code>/usr/portage/distfiles</code> due to the fact that Oracle wants you to accept a license before downloading the package.
 +
* '''{{Package|dev-java/oracle-jre-bin}}''' - Similar to the above, this only includes the Java Runtime Environment.
 +
Oracle's version of JAVA is default in Funtoo .
 +
 
 +
=== Emerging java -- {{Package|virtual/jdk}} method ===
 +
To install java, run the following command:
 +
<console>
 +
###i## emerge virtual/jdk
 +
</console>
 +
 
 +
== Testing to see if it emerged ==
 +
To check that java installed on your system, run the following command:
 +
<console>
 +
$##i## java -version
 +
</console>
 +
If you get something like this, you are ready to use java!:
 +
<console>
 +
java version "1.7.0_21"OpenJDK Runtime Environment (IcedTea 2.3.9) (Gentoo build 1.7.0_21-b02)OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
 +
</console>
 +
 
 +
To be double sure that the java package you emerged is functional, you can run the following:
 +
<console>
 +
$##i## java-config --list-available-vms
 +
The following VMs are available for generation-2:
 +
*)      IcedTea JDK 7.2.3.9 [icedtea-bin-7]
 +
</console>
 +
 
 +
== Using the java command ==
 +
==== Overview of the command ====
 +
The java command can be run like so:
 +
* '''java [options] class [argument ...]'''
 +
* '''java [options] -jar file.jar [argument ...]'''
 +
 
 +
==== Example command usage ====
 +
Compiling code:
 +
<console>
 +
$##i## javac -d bin -sourcepath src -cp lib/lib1.jar;lib/lib2.jar src/com/example/Application.java
 +
</console>
 +
 
 +
Running code:
 +
<console>
 +
$##i## java -cp bin;lib/lib1.jar;lib/lib2.jar com.example.Application
 +
</console>
 +
 
 +
Running a jarfile:
 +
<console>
 +
$##i## java -jar Application.jar
 +
</console>
 +
 
 +
== More Information ==
 +
* [http://docs.oracle.com/javase/ Java SE at Oracle.com]
 +
* [http://en.wikipedia.org/wiki/Java_(programming_language) Wikipedia article]
 +
* [http://docs.oracle.com/javase/tutorial/ Very informative tutorials]
 +
 
 +
== Sources ==
 +
([http://www.sergiy.ca/how-to-compile-and-launch-java-code-from-command-line/ Information provided for example command usage])
 +
 
 +
[[Category:System]]

Revision as of 07:33, 7 March 2014

Contents

What is Java? What purpose does it serve?

"Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!" (Oracle page on Java)

JRE vs. JDK

  • JRE: Just the Java Virtual Machine.
  • JDK: The Java Software Development Kit - this includes command line tools for launching .jar files, the JRE, compilers, and tools for creating Java-based programs.

Installing java

Options for JRE and JDK

On Funtoo, there are several different java packages that you can emerge:

  • virtual/jre - When you emerge this, it pulls in the java runtime environment for your current profile.
  • virtual/jdk - When you emerge this, it pulls in the java development kit for your current profile.
  • dev-java/icedtea - A Gentoo-made binary of the IcedTea JDK, this is the JDK pulled in when you emerge virtual/jdk on the desktop profile.
  • dev-java/oracle-jdk-bin - Oracle's version of the Java Development Kit. This package and dev-java/oracle-jre-bin both require you to manually download the file and place it in /usr/portage/distfiles due to the fact that Oracle wants you to accept a license before downloading the package.
  • dev-java/oracle-jre-bin - Similar to the above, this only includes the Java Runtime Environment.

Oracle's version of JAVA is default in Funtoo .

Emerging java -- virtual/jdk method

To install java, run the following command:

# emerge virtual/jdk

Testing to see if it emerged

To check that java installed on your system, run the following command:

$ java -version

If you get something like this, you are ready to use java!:

java version "1.7.0_21"OpenJDK Runtime Environment (IcedTea 2.3.9) (Gentoo build 1.7.0_21-b02)OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

To be double sure that the java package you emerged is functional, you can run the following:

$ java-config --list-available-vms
The following VMs are available for generation-2:
*)      IcedTea JDK 7.2.3.9 [icedtea-bin-7]

Using the java command

Overview of the command

The java command can be run like so:

  • java [options] class [argument ...]
  • java [options] -jar file.jar [argument ...]

Example command usage

Compiling code:

$ javac -d bin -sourcepath src -cp lib/lib1.jar;lib/lib2.jar src/com/example/Application.java

Running code:

$ java -cp bin;lib/lib1.jar;lib/lib2.jar com.example.Application

Running a jarfile:

$ java -jar Application.jar

More Information

Sources

(Information provided for example command usage)