Showing posts with label console. Show all posts
Showing posts with label console. Show all posts

2012-12-28

How to install Jena command line tools?

Apache Jena is an open-source library for building Semantic Web applications using the Java programming language.
At the core of the library is a RDF implementation.
The SPARQL query language can be used to query RDF models.

The distribution includes a set of command line tools that can be very useful.
To install them, follow the next steps:

1. Download Jena binaries from http://www.apache.org/dist/jena/

2. Unzip file to an installation folder

3. Define the environment variable JENAROOT

4. Add %JENAROOT%\bat to the PATH environment variable

At the present moment, the following tools are available:

qtest
query
rdfcat
rdfcompare
rdfcopy
rdfparse
rset
RuleMap
schemagen
sparql
turtle
version

Consult the javadoc (jena package) for more details.

2012-11-30

How to install Groovy on Windows?

Groovy is a great scripting language for the Java platform.

The first step to install it is to download the archive (ZIP).
http://groovy.codehaus.org/Download?nc

The second step is to unzip to a folder.
For example, C:\Java\groovy\2.0.5

Set GROOVY_HOME to the installation folder.

Then, edit the PATH variable, to add, in the beginning:
%GROOVY_HOME%\bin;

Finally, open a new console and execute the following command that should print the installed Groovy version:
groovy -version

How to install the Java Developer Kit on Windows?

The first step is to download the installation package.
The file to get is the Java Developer Kit (JDK)
http://www.oracle.com/technetwork/java/javase/downloads/index.html

The second step is to execute the installer.

To compile and execute Java programs in the console, a few environment variables must be set.

Set JAVA_HOME to the installation folder.
For example, C:\Java\jdk\1.7.0_09

Then, edit the PATH variable, to add, in the beginning:
%JAVA_HOME%\bin;

Finally, to check if everything is OK, open a new console and execute the following commands that should print the installed Java version number:
javac -version
java -version 

That's it! Happy coding!

How to set environment variables in Windows?

Environment variables are values that, once set, become available to all programs running in the computer.

The value of an environment variable can be used like this: %name%. Typically, environment variables are used to specify program paths and settings.

Some environment variables are set by Windows.
%ProgramFiles% holds the value of the program folder (english Windows: C:\Program Files; portuguese Windows: C:\Programas).
%UserName% holds the user name of the user in session.
%UserProfile% holds the home folder of the user in session.

One of the most used environment variables is PATH, that specifies where the operating system looks for programs.
Folders are separated by the ; character.

To see the value of PATH, execute ECHO %PATH% in the console.
Also, the SET command can print and set environment variables.


To set environment variables permanently on Windows, go to Computer System Properties, Advanced, Environment Variables. The following screen-shots illustrate this procedure for Windows 7.




Environment variables can be defined for the current user (user) or for all users (system).


The new settings only take effect for new consoles.

2012-03-09

Data compression and archiving

An archive file is a file containing several files and directories.

bzip2 -d filename
decompress archive file

tar -xvf filename
extract

tar -cvf filename dir ...
create

tar -zcvf filename dir ...
create a zipped tar file

2012-03-08

Disk Usage (du)

du -h
human readable option - displaying output in kilobytes (K), megabytes (M) and gigabytes (G) rather than just in the default kilobytes

du -sh
summary option - report only the total disk space occupied by a directory tree and to suppress individual reports for its subdirectories

2011-04-06

How to redirect stdout and sterr to a file in Windows

compute.bat > compute.output 2>&1
"compute.bat" is the command we are executing.
"> compute.output" redirects the console output to a file called compute.output. If ">>" was used instead, the file would be appended.
"2>&1" redirects stderr (2) to where stdout (1) is directed

Reference: StackOverflow post