Difference between pages "Installing a Logger" and "Installing Java"

From Funtoo
(Difference between pages)
Jump to: navigation, search
m
 
 
Line 1: Line 1:
== Introduction ==
+
== What is Java? What purpose does it serve? ==
In case you ever need to view important system messages, it is a wise idea to install a system logger. System loggers create log files that contain system messages, and stores these logs in <tt>/var/log</tt>. Several different loggers exist. Listed below are some of the more commonly used loggers:
+
==== Definition ====
* '''Metalog''' - "Metalog is a modern replacement for syslogd and klogd. The logged messages can be dispatched according to their facility, urgency, program name and/or Perl-compatible regular expressions." This is a good, light-weight logger that is often used for desktop systems. ([http://metalog.sourceforge.net Metalog homepage])
+
"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])  
* '''Syslog-ng''' - "syslog-ng is the trusted log management infrastructure for hundreds of thousands of users worldwide. Organizations use syslog-ng to reliably and securely collect, process and store log messages from across their IT environments." syslog-ng is often used when more advanced logging functionality is required, and is highly customizable. ([http://balabit.com/network-security/syslog-ng Syslog-ng homepage])
+
== Installing java ==
* '''Rsyslog''' - "rsyslog is an alternative logger to syslog-ng and offers many benefits over syslog-ng. rsyslog is also the default logger for the latest versions of Red Hat Enterprise Linux, as well as many other Linux distributions." ([http://wiki.archlinux.org/index.php/rsyslog Arch wiki page])
+
==== Emerging java ====
 
+
To install java, run the following command:
== Installation and adding to runlevel ==
+
To install a logger, run the following command:
+
 
<console>
 
<console>
###i## emerge --ask metalog
+
##r## # ##b##emerge -av virtual/jdk
  
These are the packages that would be merged, in order:
+
##g##These are the packages that would be merged, in order:
  
 
Calculating dependencies... done!
 
Calculating dependencies... done!
[ebuild  N    ] app-admin/metalog-3-r1 USE="unicode" 353 kB
+
[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] ##b##yes
 +
</console>
  
Total: 1 package (1 new), Size of downloads: 353 kB
+
== Testing to see if it emerged ==
Would you like to merge these packages? [Yes/No] ##i## yes
+
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 ...]'''
  
 +
==== 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>
 
</console>
  
After installing the logger, we have to add its initialization script to RC’s default runlevel. The default runlevel, defined at /etc/runlevels/default, contains symbolic links to all system initialization scripts that are run by default. To add the logger to the runlevel and then start the logger, run the following:
+
Running code:  
 
<console>
 
<console>
###i## rc-update add metalog default
+
##bl##$ ##b##java -cp bin;lib/lib1.jar;lib/lib2.jar com.example.Application
* service metalog added to runlevel default
+
###i## rc
+
* Starting metalog ...
+
 
</console>
 
</console>
  
== Stopping the service ==
+
Running a jarfile:
If you need to stop the service manually, you can run its initialization script directly from /etc/init.d:
+
 
<console>
 
<console>
###i## /etc/init.d/metalog stop
+
##bl##$ ##b##java -jar Application.jar
* Stopping metalog ...
+
 
</console>
 
</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]]
 
[[Category:System]]

Revision as of 17:34, 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

Emerging java

To install java, run the following command:

 # emerge -av virtual/jdk

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

Sources

(Information provided for example command usage)