My Server Configuration



These were the steps that I went through to configure my server after installing Ubuntu.  (just to help remember)

Installing SSH

My first requirement for a server is that I be able to get to it from my laptop.  SSH will allow me to both open remote terminal sessions and copy files from nautilus.

I simply installed this ssh metapackage from the Software Center.

My first attempt to connect brought me this message:


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.

This was because I was reinstalling my server, and I had connected to the previous installation with my laptop.  The fix was easy (it was actually in the message):

ssh-keygen -R israel

To set it up to where I could connect without a password, I ran this command:

ssh-copy-id israel

Printing

I have an HP printer, so I chose to install the HPLIP Toolbox from the Software Center.

I could launch it through ssh with the command “hp-toolbox”.  Then, I chose the Setup Device option off the Device menu for my printer.

I selected USB:

Then, I selected the device:

Then, I entered the information about the printer:

This added, the printer.  Next, I made it the default printer:

To make the printer accessible over the network, I had to tweak the cups configuration.  I edited the /etc/cups/cupsd.conf.  I added a Listen line with the machine’s hostname.

I also turned “Browsing” on to make it easier to discover the printer.

To make the network name resolve correctly, I removed this line from /etc/hosts:

Finally, I restarted the cups service with the command:

sudo service cups restart

That gave me some access, but I still had issues.  Then, I found an easier way to do it.  I ran the the printer configuration:

system-config-printer

On the printer dialog, there is a Server > Settings option.

There, I checked the sharing options to open things up for my private network.

Java Installation

I have a personal application that I use at home, and Java is a requirement for that.  I took the easy route and installed Java using Web Upd8′s method.  That just meant running these three commands:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

I confirmed that it installed with:


skp@israel:~$ java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b55)
Java HotSpot(TM) Client VM (build 24.0-b22, mixed mode)
skp@israel:~$ javac -version
javac 1.8.0-ea

Finally, I needed to add a mysql user.  I don’t need to install mysql because it’s embedded into my application, but I do need the user.  I used this command:

useradd -r mysql

Resources

Share

Eclipse + JavaFX

I just ran across a couple of encouraging comments on the Net…

Here’s the first link:

Announcing JavaFX Scene Builder Public Beta

I found this in the comments:

 Is Scene Builder going to be integrated with Netbeans and Eclipse in future?

Ya, we designed it so that the SceneBuilder could be embedded in IDEA, Eclipse, and NetBeans. Obviously we’ll be doing the work on NetBeans and hopefully Thomas or somebody in the community will plug it into Eclipse

I also found this ticket.  (Maybe something to watch?)

efxclipse.org Trac:Ticket #120 (new enhancement)

That project has an installation page.  I’ll have to try that out.  For now, let me just write it down…

efxclipse Installation page

I did find a nice tutorial for using JavaFX with Eclipse (its a little old because it doesn’t list Linux):

Java FX for Eclipse

The Linux files are here:

Index of /general/javafx/eclipse/

And, while I am at it, I want to use Swing with JavaFX, and this tutorial looks like a great place to start:

JavaFX for Swing Developers

Share
Posted in Java. No Comments »

Ubuntu 12:04: 32-bit Java Browser Environment

I used to call this installation my WebEx environment.  WebEx has a requirement for a 32-bit Java installation.  But, I found a few more needs for a 32-bit Java/browser such as a Juniper VPN.

Basically, I just did a variation on my older post about WebEx.

Here’s how I set it up:

(more…)

Share

Ubuntu 12.04: Installing Java from Runtime to Complete Development Environment

Installing Java was pretty straightforward and easy this go-around.  Since the runtime was so easy, we’ll let this post go through installing all the different pieces for a complete development environment: Eclipse, Android SDK, JavaFX SDK, etc.

So, here’s what I did…

(more…)

Share

WebEx in Fedora 15 (64 bit)

At one point, I thought WebEx was working natively in 64-bit Linux.  Either I am mistaken or it no longer works on 64-bit.  So, I decided to dust off my old 32-bit hack where you install 32-bit versions of Java and Firefox to make it all work.

Earlier, I had thought I would use my regular 64-bit installation, and I had posted my hooking Java up to Firefox for WebEx.  I was rightly corrected on troshlyak’s blog.  The 64-bit will work, but you can’t share your desktop or view another’s desktop.  So, I am back to the old way.  So, here’s what I did…

