Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Saturday, January 30, 2016

[solved] jnlp files in Arch

A lot of proprietary garbage predictably relies upon one of the most proprietary of the proprietary: Oracle. The most famous collusion is to require Java for some (putatively) secure connection. How to do this from a Unix-based platform? Iced Tea is part of the answer.

# pacman -S icedtea-web
[select the jre8 option]
Note that path information may have to be modified. Installation notice:
For the complete set of Java binaries to be available
in your PATH, you need to re-login or source /etc/profile.d/jre.sh
Please note that this package does not support forcing
JAVA_HOME as former package java-common did

when you use a non-reparenting window manager, set
_JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh

Once all PATH information is set, logout, login, and run, eg:
$ javaws foo.jnlp

Saturday, November 29, 2014

[solved] arch - update and java

Following Oracle's purchase of Java (2010), Java users can't be certain when Oracle attorneys or developers might make users' lives uncomfortable. If one wants Java functionality however, Oracle can't be avoided entirely. I am not a lawyer, but Oracle's open-source version of Java, OpenJDK, may be the most legally prudent Java option. That said, not every application plays nice with OpenJDK, of course, or Oracle wouldn't be able to profit from licensing its more user-friendly proprietary versions of Java.

What has the above meant to me operationally? When upgrading Arch with OpenJDK onboard, I've sometimes experienced conflicts which required a solution of, 1) uninstalling Java, 2) running the Arch update(s), and, 3) reinstalling or upgrading to the latest OpenJDK.

Arch update Java conflicts may look something like these (during pacman -Syu):
error: failed to commit transaction (conflicting files)
java-runtime-common: /usr/bin/java exists in filesystem
java-runtime-common: /usr/bin/keytool exists in filesystem
java-runtime-common: /usr/bin/orbd exists in filesystem
java-runtime-common: /usr/bin/pack200 exists in filesystem
java-runtime-common: /usr/bin/policytool exists in filesystem
java-runtime-common: /usr/bin/rmid exists in filesystem
java-runtime-common: /usr/bin/rmiregistry exists in filesystem
java-runtime-common: /usr/bin/servertool exists in filesystem
java-runtime-common: /usr/bin/tnameserv exists in filesystem
java-runtime-common: /usr/bin/unpack200 exists in filesystem
java-runtime-common: /usr/lib/jvm/default exists in filesystem
java-runtime-common: /usr/lib/jvm/default-runtime exists in filesystem
Errors occurred, no packages were upgraded.

The shortest path appears to be removing "java-common". Not so fast: OpenJDK requires java-common as a dependency; pacman typically will not allow its removal. The solution is to remove OpenJDK (at this writing version 7), update the system, and then reinstall OpenJDK:
# pacman -Rns jre7-openjdk
# pacman -Syu
# pacman -S jre7-openjdk

Applications (eg, geogebra, icedtea-web) that bark at this removal may also have to be removed prior to the Arch update, and then reinstalled (after jre).

location in system

$ ls -an /usr/bin/java
/usr/bin/java -> /usr/lib/jvm/default-runtime/bin/java

$ locate /bin/java
locate /bin/java
/usr/bin/java
/usr/bin/javaws
/usr/lib/jvm/java-8-openjdk/jre/bin/java
/usr/lib/libreoffice/ure/bin/javaldx
/usr/share/icedtea-web/bin/javaws

$ ls /usr/lib/mozilla/plugins
IcedTeaPlugin.so libflashplayer.so [missing java-plugin libnpjp2.so]

# find -name libjava.so
/usr/lib/jvm/java-8-openjdk/jre/lib/amd64/libjava.so
You can't find libnpjp2.so because you don't have normal java installed. Typically, you make a soft link between libnpjp2.so and the mozilla plugin directory. But in this case WITH OPEN JDK, our java soft link for mozilla (when we need it) is the icedtea plugin so we're actually set. All you have to do is go into "Add-Ons" in your browser and enable/disable it.


LibreOffice

After an Arch OpenJDK update, the LibreOffice portion sometimes still will notice you...
Optional dependencies for libreoffice-still
java-runtime: adds java support
java-environment: required by extension-wiki-publisher and extension-nlpsolver
...telling you for sure LibreOffice didn't detect OpenJDK. I opened LibreOffice -->Tools --> Options --> Advanced.



I selected the radio button for the Oracle option and then "OK". These actions seemed to activate Java.

Blackboard and Pipelight apps

Only Firefox has the stuff needed to process Moonlight, instead of Silverlight. Software must be installed that allows geolocating and so forth. These can be turned on and off by creating a softlink.

On the Blackboard account, also use Firefox (JRE).
ln -s /usr/lib/pipelight/libpipelight-silverlight5.1.so /usr/lib/mozilla/plugins/libpipelight-silverlight5.1.so

Monday, January 18, 2010

MySQL - GUI's - Workbench

links
MySQL Gui's   Common MySQL commands   MySQL Workbench issues   MySQL field types

