OESF Portables Forum
Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => Personal Java/Jeode/J2ME Personal Profile => Topic started by: rrashkin on September 16, 2004, 10:56:44 am
-
Greeting all.
This may not be interesting to anyone else but I like it:
I have several Java apps that I wrote for various reasons. I really find the whole IPK thing a major hassle as these are really just for me. I was content for a while to run my apps from the console (I wrote a bash script to list my classes and give me a choice) but it ocurred to me that it would be good to have a "launcher app" that I could put on the desktop that would read a text file (zlnch.txt) of otherwise stand-alone apps and luanch them. That way, any new app I write, I just copy the classes off to my CF card and edit the text file and I'm done. The apps need to have a argument-less constructor and basically do nothing in "main" but call the constructor.
So, anyway, if anyone is interested:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
class jlnch extends Frame {
// class data
static TextField appnm;
static String rs;
static Choice apln=new Choice();
// main method
public static void main(String args[]) throws IOException {
//Initilaize
apln.add("");
BufferedReader iniFile = new BufferedReader(new FileReader("zlnch.txt"));
while ((rs =iniFile.readLine()) != null) {apln.add(rs);}
apln.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e) {
String ct = apln.getSelectedItem();
try {
Class cls = Class.forName(ct);
cls.newInstance();
}
catch (ClassNotFoundException e2) { }
catch (IllegalAccessException e3) { }
catch (InstantiationException e4) { }
}
});
//call constructor
jlnch jl1 = new jlnch();
}
// constructor method
public jlnch() {
setTitle("app launcher");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
ScrollPane sp = new ScrollPane();
Panel p0 = new Panel();
p0.setLayout(new GridLayout(1,0));
p0.add(apln);
//
sp.add(p0);
sp.setSize(200,40);
add("Center", sp);
pack();
show();
}
}
-
Nice idea for quick Development deployment when IPK is not a high priority and you don't want to bother installing and uninstalling every version of the IPK for each change.
Now all you need to do is wrap up your bash file with some online docs and an Icon and make an IPK out of it. Seriously. Then you could upload it and it's online help would explain the file to modify (or just a simple GUI if the file is empty or perhaps a 3 second dump of the file and its location prior to launch). Then developers will find it intuitive, easy to use and it will find a much wider use.
-
Omicron,
I don't understand your suggestion. Which BASH file should be wrapped up with doc's? Furthermore, making an IPK is precisely what I don't know how to do.