I downloaded the two programs:

I created a directory in ~/bin/webex to hold it all.  Under that, I put the Java SDK under the “jdk1.7.0_01″ directory.  Then, I put Firefox under “firefox”.

Environment Script:

I created this script in ~/bin/webex/env.sh:

#!/bin/sh

export WEBEX_HOME=~/bin/webex
export JDK_HOME=$WEBEX_HOME/jdk1.7.0_01
export JAVA_HOME=$JDK_HOME/jre
export FIREFOX_HOME=$WEBEX_HOME/firefox
export MOZ_PLUGIN_PATH=$FIREFOX_HOME/plugins
export PATH=$FIREFOX_HOME:$JAVA_HOME/bin/:$JDK_HOME/bin/:$PATH

To make sure you have it right, you can check it like this:

[skp@pecan bin]$ . ~/bin/webex/env.sh
[skp@pecan bin]$ which java
~/bin/webex/jdk1.7.0_01/jre/bin/java
[skp@pecan bin]$ java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Server VM (build 21.1-b02, mixed mode)

Now, you can link in the Java plugin like this:

mkdir $MOZ_PLUGIN_PATH
ln -s $JAVA_HOME/lib/i386/libnpjp2.so $MOZ_PLUGIN_PATH/libnpjp2.so

Now, fire up firefox.  Note you may be asked to create the WebEx profile.  Make sure you create a profile with the same name you use on the command line so it won’t ask you again.

firefox --no-remote -P WebEx http://java.com/en/download/testjava.jsp

This should give you a successful Java applet working on the test page.  You also should see the architecture as i386.

Java Test Successful and shows i386

Finally, I created a ~/bin/webex.sh script to launch webex easily for me.

#!/bin/bash

cd ~/bin/webex
. ./env.sh
firefox --no-remote -P WebEx

And you should be good to go.

Share
Posted in Firefox, Java, WebEx. 8 Comments »

Java: getSystemJavaCompiler returns null!

After reinstalling my laptop with Ubuntu Natty, I had an issue with one of my custom built tools.  I have this tool that installs a Tomcat-based web application and server.  In the part that compiles the JSON library, I received a NullPointerException.

On further examination, I found that ToolProvider.getSystemJavaCompiler() was returning null for some reason.  I found the answer on IBM DeveloperWorks:

The ToolProvider.getSystemJavaCompiler()method can return null if tools.jar is not in the application’s classpath. The CharStringCompilerclass detects this possible configuration problem and throws an exception with a recommendation for fixing the problem. Note that Sun’s licensing allows tools.jar to be redistributed with the JRE.

What I found was that I was using a JRE instead of a JDK installation.  Of course, when I switch the Java Home to my JDK, I had some other error and the App wouldn’t even run.  So, I added the tools.jar from the JDK installation to the classpath and ran it with the JRE, and everything worked fine.

So, here is the code I use to compile (including the catch for the missing tools.jar):

		//compile
		JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
		// handle issue where tools.jar is not on the classpath
		if(jc == null) {
			log.logException(new InstallException("Could not access the system Java compiler -- check to make sure tools.jar is on the class path."));
			return;
		}
		StandardJavaFileManager fm = jc.getStandardFileManager(null, null, null);
		File compilePath = new File(unzipPath, "org/json");
		Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(compilePath.listFiles());
		for(JavaFileObject f : files) {
			log.logInformation("Compiling - " + f.getName());
		}
		CompilationTask task = jc.getTask(log.getStream(), fm, null, null, null, files);
		try {
			fm.close();
		} catch (IOException e) {
			log.logException(new InstallException("Could not unzip " + zipPath, e));
		}
		boolean result = task.call();
		log.logInformation("**Compile result = " + result);

Resources

IBM DeveloperWorks: Create dynamic applications with javax.tools

Share
Posted in Java. No Comments »

Installing Sun Java 6

I was able to install the package sun-java6-jdk from synaptic with no problems.  The update alternatives were what caused me problems:

skp@pecan:~$ sudo update-java-alternatives --list
[sudo] password for skp:
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun
skp@pecan:~$ sudo update-java-alternatives --set java-6-sun
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
skp@pecan:~$

These errors threw me off at first because I thought they kept it from working.  You can run java -version to see that it really is using the correct version.  Sun’s version reports this:

