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

Title: Java App Launcher
Post 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:
Code: [Select]
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 {
        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);
                    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) {
          ScrollPane sp = new ScrollPane();
          Panel p0 = new Panel();
          p0.setLayout(new GridLayout(1,0));
          add("Center", sp);
Title: Java App Launcher
Post by: Omicron on October 10, 2004, 09:22:05 am
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.
Title: Java App Launcher
Post by: rrashkin on October 12, 2004, 02:13:13 pm
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.