Create a browser in a java application

Hello everybody, I need yor help, I need make a little browser in a java application.
I have a JComboBox whith filesystem roots like items(I used File ListRoots()), and I need to appear the directories in a Jtree, and I do not know how can I make that, please help me......thanks a lot

I'm new in java programig this is the first
application that I do, really I need help...thanksIf you have never written a Java program before then you have chosen a difficult task. What you should do next is: stop asking questions here. You do not understand the answers you are getting because you do not have the background knowledge to understand them. Instead, read those tutorials that you have been referred to. You will not understand them either, but that is normal too. Try the examples they contain. Once you have them working, try changing them to do something else.
If you need basic Java training, read more of the Java tutorials you will find here:http://java.sun.com/docs/books/tutorial/But remember, you cannot learn Java or any other language by asking people one question at a time.

Similar Messages

  • How to create a Batch file for java application  ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    [http://static.springsource.org/spring-batch/]
    Assuming you want to develop a batch application rather than actually just create a .bat file ..

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • Attempting to launch a help browser from a java application

    I am currently investigating being able to view help html files through launching a browser from my Java application. I have come across the java.lang.Runtime and java.lang.Process classes which allow me to launch a browser like Netscape or Explorer and bring up a html file to view.
    What I want to do is launch the browser and bring up an html index file as well as the required html help file every time a user would like to use the help for my application.
    Is this possible using the other exec commands. If so, how? Is there somewhere I can find a user guide for Netscape and Explorer commands in order to send additional commands to the browser in order to do this.
    Thanks.

    Good news is it must be possible because VisualAge does it but I don't know how.

  • Launch a default web browser from my java application

    Hello,
    I have been trying to launch my default web browser from my java application, but am unable do it. Right now, I am using ---- "Runtime.getRuntime().exec("cmd /c start <url>"); to launch my webbrowser. It launches the browser but displays the command prompt for a second or so, and then replaces my already existing page with the new url.
    Is there any way for me to launch the url in a completely new browser each and every time. And I don't want the command prompt to show up for a sec. Please help...!
    Thanks in advance.
    -BusyBusyBee

    If by any chance your application is an Applet, you can use this to open a new browser window:
    getAppletContext().showDocument(new URL(theUrl), "_blank");
    But, you probably would have specified if that were the case. Oh well. Hope it helps someone!
    -sheepy.

  • Browser Control In Java Application is Exists?

    Hello i need a Browser control for Swing java application!
    equivalent to the activeX controller of visual basic.
    it would have to be in a position to accepting the commanos base of the browser.
    example (onclose,onfocus, opener) ecc...

    http://www.google.com/search?q=java+browser

  • Creating file browser GUI using java swing tree

    Hi all,
    I have some questions which i wish to clarify asap. I am working on a file browser project using java swing. I need to create 2 separate buttons. 1 of them will add a 'folder' while the other button will add a 'file' to the tree when the buttons are clicked once. The sample source code known as 'DynamicTreeDemo' which is found in the java website only has 1 add button which is not what i want. Please help if you know how the program should be written. Thx a lot.
    Regards,

    Sorry, don't know 'DynamicTreeDemo'import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import java.io.File;
    public class Test extends JFrame {
      JTree jt = new JTree();
      DefaultTreeModel dtm = (DefaultTreeModel)jt.getModel();
      JButton newDir = new JButton("new Dir"), newFile = new JButton("new File");
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        newDir.setEnabled(false);
        newFile.setEnabled(false);
        jt.setShowsRootHandles(true);
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        File c = new File("C:\\temp");
        DefaultMutableTreeNode root = new DefaultMutableTreeNode(c);
        dtm.setRoot(root);
        addChildren(root);
        jt.addTreeSelectionListener(new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent tse) { select(tse) ; }
        JPanel jp = new JPanel();
        content.add(jp, BorderLayout.SOUTH);
        jp.add(newDir);
        jp.add(newFile);
        newDir.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            TreePath tp = jt.getSelectionPath();
            if (tp!=null) {
              DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode)tp.getLastPathComponent();
              File newFile = new File((File)dmtn.getUserObject(),"foo");
              if (newFile.mkdir()) {
                dmtn.add(new DefaultMutableTreeNode(newFile));
                dtm.nodeStructureChanged(dmtn);
              } else System.out.println("No Dir");
        newFile.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            TreePath tp = jt.getSelectionPath();
            if (tp!=null) {
              DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode)tp.getLastPathComponent();
              File newFile = new File((File)dmtn.getUserObject(),"foo.txt");
              try {
                if (newFile.createNewFile()) {
                  dmtn.add(new DefaultMutableTreeNode(newFile));
                  dtm.nodeStructureChanged(dmtn);
                } else System.out.println("No File");
              catch (java.io.IOException ioe) { ioe.printStackTrace(); }
        setSize(300, 300);
        setVisible(true);
      void select(TreeSelectionEvent tse) {
        TreePath tp = jt.getSelectionPath();
        newDir.setEnabled(false);
        newFile.setEnabled(false);
        if (tp!=null) {
          DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode)tp.getLastPathComponent();
          File f = (File)dmtn.getUserObject();
          if (f.isDirectory()) {
            newDir.setEnabled(true);
            newFile.setEnabled(true);
      void addChildren(DefaultMutableTreeNode parent) {
        File parentFile = (File)parent.getUserObject();
        File[] children = parentFile.listFiles();
        for (int i=0; i<children.length; i++) {
          DefaultMutableTreeNode child = new DefaultMutableTreeNode(children);
    parent.add(child);
    if (children[i].isDirectory()) addChildren(child);
    public static void main(String[] args) { new Test(); }

  • Open default browser from a java application

    How is possible to make a java application that open an html file in the default browser ?
    Thankyou
    [email protected]

    You can do that by running the command "start <url>", for example using Runtime.exec().
    Runtime.getRuntime().exec("start http://java.sun.com");Jesper

  • Open URL in Web Browser from a Java Application

    Hi,
    I have an HTML document that I want to load in a browser window by clicking on a button in my java GUI application.
    Any suggestions?
    Thanks.

    You can use the Process class to start the web browser with the proper command line arguments (depends on the web browser though). Or on windows, you can have your program create a batch file with the code start url (where [url] is your url), and this will open the default web browser when run (again you must run it with a Process).

  • Creating a database with Sun Java Application Server 9

    I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output:
    D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>asant database
    Buildfile: build.xml
    env-user:
    prop-user:
    set-user:
    env-password:
    prop-password:
    read-password:
    set-password:
    set-j2ee:
    create-jdbc:
    set-j2ee:
    asadmin:
    [echo] asadmin.bat create-jdbc-resource user admin password password --
    connectionpoolid PointBasePool --enabled=true jdbc/Agency
    [exec] Usage: create-jdbc-resource [--terse=false] [--echo=false] [--intera
    ctive=true] [--host localhost] [--port 4848|4849] [--secure | -s] [--user admin_
    user] [--passwordfile file_name] --connectionpoolid id [--enabled=true] [--descr
    iption text] [--target target(Default server)] jndi_name
    [exec] CLI193 Password option "password" is not allowed on the command line
    . Please use --passwordfile option or asadmin login command.
    set-j2ee:
    asadmin:
    [echo] asadmin.bat list-jdbc-resources user admin password password
    [exec] Usage: list-jdbc-resources [--terse=false] [--echo=false] [--interac
    tive=true] [--host localhost] [--port 4848|4849] [--secure | -s] [--user admin_u
    ser] [--passwordfile file_name] [target (Default server)]
    [exec] CLI193 Password option "password" is not allowed on the command line
    . Please use --passwordfile option or asadmin login command.
    set-dbpath:
    BUILD FAILED
    D:\original\CaseStudy-2-5\CaseStudy\common\targets.xml:87: D:\Sun\SDK\pointbase\
    lib not found.
    Total time: 2 seconds
    D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>
    I've checked and there is no Sun\SDK\pointbase folder. The book was written for SDK 1.4 and I believe another application server. There is also a Java program that attempts to create it with jdbc. Its output looks like this :
    D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise\classes>java CreateAgency
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at CreateAgency.main(Unknown Source)
    D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise\classes>
    I am not conversant enough to discuss the corrections for the ANT script but I'm reasonably certain the Java program could work if I had the right strings in these lines.
    // PointBase
    private static final String driver = "com.pointbase.jdbc.jdbcUniversalDriver";
    private static final String protocol = "jdbc:pointbase:server://localhost/sun-appserv-samples,new";
    private static final String user = "pbPublic";
    private static final String password = "pbPublic";
    Can anyone help me with the correct driver and protocol?
    I am using the latest download version SDK JavaEE5
    the entire java program looks like this:
    import java.sql.*;
    public class CreateAgency {
    // Cloudscape
    //private static final String driver = "COM.cloudscape.core.RmiJdbcDriver";
    //private static final String protocol = "jdbc:cloudscape:rmi:Agency;create=true";
    //private static final String user = "";
    //private static final String password = "";
    // PointBase
    private static final String driver = "com.pointbase.jdbc.jdbcUniversalDriver";
    private static final String protocol = "jdbc:pointbase:server://localhost/sun-appserv-samples,new";
    private static final String user = "pbPublic";
    private static final String password = "pbPublic";
    public static void main(String[] args) {
    Connection conn=null;
    Statement s=null;
    try {
    Class.forName(driver);
    System.out.println("Loaded driver: "+driver);
    conn = DriverManager.getConnection(protocol,user,password);
    System.out.println("Connected to: "+protocol);
    conn.setAutoCommit(false);
    s = conn.createStatement();
    System.out.println("Dropping exisiting BMP tables...");
    try {s.execute("drop table ApplicantSkill");} catch (SQLException ex){}
    try {s.execute("drop table Applicant");} catch (SQLException ex){}
    try {s.execute("drop table JobSkill");} catch (SQLException ex){}
    try {s.execute("drop table Job");} catch (SQLException ex){}
    try {s.execute("drop table Matched");} catch (SQLException ex){}
    try {s.execute("drop table Customer");} catch (SQLException ex){}
    try {s.execute("drop table Location");} catch (SQLException ex){}
    try {s.execute("drop table Skill");} catch (SQLException ex){}
    System.out.println("Dropped tables");
    System.out.println("Creating new tables...");
    s.execute("create table Skill(name varchar(16) CONSTRAINT pk_skill PRIMARY KEY (name), description varchar(64))");
    s.execute("create table Location(name varchar(16)CONSTRAINT pk_location PRIMARY KEY (name), description varchar(64))");
    s.execute("create table Applicant(login varchar(16) CONSTRAINT pk_applicant PRIMARY KEY (login), name varchar(64), email varchar(64), summary varchar(512), location varchar(16), CONSTRAINT fk_location FOREIGN KEY (location) REFERENCES Location(name))");
    s.execute("create table ApplicantSkill(applicant varchar(16), skill varchar(16), CONSTRAINT fk_applicant FOREIGN KEY (applicant) REFERENCES Applicant(login), CONSTRAINT fk_skill FOREIGN KEY (skill) REFERENCES Skill(name))");
    s.execute("create table Customer(login varchar(16) CONSTRAINT pk_customer PRIMARY KEY (login), name varchar(64), email varchar(64), address1 varchar(64), address2 varchar(64))");
    s.execute("create table Job(ref varchar(16), customer varchar(16), description varchar(512), location varchar(16), CONSTRAINT pk_job PRIMARY KEY (ref,customer), CONSTRAINT fk_customer FOREIGN KEY (customer) REFERENCES Customer(login), CONSTRAINT fk_location FOREIGN KEY (location) REFERENCES Location(name))");
    s.execute("create table JobSkill(job varchar(16), customer varchar(16), skill varchar(16), CONSTRAINT fk_job FOREIGN KEY (job,customer) REFERENCES Job(ref,customer), CONSTRAINT fk_skill FOREIGN KEY (skill) REFERENCES Skill(name))");
    s.execute("create table Matched(applicant varchar(16), job varchar(16), customer varchar(16), exact boolean, CONSTRAINT fk_job FOREIGN KEY (job,customer) REFERENCES Job(ref,customer), CONSTRAINT fk_applicant FOREIGN KEY (applicant) REFERENCES Applicant(login))");
    System.out.println("Created tables");
    System.out.println("Inserting table records...");
    s.execute("insert into Location values ('London','London UK')");
    s.execute("insert into Location values ('Washington','Washington DC, USA')");
    s.execute("insert into Location values ('Verona','Verona, Renaissance Italy')");
    s.execute("insert into Location values ('Wessex','Wessex, Kingdom of England')");
    s.execute("insert into Skill values ('Tree Surgeon','Tree Surgeon')");
    s.execute("insert into Skill values ('Cigar Maker','Cigar Maker')");
    s.execute("insert into Skill values ('Bodyguard','Bodyguard')");
    s.execute("insert into Skill values ('Cook','Cook')");
    s.execute("insert into Skill values ('Lawyer','Lawyer')");
    s.execute("insert into Skill values ('Critic','Critic')");
    s.execute("insert into Applicant values ('juliet','Juliet Capulet', 'juliet@localhost' , 'Dutiful daughter', 'London' )");
    s.execute("insert into Applicant values ('romeo','Romeo Montague', 'romeo@localhost' , 'Dutiful son', 'Wessex' )");
    s.execute("insert into Applicant values ('julius','Julius Caesar', 'julias@localhost' , 'Roman Emperor', 'Washington' )");
    s.execute("insert into Applicant values ('brutus','Marcus Brutus', 'marcus@localhost' , 'Roman Senator', 'Washington' )");
    s.execute("insert into Applicant values ('proteus','Proteus', 'proteus@localhost' , 'Gentleman', 'Verona' )");
    s.execute("insert into Applicant values ('valentine','Valentine', 'valentine@localhost' , 'Gentleman', 'Verona' )");
    s.execute("insert into ApplicantSkill values ('juliet', 'Cook')");
    s.execute("insert into ApplicantSkill values ('romeo', 'Cook')");
    s.execute("insert into ApplicantSkill values ('romeo', 'Bodyguard')");
    s.execute("insert into ApplicantSkill values ('julius', 'Tree Surgeon' )");
    s.execute("insert into ApplicantSkill values ('julius', 'Tree Surgeon' )");
    s.execute("insert into ApplicantSkill values ('brutus', 'Critic' )");
    s.execute("insert into ApplicantSkill values ('brutus', 'Lawyer' )");
    s.execute("insert into ApplicantSkill values ('proteus', 'Lawyer' )");
    s.execute("insert into ApplicantSkill values ('proteus', 'Critic' )");
    s.execute("insert into ApplicantSkill values ('valentine', 'Critic' )");
    s.execute("insert into ApplicantSkill values ('valentine', 'Cigar Maker' )");
    s.execute("insert into Customer values ('george','George Washington', 'george@localhost', 'White House', 'Washington')");
    s.execute("insert into Customer values ('winston','Winston S Churchill', 'winston@localhost', '10 Downing Street', 'London')");
    s.execute("insert into Customer values ('abraham','Abraham Lincoln', 'abe@localhost', 'Springfield', 'Illinois')");
    s.execute("insert into Customer values ('alfred','Alfred the Great', 'alf@localhost', 'Wessex', 'England')");
    s.execute("insert into Job values ('Tree pruner', 'george', 'Must be honest', 'Washington')");
    s.execute("insert into Job values ('Cigar trimmer', 'winston', 'Must like to talk and smoke', 'London')");
    s.execute("insert into Job values ('Theatre goer', 'abraham', 'Should be intelligent and articulate', 'Washington')");
    s.execute("insert into Job values ('Cake maker', 'alfred', 'Should have a good sense of smell', 'Wessex')");
    s.execute("insert into JobSkill values ('Tree pruner','george','Tree Surgeon')");
    s.execute("insert into JobSkill values ('Cigar trimmer', 'winston', 'Cigar Maker')");
    s.execute("insert into JobSkill values ('Cigar trimmer', 'winston', 'Critic')");
    s.execute("insert into JobSkill values ('Theatre goer', 'abraham', 'Bodyguard')");
    s.execute("insert into JobSkill values ('Theatre goer', 'abraham', 'Lawyer')");
    s.execute("insert into JobSkill values ('Theatre goer', 'abraham', 'Critic')");
    s.execute("insert into JobSkill values ('Cake maker', 'alfred', 'Cook')");
    System.out.println("Inserted records");
    conn.commit();
    System.out.println("Committed transactions");
    catch (SQLException ex) {
    System.out.println("SQL Exception thrown: "+ex);
    ex.printStackTrace();
    try { conn.rollback(); } catch (Exception e) {}
    catch (ClassNotFoundException ex) {
    System.out.println(ex);
    ex.printStackTrace();
    finally {
    try { s.close(); } catch (Exception ex) {}
    try { conn.close(); } catch (Exception ex) {}
    }

    JavaEE Tutorial has a chapter on security:
    http://java.sun.com/javaee/5/docs/tutorial/doc/
    Usually a no-arg InitialContext() is used, rather than InitialContext(props). For more info, see
    Glassfish EJB FAQ:
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    -cheng

  • Browser running inside Java Application

    Hi,
    I have a fat client application that needs a web page display browser. Please recommend a good browser that I can run through Java code. I do not want to invoke a browser outside my application window.
    Thanks!
    Ashish Tengshe

    The best java browser I know of is ICEbrowser:
    http://www.icesoft.com
    Unfortunately it costs a lot of money. Below are links to a couple others:
    http://www.netcluesoft.com
    http://home.earthlink.net/~hheister/

  • Creating a Jar of my java application

    Hi All,
    I have written an application that does a file transfer (between two locations) and then creates entries into the DB.I use MSSQL and its related Jars (msbase, msutil, mssqlserver) to build the application in eclipse. I also use log4j to help me debug the application. The application works out of a p.s.v.m block which is the entry point to my java app. The application runs fine out of my workspace(in eclipse) but does not when i export the application as a jar and try to run the jar using the command java -jar Job.jarThe stack trace says that it cannot find the class for which the implementation is provided by the mssql related jars (the 3 jars that i have mentioned above). When i see the built jar file, the 3 jars are not included but rather a reference is used. To correct this, i added the 3 jars (leave log4j) inside my workspace (inside a package) and re-jarred the app. Even then i get the CNFE. Where exactly am i making a mistake?
    i have been trying to get some help but not able to, if someone can point me to a good url or even a simple example of this, i'd appreciate it very much.
    -D
    Edited by: dilip_jsf on Oct 29, 2007 11:59 AM
    see my prev post here: i dont intend to be rude, i consider myself an ignoramus w.r.t Java.
    http://forum.java.sun.com/thread.jspa?threadID=5228914

    Is that the tutorial link? Also i have done as you said, i added the following in my Manifest.mf file:
    Manifest-Version: 1.0
    Main-Class: process.TransferFiles
    Class-Path:  lib/msbase.jar lib/mssqlserver.jar lib/msutil.jar log4j.propertiesI created this file inside a folder named META-INF. After that when i jar my app, i specify eclipse to use this manifest file.
    This works except for the log4j jar which throws a CNFE. The jar does not have the 3 sql jars inside it and only has the log4j (which i have excluded in my build path). It works only because i have the 3 sql related jars added to my system CLASSPATH variable. I dont have log4j there. Could it be because of this that i am not able to do logging but do the DB related tasks?
    Also, i would actually like to read up more on working with core java concepts. Where can i start?
    -D
    Any help on this anyone?
    Edited by: dilip_jsf on Oct 30, 2007 6:22 AM

  • How can I launch a web browser from my Java application?

    I've reed about this at Question of the Week (http://developer.java.sun.com/developer/qow/archive/15/index.html). It doesn't work for me. I'm running win2000 and trying:
    try {
    Runtime.getRuntime().exec("start iexplore http://java.sun.com");
    } catch (Exception e) {
    System.out.println( e.getMessage() );
    I get:
    CreateProcess: start iexplore http://java.sun.com error=2
    What's wrong?

    This function will launch the default browser under Windows.
    public static void displayURL(String url) throws IOException   {
        String cmd = null;
        Process p;
        try  {
            String os = System.getProperty("os.name");     
            if (os != null && os.startsWith("Windows")) {
                if (os.startsWith("Windows 9") || os.startsWith("Windows Me"))  // Windows 9x/Me
                    cmd = "start " + url;
                else // Windows NT/2000/XP
                    cmd = "cmd /c start " + url;
                p = Runtime.getRuntime().exec(cmd);     
        catch(IOException x)        {
            // couldn't exec browser
            System.err.println("Could not invoke browser, command=" + cmd);

  • Creating a Windows installer for Java applications

    Hello, I have a question about deployment:
    I have a pure Java desktop application. Obviously, it's in the form of a JAR file. I want to sell this to users who are "clueless" about Java, so I need to wrap it up in an installer file that does the following:
    1. Detects if there is a JRE on the system. If there isn't, send the user over to java.com to grab one.
    2. Once a JRE is installed, then it should install itself so that there are menu entries on the Start menu, icons, all that kind of stuff.
    3. Ideally it would look like it's just a plain old .exe file so users don't even need to be concerned with JARs, etc.
    I found these two open source apps that can wrap a JAR into an EXE:
    http://jsmooth.sourceforge.net/
    http://launch4j.sourceforge.net/
    Both of them look great. They take a JAR and make it into a smart .EXE that knows how to find a JRE and provides reasonable feedback if no suitable JRE is found. launch4j can also display a splash screen, which sounds trivial, but is actually quite important for the user experience. That's great. But the next step is to wrap this EXE into a real installer that sets up menus and icons. Any suggestions on this?
    Thanks

    Try the Nullsoft Scriptable Install System: http://nsis.sourceforge.net/

Maybe you are looking for