Taking Java (and Netbeans) To Go

Discussion in 'Java' started by Bushido Hacks, Nov 18, 2005.

  1. Bushido Hacks, Nov 18, 2005
    #1
    1. Advertising

  2. Bushido Hacks

    Shrike Guest

    awesome. i have now mobilized netbeans (i used to use old v3.6) onto
    an external hard drive, and it works great, except for one caveat: the
    drive name. wen netbeans opens under a different drive name than is in
    its reference files, it either won't run (netbeans.conf), or won't
    compile (build.properites in the .netbeans\\5.0beta2 directory defined
    by netbeans.conf). i suggest a java program to switch out the drive
    names in the files.

    here's the source i came up with (sry if its long):


    // Mobilizer.java written by Rob Wiesler,

    import java.io.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;

    public class Mobilizer extends JFrame
    {
    public static void main(String[] args) {
    new Mobilizer().show();
    }

    private JButton e;
    private JButton f;
    private JButton g;
    private JButton h;
    private JFrame parent = this;

    public Mobilizer() {
    setTitle("Mobilizer");
    setSize(275,65);
    setResizable(false);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    e = new JButton("<E:\\>");
    f = new JButton("<F:\\>");
    g = new JButton("<G:\\>");
    h = new JButton("<H:\\>");

    Container cp = getContentPane();
    cp.add(e);
    cp.add(f);
    cp.add(g);
    cp.add(h);

    cp.setLayout(new FlowLayout());
    e.addActionListener(new ButtonHandler('E'));
    f.addActionListener(new ButtonHandler('F'));
    g.addActionListener(new ButtonHandler('G'));
    h.addActionListener(new ButtonHandler('H'));
    }

    class ButtonHandler implements ActionListener
    {
    public ButtonHandler(char d) {
    drive = d;
    }

    private char drive;

    public void actionPerformed(ActionEvent e2) {
    try {
    PrintWriter out = new PrintWriter(new FileOutputStream(
    "" + drive +
    ":\\Java\\netbeans-5.0beta2\\etc\\netbeans.conf"
    ), true);
    out.println("# ${HOME} will be replaced by JVM
    user.home system property");

    out.println("netbeans_default_userdir=\"Java/.netbeans/5.0beta2\"");
    out.println("");
    out.println("# options used by netbeans launcher by
    default, can be overridden by explicit");
    out.println("# command line switches");
    out.println("netbeans_default_options=\"-J-Xms32m
    -J-Xmx128m -J-XX:permSize=32m -J-XX:MaxPermSize=96m -J-ea
    -J-Dapple.laf.useScreenMenuBar=true\"");
    out.println("");
    out.println("# default location of J2SE JDK, can be
    overridden by using --jdkhome <dir> switch");
    out.println("netbeans_jdkhome=\"" + drive +
    ":\\Java\\j2sdk1.4.2_10\"");
    out.println("");
    out.println("# clusters\' paths separated by
    path.separator (semicolon on Windows, colon on Unices)");

    out.println("#netbeans_extraclusters=\"/absolute/path/to/cluster1:/absolute/path/to/cluster2\"");
    out.close();
    } catch (FileNotFoundException ex) {
    ex.printStackTrace();
    } try {
    PrintWriter out = new PrintWriter(new FileOutputStream(
    "" + drive +
    ":\\Java\\.netbeans\\5.0beta2\\build.properties"
    ), true);
    out.println("copyfiles.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\ant\\\\extra\\\\copyfiles.jar");
    out.println("default.javac.source=1.4");
    out.println("default.javac.target=1.4");
    out.println("jspc.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\ant\\\\lib\\\\ant.jar:${j2ee.platform.classpath}:"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jasper-compiler-5.5.9.jar:"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jasper-runtime-5.5.9.jar:"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\commons-el.jar:"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\commons-logging-1.0.4.jar");
    out.println("libs.absolutelayout.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\AbsoluteLayout.jar");
    out.println("libs.absolutelayout.javadoc=");
    out.println("libs.absolutelayout.src=");
    out.println("libs.jaxrpc16.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\activation.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\FastInfoset.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\jaxrpc16\\\\jax-qname.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\jaxp-api.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\jaxrpc-api.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\jaxrpc-impl.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\jaxrpc-spi.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\jsr173_api.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\mail.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\relaxngDatatype.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\saaj-api.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\saaj-impl.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\jaxrpc16\\\\xsdlib.jar");
    out.println("libs.jaxrpc16.javadoc=");
    out.println("libs.jaxrpc16.src=");
    out.println("libs.jsf.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\commons-beanutils.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\commons-collections.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\commons-digester.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\commons-logging.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\jsf-api.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jsf\\\\jsf-impl.jar");
    out.println("libs.jsf.javadoc=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\docs\\\\jsf-1.1.01-javadoc.zip");
    out.println("libs.jsf.src=");
    out.println("libs.jstl11.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\standard.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\jstl.jar");
    out.println("libs.jstl11.javadoc=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\docs\\\\jstl-1.1.2-javadoc.zip");
    out.println("libs.jstl11.src=");
    out.println("libs.junit.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\junit-3.8.1.jar");
    out.println("libs.junit.javadoc=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\docs\\\\junit-3.8.1-api.zip");
    out.println("libs.junit.src=");
    out.println("libs.struts.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\antlr.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\commons-beanutils.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\commons-digester.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\commons-fileupload.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\commons-logging.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\commons-validator.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\jakarta-oro.jar;"
    + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\modules\\\\ext\\\\struts\\\\struts.jar");
    out.println("libs.struts.javadoc=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\docs\\\\struts-javadoc.zip");
    out.println("libs.struts.src=");
    out.println("libs.swing-layout.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\ide6\\\\modules\\\\ext\\\\swing-layout-0.9.jar");
    out.println("libs.swing-layout.javadoc=");
    out.println("libs.swing-layout.src=");

    out.println("nbplatform.default.harness.dir=${nbplatform.default.netbeans.dest.dir}/harness");
    out.println("nbplatform.default.netbeans.dest.dir=" +
    drive + ":\\\\Java\\\\netbeans-5.0beta2");
    out.println("wsclientuptodate.classpath=" + drive +
    ":\\\\Java\\\\netbeans-5.0beta2\\\\enterprise2\\\\ant\\\\extra\\\\wsclientuptodate.jar");

    out.close();
    } catch (FileNotFoundException ex) {
    ex.printStackTrace();
    }
    Toolkit.getDefaultToolkit().beep();
    }
    }
    }
     
    Shrike, Dec 7, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pimousse
    Replies:
    2
    Views:
    3,665
    Roedy Green
    Apr 21, 2004
  2. Ilias Lazaridis
    Replies:
    0
    Views:
    925
    Ilias Lazaridis
    Dec 12, 2004
  3. Larry Minj
    Replies:
    0
    Views:
    438
    Larry Minj
    Apr 27, 2005
  4. Thomas G. Marshall
    Replies:
    2
    Views:
    843
    Thomas G. Marshall
    Oct 16, 2006
  5. Jim Cain
    Replies:
    1
    Views:
    222
    Yukihiro Matsumoto
    Jul 18, 2003
Loading...

Share This Page