skp@pecan:~$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
skp@pecan:~$

Open JDK reports this:

skp@pecan:~$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.1) (6b22-1.10.1-0ubuntu1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

As far as I can tell, the “No Alternatives for” messages aren’t causing a problem, so I am not going to worry about it.  If you have any info on that, please comment.

This is the error message that I am getting from my Java that the Sun JDK has solved in the past. I’ll leave it for another later post, but I wanted to share it in case anyone has any ideas. Please comment if you do:

The program '.' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 1359 error_code 8 request_code 140 minor_code 4)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

Resources

Share
Posted in Java. No Comments »

What’s Up with JDIC?

I used the JDIC (JDesktop Integration Components) in a project or two of mine, and I thought it was a great start.  The world needs a single Java library that would give us access to the standard features of a Desktop.

The problem is that it seems the project is getting forsaken.  Consider this: (more…)

Share
Posted in Java. 3 Comments »

Upgrading Eclipse to 3.6

I just realized while trying to install Visual Editor, that Eclipse has a new version.  I am using 3.5, but 3.6 is available.

I could just download eclipse from their website, but that would be too easy!  I guess I was hoping that if I use the repository, the packaging team would keep it up to date.

I found this thread discussing upgrading.  They say it doesn’t work, but I thought I would give it a try myself.  Worst cast, I could download it manually like #11 describes.

So, I went to Synaptic and opened the Settings > Repositories.  Then, I added the repository:

deb https://launchpad.net/~eclipse-team/+archive/debian-package lucid main

When I clicked Reload on Synaptic, I got this error message:

Failed to fetch https://launchpad.net/~eclipse-team/+archive/debian-package/dists/lucid/main/binary-amd64/Packages.gz  The requested URL returned error: 404
Some index files failed to download, they have been ignored, or old ones used instead.
Failed to fetch https://launchpad.net/~eclipse-team/+archive/debian-package/dists/lucid/main/binary-amd64/Packages.gz  The requested URL returned error: 404Some index files failed to download, they have been ignored, or old ones used instead.

I wonder if it is because I am running the 64bit version of Ubuntu.

Anyway, since it didn’t work, I downloaded eclipse from the Eclipse website.  Then, I extracted the tar ball into my Downloads directory.  From the command line, I changed directory into the newly created eclipse directory.  Then, I ran this command to copy it to /usr/lib –

sudo cp -r * /usr/lib/eclipse/

One thing to keep in mind is that you probably want to write down what extensions you have installed and the sites so that you can reinstall them.

Resources

Ubuntu Forums: Update Eclipse 3.5 to 3.6

Share
Posted in Eclipse, Java. No Comments »

Bring the Web Interface to Swing

I have been fighting with using Swing to create user interfaces for while now.  The advantage with Swing is that it comes with Java and you don’t have to install any additional tools or jars to work with it.  The disadvantage is that you have to code everything manually.  I haven’t found a easy interface for designing GUI’s with Swing.

Since I have done a lot of work with HTML and web development, I thought it might be worth looking at building an HTML front end enveloped by Swing windows.  The only problem is that to make the interface work, I need Javascript.

The LOBO Project looks like my best bet here from my searches so far.  I found it from this Stack Overflow Thread.  It is a pure Java browser.  So, I am thinking that I can embed it in my projects and make that the front-end.

The same thread mentioned using something contained in JDIC.  I think I have used that for notification icons already, so that might be something worth looking into.  I found two other projects: Swingx-WS and WebSwing, but both of those don’t look as promising.

Then, I found Kyle Cordes’ post on using Rhino with Swing.  His code is available, so I need to check it out: Git Hub.

To step back a little, what I really want is a better alternative for creating GUIs.  I found a cool article, that had some other options.  I thought it was interesting that they mentioned having HTML as the front end.  The Visual Editor in Eclipse sounded like something else to check out.  I am going to have explore these instructions for installing more and this tutorial for including custom components.  Other open source options are FormLayoutMaker, Java Object Face, and the Atris Framework.

Another option that is worth looking into is a Chrome Web App.  I found a nice little guide for creating one, or you can read Google’s documentation.  My issue with that is that I need additional access that I don’t think Chrome will give me.

Please comment if you have any ideas.

Share
Posted in Java. No Comments »

Switch to our mobile site