Website maintenance can be considered in two main halves, the administration of files portion and administration of databases (if any) portion. For file administration, adding and deleting files, I use a secure ftp program and an ssh tunnel to my provider. But what about database administration? If I am given MySQL databases, and if that provider has phpMyAdmin installed, then I use a mix of command line and phpMyAdmin database commands. As a side note, I like PostgreSQL more than MySQL, but most webspace providers only install MySQL.

command line
Making a command-line connection to the database is a good place to start, even if we will use a GUI later. Through the command line, we can easily verify connection is possible, and we can also run MySQL installation scripts, etc.

Let's imagine we had a database at Google that was web-facing w/remote access permissions. This would never happen, but this is the way ISP's often provide database access to you and me. We could connect to our imaginary Google database in the following way:
$ mysql -h google.com -u pietro -D mystuff -pwiggetystop

(note: no space between the "-p" command and the password itself "wiggetystop") So, if I've done this correctly, I'll be logged into my Google database and have a cheery "mysql >" prompt waiting for mysql commands.

phpMyAdmin
By default, many distros that have package management programs install phpMyAdmin into the Apache area. It's understood that Apache is used to parse the php files in phpMyAdmin, but Apache is another annoying level of overhead which also brings on security concerns if used outside of localhost. I only use phpMyAdmin when it's provided on an ISP's server. What is the solution for accessing a database remotely from one's local machine using a GUI? We don't want to pay for Navicat, now do we?

mysql workbench
It turns-out MySQL makes a GUI developer suite called "Workbench", which includes administration, navigation, and design tools. After checking dependencies, I downloaded, compiled, and installed the program, actions which appeared to have proceeded successfully. The start-up command is $ mysql-workbench, and it might have a few options for that command.


The reason this screenshot has no administration is because Workbench couldn't load the administration and nav modules, which left only the design module (pictured). There is a documented bug when compiling in Linux, even with all the Python libraries I could think of installed. The Python program pexpect, was considered helpful in the bug report, so I installed that as well. No improvement. Currently, I only have the design interface, as shown in the image above.

After digging around, filing a bug report (incidentally, they don't even want to answer within the bug forum where they will be useful to all, they direct one instead to their IRC channel where only the current people in the room will see the solution - ridiculous), all of the usual stuff, I dug in deeper with strace. It appears that it's the usual problem: Java, the most ridiculous run-time library since Visual Basic. This garbage occurs from each object MySQL Workbench attempts to retrieve:

**Message: WARNING: MetaClass db.maxdb.Catalog is registered but was not loaded from a XML


This seems to be the Java getDocument call. And there is no way to fix this I know of except to once again spend hours checking every exported path and poorly designed JRE directory search requirement. I've seen this kind of thing in other Java based programs. It's not Java itself that sucks so badly, it's their (apparently) lazily designed afterthought of a Run-Time Enivironment. And Java's inability to tolerate errors slewing off its own runtime environment, certainly doesn't help. This particular thwart experience is probably related to their "MetaClass" requirments.

navicat
I don't want an application with Wine built-in. It conflicts with the Wine I already have installed and is an incredibly boggy duplication of effort.

Tuesday, March 31, 2009

java frameworks

I register the term "Java", in only some vague manner, for example encountering a "JavaScript error" when web browsing. Digging deeper, I learned that "Java" and "JavaScript" are unrelated, except in name. JavaScript is the current name of what formerly was called LiveScript. LiveScript was developed at Netscape, the same Netscape now owned by AOL, however the name LiveScript was eventually changed to JavaScript, probably to leverage the (then) popularity of Java. How AOL was not sued by Sun Microsystems, I don't know, since Java was created at Sun Microsystems and its development was, of course, prior to the name change of LiveScript to JavaScript.

Java is a programming language which results in code compiled into executable (binary) programs, in a manner similar to other languages such as "C". Java-written programs require a Java run-time environment installed on the executing computer. Alternatively, JavaScript is only questionably a language and, if a language, then a scripting-type language; it doesn't require compilation. Applications written in JavaScript operate only in a browser (except to write cookies), and are called "applets". Applets require a run-time environment, and this is either built-in to the browser or is a browser plug-in. The user can enable or disable the JavaScript run-time for their browser. For example, a user might encounter a warning that JavaScript has not been enabled on their browser; this refers not to the applet, but to the JavaScript run-time plug-in not being installed/enabled.

As just noted, JavaScript browser applications ("applets") run via a JavaScript plug-in prepackaged inside most browsers. JavaScript applets are difficult to design for all browsers, since each browser (IE, Firefox, Opera, etc) designs its run-time slightly differently. A variance from what that particular browser needs to run the applet leads to the somewhat common "JavaScript error" messages encountered when browsing. This is expected to change as the ECMA eventually standardizes the approach. Another difficulty with JavaScript applets in browsers is security. Applets written in JavaScript operate in limited parameters ("sandboxes") designed to limit access to the user's system. But they've been proven not to entirely deny this access. A nice thing about the JavaScript browser plug-in is it alerts users to necessary updates.

What about the original Java? Java is a language for writing applications that run on the workstation itself, not merely in a browser. For example, you could write a program in Java that edits photos, or documents, etc. Like other compiled programs, Java programs require a runtime environment, but Java was also designed to be cross-platform. That is, the Java concept is to create programs which run inside various operating systems (Linux, Windows, Mac OSx), and platforms (x86, Mac). The software framework of the runtime is what varies for each machine, and this runtime framework is installed first, prior to the program. Once the virtual framework is installed, the Java application may then be installed - the application is supposed to work regardless of the type of machine or OS, since the underlying runtime layer is handling any OS idiosyncracies.

I've found that Java applications do work on anything if the runtime is properly installed. Unfortunately, in my experience at least, Java runtime framework installation is often problematic, so much so that the original reason for this blog page was to refresh my memory for some typical steps. One other note, framework version updates are not typically automatically displayed so that installers must remember to check for periodic upgrades.

The Java Runtime Environment (JRE) is the primary framework for Java-written applications, in a similar way that the Visual Basic Runtime Environment (VBRE) is the virtual machine for applications written in Microsoft's Visual Basic. The latest version of the JRE appears to be called J2SE (Java2 Software Environment). Sometimes J2SE by itself is enough to run a Java-written application, other times, additional Java frameworks have to be compiled and added to J2SE to provide functionality. Some examples: I have Sun's OpenOffice on my workstation. Without installing the Java Media Framework (JMF), a separately compiled framework which relies upon J2SE already being installed underneath it, there is no way I know of for OpenOffice's Impress application (it's like PowerPoint) to playback sound and video. An mp3 addition to the JMF can also be compiled and added. The Java Database Connectivity (JDBC) software first requires J2SE to be in-place. JDBC supports databases such as Neo4j (a graphing database good for tags). There are additional Java environments/frameworks available. Taking all these Java flavors together, the terminology and installation picture appears complicated, and the best overall description I've seen is here. The remainder of this post is hands-on.

