OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | #planetgemini chat on matrix.org | #gemini-pda chat on Freenode | #zaurus and #alarmz chat on Freenode | ELSI (coming soon) | Ibiblio


Welcome Guest ( Log In | Register )

> Java App Launcher, Launch Java Apps without installation
post Sep 16 2004, 06:56 AM
Post #1

Group: Members
Posts: 67
Joined: 10-December 03
From: Colorado
Member No.: 1,134

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 {
       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);
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 27th May 2018 - 07:27 PM