Difference between pages "Gentoo Prefix On Mac OS X" and "Installing Java"

From Funtoo
(Difference between pages)
Jump to: navigation, search
 
(More Information)
 
Line 1: Line 1:
There is a way to install Gentoo so that it runs within Mac OS X. This install method is called "Gentoo Prefix".
+
== What is Java? What purpose does it serve? ==
 +
==== Definition ====
 +
"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])
 +
== Installing java ==
 +
==== Editing your make.conf ====
 +
To tell portage that we would like java pulled in the next time it is updated, we need to do the following:
 +
<console>
 +
##r## # ##b##nano /etc/portage/make.conf
 +
</console>
 +
Running that command should present you with a file containing something similar to this:
 +
[[File:Make conf example.png|thumbnail|left|An example make.conf]]
  
There is a handy script you can use to install Gentoo Prefix on any Mac OS X machine.  
+
In the file, if it does not exist, create a line like the following:
 +
<console>
 +
##b##USE="java"
 +
</console>
 +
Press Ctrl+X , then y, then enter to write the changes to the file.
  
== Requirements ==
+
==== Emerging java ====
 +
To install java, run the following command:
 +
<console>
 +
##r## # ##b##emerge --ask --update --newuse --deep @world
  
For Gentoo Prefix installation to work, you must have the Xcode command-line tools installed, so that a compiler toolchain exists. Here are the steps to install the Xcode command-line tools:
+
##g##These are the packages that would be merged, in order:
  
# Install Xcode itself from the Apple Mac OS X install media. If you are using Mac OS Lion, then the Apple App Store has Xcode available. Search for "Xcode" and you will be able to download and install it.
+
Calculating dependencies... done!
# Now, start Xcode.
+
[ebuild  N    ] dev-java/java-config-wrapper-0.16  8 kB
# Go to the Xcode menu, then Preferences, then the Downloads tab.
+
[ebuild  N    ] sys-apps/baselayout-java-0.1.0  71 kB
# Click "Install" next to "Command Line Tools".
+
[ebuild  N    ] dev-java/java-config-2.2.0-r1000:2  PYTHON_ABIS="2.7 3.3 -2.6 -3.1 -3.2 (-3.4)" 51 kB
# You will need to log in with your Apple Developer ID for the download to continue.
+
[ebuild  N    ] app-admin/eselect-java-0.1.0  71 kB
 +
[ebuild  N    ] dev-java/icedtea-bin-7.2.3.9:7  USE="X alsa cups -cjk -doc -examples -nsplugin -source" 47,781 kB
 +
[ebuild  N    ] virtual/jdk-1.7.0:1.7  0 kB
 +
[ebuild  N    ] virtual/jre-1.7.0:1.7  0 kB
 +
Would you like to merge these packages? [Yes/No] ##b##yes
 +
</console>
  
Here's how you do it. As root (<tt>sudo su -</tt>), type:
+
== Testing to see if it emerged ==
 +
To check that java installed on your system, run the following command:
 +
<console>
 +
##b##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>
 +
== 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 ...]'''
  
The <tt>EPREFIX</tt> variable controls the install location. The default is <tt>~/gentoo</tt>.
+
==== Example command usage ====
 +
Compiling code:
 +
<console>
 +
##bl##$ ##b##javac -d bin -sourcepath src -cp lib/lib1.jar;lib/lib2.jar src/com/example/Application.java
 +
</console>
 +
 
 +
Running code:
 +
<console>
 +
##bl##$ ##b##java -cp bin;lib/lib1.jar;lib/lib2.jar com.example.Application
 +
</console>
  
 +
Running a jarfile:
 
<console>
 
<console>
$ ##i##wget http://www.cs.stonybrook.edu/~ryao/prefix-install.sh && chmod u+x ./prefix-install.sh && env MAKEOPTS=-j5 ./prefix-install.sh
+
##bl##$ ##b##java -jar Application.jar
 
</console>
 
</console>
  
Bam!
+
== 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]
  
Now, let's work on Funtoo Prefix :)
+
== Sources ==
 +
([http://www.sergiy.ca/how-to-compile-and-launch-java-code-from-command-line/ Information provided for example command usage])
  
[[Category:Featured]]
+
[[Category:System]]

Revision as of 17:23, 28 October 2013

What is Java? What purpose does it serve?

Definition

"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)

Installing java

Editing your make.conf

To tell portage that we would like java pulled in the next time it is updated, we need to do the following:

 # nano /etc/portage/make.conf

Running that command should present you with a file containing something similar to this:

File:Make conf example.png
An example make.conf

In the file, if it does not exist, create a line like the following:

USE="java"

Press Ctrl+X , then y, then enter to write the changes to the file.

Emerging java

To install java, run the following command:

 # emerge --ask --update --newuse --deep @world

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] dev-java/java-config-wrapper-0.16  8 kB
[ebuild  N     ] sys-apps/baselayout-java-0.1.0  71 kB
[ebuild  N     ] dev-java/java-config-2.2.0-r1000:2  PYTHON_ABIS="2.7 3.3 -2.6 -3.1 -3.2 (-3.4)" 51 kB
[ebuild  N     ] app-admin/eselect-java-0.1.0  71 kB
[ebuild  N     ] dev-java/icedtea-bin-7.2.3.9:7  USE="X alsa cups -cjk -doc -examples -nsplugin -source" 47,781 kB
[ebuild  N     ] virtual/jdk-1.7.0:1.7  0 kB
[ebuild  N     ] virtual/jre-1.7.0:1.7  0 kB
Would you like to merge these packages? [Yes/No] yes

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)

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

Java SE at Oracle.com Wikipedia article Very informative tutorials

Sources

(Information provided for example command usage)