Java Media Framework (JMF)


A fundamental problem is the Java Installation site provides ambiguous information. Of course, mere awareness of its ambiguity isn't going to overcome it. In one forum, a guy complained that he spent so long attempting to configure his JMF installation that he decided to return to M$ Windows. That's extreme, but it seems questionable that the JMF installation appears to require a significant underlying understanding of paths, classpaths, and softlinks for software roughly four years old. Installation should be simpler by this point.

Step One: JRE


I haven't yet installed J2SE, so I use the old Java Runtime Environment. It's important to check that it's installed and that it exists in user's and root's path. I checked both of these to be sure, and then just repeated as root:
$java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib/java/bin:/usr/lib/java/jre/bin:
If these don't show up, it's best to check and make sure the JRE path has been exported. For example, check that /etc/profile includes somewhere:
JAVA_HOME="/usr/lib/java/"
export JAVA_HOME

Step Two unpacking and moving


Download the bin file and unpack it:
$ sh ./jmf-2_1_1e-linux-i586.bin.

It makes a directory like any untar. I rooted-up and moved this entire directory to /usr/lib/JMF-2.1.1e

Step Two: user and root paths


JMF needs to be found on occasion by root and on other occasions by the user. These are two different setups:
1) User: Sun recommends creating a /home/~/.profile file with these entries:
# path settings for JMF
export JMFHOME=/usr/lib/JMF-2.1.1e
export CLASSPATH=.:$CLASSPATH:$JMFHOME/lib/jmf.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JMFHOME/lib

I like things explicit, so I leave out the "JMFHOME" variable and do it this way:

CLASSPATH="/usr/lib/JMF-2.1.1e/lib/jmf.jar"
export CLASSPATH
LD_LIBRARY_PATH="/usr/lib/JMF-2.1.1e/lib
export LD_LIBRARY_PATH


2) Root: add the same lines, but at the top of /etc/profile.

3) User and Root: Echo the path ("echo $PATH") to be sure that it includes paths to the jmf files. If not, add additional paths as the final lines of the "/etc/profile". For example, I also wanted some X11 bin files in my path, so my final two "etc/profile" lines are:

PATH="$PATH:/usr/X11/bin:/usr/lib/JMF-2.1.1e/bin"
export PATH

Following this, JMF was working except

Step Three: activate


Easiest: restart the computer so it sources both profiles.

Step whatever - diagnostics


The one good thing Java has done is make an online diagnostics page with which to check the JMF installation. Just point the browser there and it checks my JMF (and JRE). However, checking via the browser in this was seems to confoundingly generate classpath errors, regardless that there aren't any. See below.

Firefox


Firefox is a separate matter. With JMF properly configured for their workstation, when one visits the online diagnostics page, one will receive an error " classes..".

mp3


JMF also has a download to play MP3's.