Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal NullProg's Journal: Java and Xubuntu

Since I've been messing around with eclipse/netbeans and Java programming I needed a way to run Java programs from the Xubuntu desktop. Yes, for those who know me, this old time C/C++/Assembler programmer is using Java to display custom graphics from a embedded device I've been working on.

While the Xubuntu file manager thunar associates .class files with java, it doesn't run them. I'm guessing because thunar is calling java with the fully qualified path and class name. No matter how I tried to coax thunar with custom command settings, it wouldn't run any java programs.

The following shell script will run them once you associate the .class file with it. It requires sed for parsing. The next version will handle .jar extensions. Save it as javawrapper (or whatever) chmod +x and copy it somewhere into your $PATH. Feel free to copy, modify and share.

#!/bin/bash
infile=`echo $1|sed 's/\..\{5\}$//'`
infile2=`basename $infile`
basepath=`echo $1|sed 's/[^/]*$//'`
CLASSPATH=.:$basepath
cd $basepath
java -cp $CLASSPATH $infile2

Enjoy,

-------------------------

Update 09/22/08
Java class files run out of the box (so to speak) under XUbuntu 8.4.
No need for the script file above.

This discussion has been archived. No new comments can be posted.

Java and Xubuntu

Comments Filter:

Genetics explains why you look like your father, and if you don't, why you should.

Working...