FTP & /etc/ftpchroot

I want to restrict a user(s) to a their home folder.
I found this, http://nicinabox.com/2008/02/20/ftp-only-accounts-under-mac-os-x/ and I didn't get past the ftpchroot file. I can;t seem to make it work. I know there could be possible two location for this file. One in /Library/FTPServer/Configuration and the other in /etc, but I'm not sure. /Library/FTPServer/Configuration is the place I would assume it works because ftpusers file in this location works.
I there anybody out there who can help me get ftpchroot working?
I'm on an xserver
Darwin 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386

I used this to simplify management of FTP in X server:
(I ditched the built in FTP service on X server and used this)...
1. Download and install: http://jeanmatthieu.free.fr/pureftpd/index.html
2. Run setup assistant, I created a "virtualftp" user and "virtualftp" group (Use whatever name you want here, I am just putting a general name).
3. If you want security (I did) limit to TLS sessions only. This will require users to connect with an FTP client that supports FTPS (FTP over SSL/TLS). It encrypts logins and commands (But the files themselves are not encrypted so transmitting files that have passwords for instance would not be advisable). It works perfectly fine for your standard webserver though where you wouldn't really have any especially secure files. Not to be confused with SFTP which is essentially SSH.
4. In the users pane, you can create users against this virtual user and then lock them down to the home directory (or any others). You can also create virtual directories that the user has access to outside of their home directory. It is really nice for a multiuser setup where you'd like to restrict users.
5. I did have to give the "virtualftp" user/group access to directories but other users were still locked in to their home directory and couldn't muck around in to other directories with this setup since it was checking against PureFTPd for access rights and not the system. The document root was on an external drive and this virtual user was locked there too.
You can create users against the pureftp database (separate from system users) or against your system user database (pam file).
I chose to separate it since the only users who connect over ftp are external so I wanted to limit their access and footprint on the system. Hope this helps you. In general, I still require a VPN connection for someone to even connect via FTPS even though the login is secure but occasionally I need to allow access for an external dev for a sort period which means opening up the FTP and associate range of ports to "everyone". Even with the extra layer of security afforded by FTPS, I still tend to leave it disabled and funnel my users in to SFTP whenever possible.

Similar Messages

  • How do you set up an FTP server using a NAS device?

    I'm sure this question has been answered before. I run a small graphic design business from my home. Occassionly clients want to send me files and ask if I have an FTP site they can upload to. I recently purchased an NAS enclosure and added a 250 GB HD in it. It's hook up to a Linksys router. I can attach to it using the GO menu using "smb://STORAGE". It appears on the desktop. I have Comcast as my broadband service with a dynamic DNS. I have 2 folders on it, one password protected and the other a Public folder. I would like someone to be able to access the Public folder and upload and download files on it. Would someone be able to explain, in simple terms, how to set this up.

    Well you actually need to have an ftp server running somewhere. I dont know (although i doubt it does) if your NAS has an embedded FTP or SFTP server. If it dosent youll actuall have to have people connect to one of your servers/workstations that has FTP enabled.
    First youll need to log in to your router's admin panel and forward port 21 to the server/workstation that will function as the ftp server.
    Then set up the mount for the NAS device at large or one of the specific folders on it with sharepoints or something on the mac that will act as the ftp server.
    Set up a user as a FTP only user. Youll probably want to make this user only have FTP access (you can google or consult other threads in these forums for this procedure).
    In this users home folder make symlinks to the shares with the command line:
    cd pathto_ftpusers_homedir
    ln -s /Volumes/NAS_Sharepoint NameOfFolderUserWillSee
    Then create the file /etc/ftpchroot which will contain a list of users that will be limited to thier home directory when using ftp. i would use a command line text editor to do this (pico, vi, emacs... choose your poison).
    the file should simply be a list of user shortnames, 1 per line.
    Thats the basics of it. You can get more complicated and might indeed need to set up permissions and what not properly (youll probably want to use ACLS so you dont have to constantly change permissions or login as another user to access files that have been uploaded)but that should get you started i think.

  • Virtual FTP account

    Dear all,
    just wanted to share some information with you and kindly ask for your valued comments.
    A few days ago I needed to provide a local Wordpress installation with a local ftp account. I did not want to create a new full-blown user account (with login-in shell, home directory etc) so instead I followed this route:
    1) I created a new user 'vFTP1' of type Sharing Only
    2) I changed the NFSHomeDirectory for the new user from '/dev/null' to '/Users/Ben/vFTP' (using the Directory Utility)
    3) I added the line '/usr/bin/false' to /etc/shells (in order to allow ftp log-in )
    4) I added the line 'vFTP1' to /etc/ftpchroot (jailing the user to its home directory)
    5) I started the ftp server with 'sudo launchctl load -w /System/Library/LaunchDaemons/ftp.plist', and tested log-in and tried to jail-break. Everything went fine and I am happy now!
    I would much appreciate your comments on the above described method, its security implications as well as and other concerns/comments you might have (I am not so experienced on this topic). Could/should I have done this in another fashion? If anyone knows how to do this 100% from the Terminal, then I would much like to know.
    The computer I use is an older MacBook Pro (2010?) with OS X 10.8.2
    Cheers & thanks for your time,
    /Ben

    When you administer the web site, click on the "Web Server"
    tab (left hand side). Remove any references to the IP number you
    see there.

  • FTP server acess.

    Hi friends,
    I have configured sender File CC..
    In CC monitoring i am getting this error,. as connection to FTP is not established..
    I have check the ping and telnet for port every thing is fine...
    is it host entry in server is required to acess ftp ..
    the error in CC monitoring is...
    Error occurred while connecting to the FTP server "ftp://10.63.14.149/:21": java.net.UnknownHostException: ftp://10.63.14.149/
    Regards
    Vijay

    >
    vijay Kumar wrote:
    > Hi friends,
    >
    > I have configured sender File CC..
    >
    > In CC monitoring i am getting this error,. as connection to FTP is not established..
    >
    > I have check the ping and telnet for port every thing is fine...
    > is it host entry in server is required to acess ftp ..
    > the error in CC monitoring is...
    >
    > Error occurred while connecting to the FTP server "ftp://10.63.14.149/:21": java.net.UnknownHostException: ftp://10.63.14.149/
    >
    > Regards
    > Vijay
    what have you given in the server details?
    you should just give the ip and no need of prefix like ftp:// etc.
    further ref: /people/shabarish.vijayakumar/blog/2006/08/01/along-came-a-file-adapter-mr-ftp-and-rest-of-the-gang

  • Filesharing, ftp protocol

    Hey everyone im trying to set up an ftp out of the file sharing property. I've selected the file sharing on, checked ftp. When i go to the ftp adress it gives me it says, "You don’t have permission to view “Macintosh HD”.". I was wondering if anyone can help me with this issue, and point me in the direction of how I would get an ftp working, thank you.

    LittleSaint wrote:
    In 10.5, file sharing is enabled by checking "File Sharing". Under the options for File Sharing, you can choose which servers to turn on - AFP, FTP, or SMB.
    Oh, I see. Thanks - I didn't know that. It makes sense to group them that way and I always thought "personal file sharing" was not entirely self-explanatory.
    I'll have to remember that file sharing -> afp is effectively the new replacement for pfs (and file sharing -> ftp for ftp etc.).
    - cfr

  • Want to post web gallery to my ftp to create a link

    Trying to create a web gallery that I can upload to my ftp and then create a link to put in e mails

    Hi Michael,
    I'm trying to parse your request, let me see if I understand:
    You have a website
    You have an ftp to that website
    You want to upload a web gallery to your website via your ftp
    You want to take the URL of that gallery (on your website) and share it with friends to send them to your gallery on your website.
    Is that correct?
    If that is, I do have one more question: did you create this website with html/ftp/etc. or did you use Wordpress or something like that?
    But a quick guess is that as long as you know the root structure of your site and you know the name of your main html document, it'l be something like:
    html://mysite.com/photos/myvacation/hawaii.html
    Obviously the specifics will be different but that's the essence of it.
    Good luck,
    Gary

  • How to make the Send To function from InfoView work for Email etc?

    Dear Colleagues,
    Which plugin is missing for sending by email? When I choose Send To > Email I get the following message:
    The destination plugin required for this action is disabled. If you require this functionality, please contact your system administrator.  The same goes for FTP Location and File Location as well.
    Hope someone can help!
    Regards Silje
    Edited by: Silje Mari Sunde on Aug 26, 2009 12:25 PM

    Hi,
    BO Administrator has to give access for you for sending a report to mail / other users. If you have admin access then goto CMC -> Servers ->  Click on Properties of Adaptive Job Server -> Click on Destination -> Add all your destination (Email,FTP etc.)
    -> enter Configuration details for email etc else send a mail to your admin if possible with screen shot for the access.
    Cheers,
    Suresh Aluri.
    Edited by: Suresh Babu Aluri on Aug 26, 2009 6:31 PM

  • What happened to my tools in FF4? S3 organizer, Fire FTP?

    In firefox 3.xx I had a Tools menu, which housed add ons suchas S3 organizer, SEO Quake, Fire FTP, etc. Now I can't find those tools, which by the way was setup with all my passwords etc. BUMMER!

    Press either Alt or F10 to temporarily display the menus.
    You can add the Tools menu to the Firefox button by using the Personal Menu (Personal Firefox Button) add-on - https://addons.mozilla.org/firefox/addon/personal-menu

  • FTP Link

    I want to simpify life for my clients, some of whom are not particularly computer savvy. Presently they download files through FilleZilla but often get very confused with FTP etc. How can I add a link on my main Flash website so that clients simply click the link (e.g. Customer Downloads). They then type in their Username & Password and can access their client area (a subfolder on my main website server). Basically I need FTP access through my website.
    Could you assist with the code that i need to add to my Flash site please.

    your customers can't click a link while in their browser and have their browser become an ftp client.
    but you could build an ftp client using flash.  they could click a button in flash and while still in flash be presented with an ftp client interface.

  • Urgent help required for network configuration

    sir
    i have a mixed scenario right now.
    I have only three computer on home network.
    1.vista accer travelmate 4720 laptop loaded with vista sp1 ultimate
    2.normal pc : Core2 duo with XFX ATI REDION graphics card and this pc is loaded with OEL 5.3.x linux but this pc has 2 NICs(eth 0,eth 1) I have connected both with a switch and the switch is connected to a modem for internet.can I use one NIC as private and another NIC as public to access internet?
    3. normal pc : P4 HT and its loaded with win xp sp2 having eth 0
    how to set my network.
    I have connected each NIC with a D-Link switch.And the D-Link switch is connected with DataOne Nokia Siemens network c2110 modem.
    But problems are that
    1) each time i can connect only one PC at a time.
    2)OEL 5.3.x is not connected to the specified modem ever....by [adsl seup|http://forums.oracle.com/forums/thread.jspa?threadID=832112&tstart=0] command.should i configure it during installation?is there any easy shell scriot avilable to do this stuff?
    please help as soon as you can.......
    regards
    Edited by: mango_boy on Sep 7, 2009 4:44 AM

    ifconfig output:
    eth1      Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
              inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1 errors:0 dropped:0 overruns:0 frame:0
              TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:243 (243.0 b)  TX bytes:9406 (9.1 KiB)
              Interrupt:16 Base address:0xec00
    lo        Link encap:Local Loopback 
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:3779 errors:0 dropped:0 overruns:0 frame:0
              TX packets:3779 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:6124500 (5.8 MiB)  TX bytes:6124500 (5.8 MiB)
    virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
              inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
              inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 b)  TX bytes:8360 (8.1 KiB)
    xenbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
              UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)adsl-setup output
    [root@localhost ~]# adsl-setup
    Welcome to the ADSL client setup.  First, I will run some checks on
    your system to make sure the PPPoE client is installed properly...
    LOGIN NAME
    Enter your Login Name (default root): kris_9929
    INTERFACE
    Enter the Ethernet interface connected to the ADSL modem
    For Solaris, this is likely to be something like /dev/hme0.
    For Linux, it will be ethX, where 'X' is a number.
    (default eth0): eth1
    Do you want the link to come up on demand, or stay up continuously?
    If you want it to come up on demand, enter the idle time in seconds
    after which the link should be dropped.  If you want the link to
    stay up permanently, enter 'no' (two letters, lower-case.)
    NOTE: Demand-activated links do not interact well with dynamic IP
    addresses.  You may have some problems with demand-activated links.
    Enter the demand value (default no):
    DNS
    Please enter the IP address of your ISP's primary DNS server.
    If your ISP claims that 'the server will provide dynamic DNS addresses',
    enter 'server' (all lower-case) here.
    If you just press enter, I will assume you know what you are
    doing and not modify your DNS setup.
    Enter the DNS information here: server
    PASSWORD
    Please enter your Password:
    Please re-enter your Password:
    USERCTRL
    Please enter 'yes' (three letters, lower-case.) if you want to allow
    normal user to start or stop DSL connection (default yes): yes
    FIREWALLING
    Please choose the firewall rules to use.  Note that these rules are
    very basic.  You are strongly encouraged to use a more sophisticated
    firewall setup; however, these will provide basic security.  If you
    are running any servers on your machine, you must choose 'NONE' and
    set up firewalling yourself.  Otherwise, the firewall rules will deny
    access to all standard servers like Web, e-mail, ftp, etc.  If you
    are using SSH, the rules will block outgoing SSH connections which
    allocate a privileged source port.
    The firewall choices are:
    0 - NONE: This script will not set any firewall rules.  You are responsible
              for ensuring the security of your machine.  You are STRONGLY
              recommended to use some kind of firewall rules.
    1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
    2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
                    for a LAN
    Choose a type of firewall (0-2): 1
    Start this connection at boot time
    Do you want to start this connection at boot time?
    Please enter no or yes (default no):no
    ** Summary of what you entered **
    Ethernet Interface: eth1
    User name:          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Activate-on-demand: No
    DNS addresses:      Supplied by ISP's server
    Firewalling:        STANDALONE
    User Control:       yes
    Accept these settings and adjust configuration files (y/n)? y
    Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
    Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
      (But first backing it up to /etc/ppp/chap-secrets.bak)
      (But first backing it up to /etc/ppp/pap-secrets.bak)
    Congratulations, it should be all set up!
    Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
    to bring it down.
    Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
    to see the link status.Edited by: mango_boy on Sep 7, 2009 9:02 AM
    added adsl setup output
    Edited by: mango_boy on Sep 7, 2009 9:15 AM

  • When using EA6400 as an access point only, certain features lost

    I've set up my EA6400 and have it connected to my Verizon MW424WR(Gigabit) and it works fine as an access point and the Twonky Server uses the USB drive I have attached to the router's USB port. Problems:
    1)I can not use the linksyssmartwifi link for management, I have to use the IP(set for 192.168.1.50) for this. When trying to register/login, the Linksys end is trying to find a Linksys router but can not and will not allow any action.
    2)Although Twonky will use the attached HD, I can not share the device over the home (Windows) network. I've tried various incantations of the IP \\192.168.1.50\(whatever share name I can think of) with no avail.
    3)Using the Linksys admin, the Device List is incomplete. Devices connected wirelessly  such as my iPod, Roku, Sony Media Player and WD HD TV Live do not show as wirelessly connected and do not have an IP listed.
    4)Is there any point in using the Media Prioritization settings since no routing is done by an access point. Or will it actually prioritize the wireless connection.
    BTW, the Verizon router can not be set in bridge mode so I have to use the router as an access point to accomplish what I wish.
    TIA,
    Randy

    Some applications and router features require the use of the WAN port. If the router is set up for LAN to LAN AP mode only, then those features won't work in this mode. Only Router mode. 
    If the ISP modem has a built in router, it's best to bridge the modem. Having 2 routers on the same line can cause connection problems: Link>http://www.practicallynetworked.com/networking/fixing_double_nat.htm and http://computer.howstuffworks.com/nat.htm If the modem can't be bridged then see if the modem has a DMZ option and input the IP address the router gets from the modem and put that into the modems DMZ. Then connect the router in router mode using the WAN port to the ISP modem, then features and apps should work.
    tduong44 wrote:
    I am having the same problem, not being able to use ANY apps like USB drive, FTP, etc when setting the device in bridge mode because I want to access the drive outside of my network using port forwarding.  Contact Linksys/Cisco support and was told that I needed to setup the Verizon router in Bridge mode..   That was it, that was the solution... AND also to check with provider for instruction how to.. WTH kind of support is that>??

  • How to open new webBrowser in java with BrowserLauncher.java

    I m using BrowserLauncher.java which opens default webBrowser but i want to open new webBrowser for new request each time.
    Plz suggest to me what changes i have to made in this java class.
    it is very urgent???
    package com.pst.lmsgui.utils;
    import java.io.File;
    import java.io.IOException;
    import java.lang.reflect.Constructor;
    import java.lang.reflect.Field;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    * BrowserLauncher is a class that provides one static method, openURL, which opens the default
    * web browser for the current user of the system to the given URL. It may support other
    * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously
    * tested and is not guaranteed to work.
    * <p>
    * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms
    * that are not part of the standard JDK. What we're trying to do, though, is to take something
    * that's frequently desirable but inherently platform-specific -- opening a default browser --
    * and allow programmers (you, for example) to do so without worrying about dropping into native
    * code or doing anything else similarly evil.
    * <p>
    * Anyway, this code is completely in Java and will run on all JDK 1.1(or better)-compliant systems without
    * modification or a need for additional libraries. All classes that are required on certain
    * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not
    * found, will not cause this to do anything other than returning an error when opening the
    * browser.
    * <p>
    * There are certain system requirements for this class, as it's running through Runtime.exec(),
    * which is Java's way of making a native system call. Currently, this requires that a Macintosh
    * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that
    * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder
    * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and
    * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems
    * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops
    * back from the inherently platform-sensitive concept of a default browser and simply attempts
    * to launch Netscape via a shell command.
    * <p>
    * This code is Copyright 1999 by Eric Albert ([email protected]) and may be redistributed
    * or modified in any form without restrictions as long as the portion of this comment from this
    * paragraph through the end of the comment is not removed. The author requests that he be
    * notified of any application, applet, or other binary that makes use of this code, but that's
    * more out of curiosity than anything and is not required. This software includes no warranty.
    public class BrowserLauncher
    * The Java virtual machine that we are running on. Actually, in most cases we only care
    * about the operating system, but some operating systems require us to switch on the VM. */
    private static int jvm;
    /** The browser for the system */
    private static Object browser;
    * Caches whether any classes, methods, and fields that are not part of the JDK and need to
    * be dynamically loaded at runtime loaded successfully.
    * <p>
    * Note that if this is <code>false</code>, <code>openURL()</code> will always return an
    * IOException.
    private static boolean loadedWithoutErrors;
    /** The com.apple.mrj.MRJFileUtils class */
    private static Class mrjFileUtilsClass;
    /** The com.apple.mrj.MRJOSType class */
    private static Class mrjOSTypeClass;
    /** The com.apple.MacOS.MacOSError class */
    private static Class macOSErrorClass;
    /** The com.apple.MacOS.AEDesc class */
    private static Class aeDescClass;
    /** The <init>(int) method of com.apple.MacOS.AETarget */
    private static Constructor aeTargetConstructor;
    /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */
    private static Constructor appleEventConstructor;
    /** The <init>(String) method of com.apple.MacOS.AEDesc */
    private static Constructor aeDescConstructor;
    /** The findFolder method of com.apple.mrj.MRJFileUtils */
    private static Method findFolder;
    /** The getFileType method of com.apple.mrj.MRJOSType */
    private static Method getFileType;
    /** The makeOSType method of com.apple.MacOS.OSUtils */
    private static Method makeOSType;
    /** The putParameter method of com.apple.MacOS.AppleEvent */
    private static Method putParameter;
    /** The sendNoReply method of com.apple.MacOS.AppleEvent */
    private static Method sendNoReply;
    /** Actually an MRJOSType pointing to the System Folder on a Macintosh */
    private static Object kSystemFolderType;
    /** The keyDirectObject AppleEvent parameter type */
    private static Integer keyDirectObject;
    /** The kAutoGenerateReturnID AppleEvent code */
    private static Integer kAutoGenerateReturnID;
    /** The kAnyTransactionID AppleEvent code */
    private static Integer kAnyTransactionID;
    /** JVM constant for MRJ 2.0 */
    private static final int MRJ_2_0 = 0;
    /** JVM constant for MRJ 2.1 or later */
    private static final int MRJ_2_1 = 1;
    /** JVM constant for any Windows 9x JVM */
    private static final int WINDOWS_9x = 2;
    /** JVM constant for any Windows NT JVM */
    private static final int WINDOWS_NT = 3;
    /** JVM constant for any other platform */
    private static final int OTHER = -1;
    * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English
    * systems from working properly.
    private static final String FINDER_TYPE = "FNDR";
    * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the
    * application.
    private static final String FINDER_CREATOR = "MACS";
    /** The name for the AppleEvent type corresponding to a GetURL event. */
    private static final String GURL_EVENT = "GURL";
    * The first parameter that needs to be passed into Runtime.exec() to open the default web
    * browser on Windows.
    private static final String FIRST_WINDOWS_PARAMETER = "/c";
    /** The second parameter for Runtime.exec() on Windows. */
    private static final String SECOND_WINDOWS_PARAMETER = "start";
    * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
    * on many command-line systems.
    private static final String NETSCAPE_OPEN_PARAMETER_START = " -remote openURL(";
    private static final String NETSCAPE_OPEN_PARAMETER_END = ")";
    * The message from any exception thrown throughout the initialization process.
    private static String errorMessage;
    * An initialization block that determines the operating system and loads the necessary
    * runtime data.
    static
    loadedWithoutErrors = true;
    String osName = System.getProperty("os.name");
    if ("Mac OS".equals(osName))
    String mrjVersion = System.getProperty("mrj.version");
    String majorMRJVersion = mrjVersion.substring(0, 3);
    try
    double version =
    Double.valueOf(majorMRJVersion).doubleValue();
    if (version == 2)
    jvm = MRJ_2_0;
    else if (version >= 2.1)
    // For the time being, assume that all post-2.0 versions of MRJ work the same
    jvm = MRJ_2_1;
    else
    loadedWithoutErrors = false;
    errorMessage = "Unsupported MRJ version: " + version;
    catch (NumberFormatException nfe)
    loadedWithoutErrors = false;
    errorMessage = "Invalid MRJ version: " + mrjVersion;
    else if (osName.startsWith("Windows"))
    { //still needs verification against Win2K
    if (osName.indexOf("9") != -1)
    jvm = WINDOWS_9x;
    else
    jvm = WINDOWS_NT;
    else
    jvm = OTHER;
    if (loadedWithoutErrors)
    { // if we haven't hit any errors yet
    loadedWithoutErrors = loadClasses();
    * This class should be never be instantiated; this just ensures so.
    BrowserLauncher()
    * Called by a static initializer to load any classes, fields, and methods required at runtime
    * to locate the user's web browser.
    * @return <code>true</code> if all intialization succeeded
    *               <code>false</code> if any portion of the initialization failed
    private static boolean loadClasses()
    switch (jvm)
    case MRJ_2_0:
    try
    Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
    macOSErrorClass = Class.forName("com.apple.MacOS.MacOSError");
    Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
    Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
    Class aeClass = Class.forName("com.apple.MacOS.ae");
    aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
    aeTargetConstructor =
    aeTargetClass.getDeclaredConstructor(
    new Class []{ int.class });
    appleEventConstructor =
    appleEventClass.getDeclaredConstructor(
    new Class[]{ int.class, int.class,
    aeTargetClass, int.class, int.class });
    aeDescConstructor = aeDescClass.getDeclaredConstructor(
    new Class[]{ String.class });
    makeOSType =
    osUtilsClass.getDeclaredMethod("makeOSType",
    new Class []{ String.class });
    putParameter =
    appleEventClass.getDeclaredMethod("putParameter",
    new Class[]{ int.class, aeDescClass });
    sendNoReply =
    appleEventClass.getDeclaredMethod("sendNoReply",
    new Class[]{ });
    Field keyDirectObjectField =
    aeClass.getDeclaredField("keyDirectObject");
    keyDirectObject =
    (Integer) keyDirectObjectField.get(null);
    Field autoGenerateReturnIDField =
    appleEventClass.getDeclaredField("kAutoGenerateReturnID");
    kAutoGenerateReturnID =
    (Integer) autoGenerateReturnIDField.get(null);
    Field anyTransactionIDField =
    appleEventClass.getDeclaredField("kAnyTransactionID");
    kAnyTransactionID =
    (Integer) anyTransactionIDField.get(null);
    catch (ClassNotFoundException cnfe)
    errorMessage = cnfe.getMessage();
    return false;
    catch (NoSuchMethodException nsme)
    errorMessage = nsme.getMessage();
    return false;
    catch (NoSuchFieldException nsfe)
    errorMessage = nsfe.getMessage();
    return false;
    catch (IllegalAccessException iae)
    errorMessage = iae.getMessage();
    return false;
    break;
    case MRJ_2_1:
    try
    mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
    mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
    Field systemFolderField =
    mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
    kSystemFolderType = systemFolderField.get(null);
    findFolder =
    mrjFileUtilsClass.getDeclaredMethod("findFolder",
    new Class[]{ mrjOSTypeClass });
    getFileType =
    mrjFileUtilsClass.getDeclaredMethod("getFileType",
    new Class[]{ File.class });
    catch (ClassNotFoundException cnfe)
    errorMessage = cnfe.getMessage();
    return false;
    catch (NoSuchFieldException nsfe)
    errorMessage = nsfe.getMessage();
    return false;
    catch (NoSuchMethodException nsme)
    errorMessage = nsme.getMessage();
    return false;
    catch (SecurityException se)
    errorMessage = se.getMessage();
    return false;
    catch (IllegalAccessException iae)
    errorMessage = iae.getMessage();
    return false;
    break;
    return true;
    * Attempts to locate the default web browser on the local system. Caches results so it
    * only locates the browser once for each use of this class per JVM instance.
    * @return The browser for the system. Note that this may not be what you would consider
    *     to be a standard web browser; instead, it's the application that gets called to
    *     open the default web browser. In some cases, this will be a non-String object
    *     that provides the means of calling the default browser.
    private static Object locateBrowser()
    if (browser != null)
    return browser;
    switch (jvm)
    case MRJ_2_0:
    try
    Integer finderCreatorCode =
    (Integer) makeOSType.invoke(null,
    new Object[]{ FINDER_CREATOR });
    Object aeTarget = aeTargetConstructor.newInstance(
    new Object[]{ finderCreatorCode });
    Integer gurlType = (Integer) makeOSType.invoke(null,
    new Object[]{ GURL_EVENT });
    Object appleEvent = appleEventConstructor.newInstance(
    new Object[]{ gurlType, gurlType, aeTarget,
    kAutoGenerateReturnID, kAnyTransactionID });
    // Don't set browser = appleEvent because then the next time we call
    // locateBrowser(), we'll get the same AppleEvent, to which we'll already have
    // added the relevant parameter. Instead, regenerate the AppleEvent every time.
    // There's probably a way to do this better; if any has any ideas, please let
    // me know.
    return appleEvent;
    catch (IllegalAccessException iae)
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    catch (InstantiationException ie)
    browser = null;
    errorMessage = ie.getMessage();
    return browser;
    catch (InvocationTargetException ite)
    browser = null;
    errorMessage = ite.getMessage();
    return browser;
    case MRJ_2_1:
    File systemFolder;
    try
    systemFolder = (File) findFolder.invoke(null,
    new Object[]{ kSystemFolderType });
    catch (IllegalArgumentException iare)
    browser = null;
    errorMessage = iare.getMessage();
    return browser;
    catch (IllegalAccessException iae)
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    catch (InvocationTargetException ite)
    browser = null;
    errorMessage = ite.getTargetException().getClass() +
    ": " + ite.getTargetException().getMessage();
    return browser;
    String[] systemFolderFiles = systemFolder.list();
    // Avoid a FilenameFilter because that can't be stopped mid-list
    for (int i = 0; i < systemFolderFiles.length; i++)
    try
    File file = new File(systemFolder,
    systemFolderFiles);
    if (!file.isFile())
    continue;
    Object fileType = getFileType.invoke(null,
    new Object[]{ file });
    if (FINDER_TYPE.equals(fileType.toString()))
    browser = file.toString(); // Actually the Finder, but that's OK
    return browser;
    catch (IllegalArgumentException iare)
    browser = browser;
    errorMessage = iare.getMessage();
    return null;
    catch (IllegalAccessException iae)
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    catch (InvocationTargetException ite)
    browser = null;
    errorMessage = ite.getTargetException().getClass() +
    ": " + ite.getTargetException().
    getMessage();
    return browser;
    browser = null;
    break;
    case WINDOWS_NT:
    browser = "cmd.exe";
    break;
    case WINDOWS_9x:
    browser = "command.com";
    break;
    case OTHER: //fall through
    default:
    browser = "netscape";
    break;
    return browser;
    * Attempts to open the default web browser to the given URL.
    * @param url The URL to open
    * @throws IOException If the web browser could not be located or does not run
    public static void openURL(String url) throws IOException
    if (!loadedWithoutErrors)
    throw new IOException("Exception in finding browser: " +
    errorMessage);
    Object browser = locateBrowser();
    if (browser == null)
    throw new IOException("Unable to locate browser: " +
    errorMessage);
    switch (jvm)
    case MRJ_2_0:
    Object aeDesc = null;
    try
    aeDesc = aeDescConstructor.newInstance(
    new Object[]{ url });
    putParameter.invoke(browser,
    new Object[]{ keyDirectObject, aeDesc });
    sendNoReply.invoke(browser, new Object[]{ });
    catch (InvocationTargetException ite)
    throw new IOException(
    "InvocationTargetException while creating AEDesc: " +
    ite.getMessage());
    catch (IllegalAccessException iae)
    throw new IOException(
    "IllegalAccessException while building AppleEvent: " +
    iae.getMessage());
    catch (InstantiationException ie)
    throw new IOException(
    "InstantiationException while creating AEDesc: " +
    ie.getMessage());
    finally { aeDesc = null; // Encourage it to get disposed if it was created
    browser = null; // Ditto
    } break;
    case MRJ_2_1:
    Runtime.getRuntime().exec(
    new String[]{ (String) browser, url });
    break;
    case WINDOWS_NT://fall through
    case WINDOWS_9x:
    Runtime.getRuntime().exec( new String[]{ (String) browser,
    FIRST_WINDOWS_PARAMETER,
    SECOND_WINDOWS_PARAMETER, url });
    break;
    case OTHER:
    // Assume that we're on Unix and that Netscape is installed
    // First, attempt to open the URL in a currently running session of Netscape
    Process process =
    Runtime.getRuntime().exec((String) browser +
    NETSCAPE_OPEN_PARAMETER_START + url +
    NETSCAPE_OPEN_PARAMETER_END);
    try
    int exitCode = process.waitFor();
    if (exitCode != 0)
    { // if Netscape was not open
    Runtime.getRuntime().exec(
    new String[]{ (String) browser, url });
    catch (InterruptedException ie)
    throw new IOException(
    "InterruptedException while launching browser: " +
    ie.getMessage());
    break;
    default:
    // This should never occur, but if it does, we'll try the simplest thing possible
    Runtime.getRuntime().exec(
    new String[]{ (String) browser, url });
    break;
    // Driver to test class
    public static void main(String[] args) throws IOException
         BrowserLauncher br = new BrowserLauncher();
    if (args.length != 1)
    br.openURL("http://mail.lionbridge.com");
    else
    br.openURL(args[0]);

    package com.pst.lmsgui.utils;
    import java.io.File;
    import java.io.IOException;
    import java.lang.reflect.Constructor;
    import java.lang.reflect.Field;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    * BrowserLauncher is a class that provides one static method, openURL, which opens the default
    * web browser for the current user of the system to the given URL. It may support other
    * protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously
    * tested and is not guaranteed to work.
    * Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms
    * that are not part of the standard JDK. What we're trying to do, though, is to take something
    * that's frequently desirable but inherently platform-specific -- opening a default browser --
    * and allow programmers (you, for example) to do so without worrying about dropping into native
    * code or doing anything else similarly evil.
    * Anyway, this code is completely in Java and will run on all JDK 1.1(or better)-compliant systems without
    * modification or a need for additional libraries. All classes that are required on certain
    * platforms to allow this to run are dynamically loaded at runtime via reflection and, if not
    * found, will not cause this to do anything other than returning an error when opening the
    * browser.
    * There are certain system requirements for this class, as it's running through Runtime.exec(),
    * which is Java's way of making a native system call. Currently, this requires that a Macintosh
    * have a Finder which supports the GURL event, which is true for Mac OS 8.0 and 8.1 systems that
    * have the Internet Scripting AppleScript dictionary installed in the Scripting Additions folder
    * in the Extensions folder (which is installed by default as far as I know under Mac OS 8.0 and
    * 8.1), and for all Mac OS 8.5 and later systems. On Windows, it only runs under Win32 systems
    * (Windows 95, 98, and NT 4.0, as well as later versions of all). On other systems, this drops
    * back from the inherently platform-sensitive concept of a default browser and simply attempts
    * to launch Netscape via a shell command.
    * This code is Copyright 1999 by Eric Albert ([email protected]) and may be redistributed
    * or modified in any form without restrictions as long as the portion of this comment from this
    * paragraph through the end of the comment is not removed. The author requests that he be
    * notified of any application, applet, or other binary that makes use of this code, but that's
    * more out of curiosity than anything and is not required. This software includes no warranty.
    public class BrowserLauncher {
    * The Java virtual machine that we are running on. Actually, in most cases we only care
    * about the operating system, but some operating systems require us to switch on the VM.
    private static int jvm; /** The browser for the system */
    private static Object browser;
    * Caches whether any classes, methods, and fields that are not part of the JDK and need to
    * be dynamically loaded at runtime loaded successfully.
    * Note that if this is <code>false</code>, <code>openURL()</code> will always return an
    * IOException.
    private static boolean loadedWithoutErrors; /** The com.apple.mrj.MRJFileUtils class */
    private static Class mrjFileUtilsClass; /** The com.apple.mrj.MRJOSType class */
    private static Class mrjOSTypeClass; /** The com.apple.MacOS.MacOSError class */
    private static Class macOSErrorClass; /** The com.apple.MacOS.AEDesc class */
    private static Class aeDescClass; /** The <init>(int) method of com.apple.MacOS.AETarget */
    private static Constructor aeTargetConstructor; /** The <init>(int, int, int) method of com.apple.MacOS.AppleEvent */
    private static Constructor appleEventConstructor; /** The <init>(String) method of com.apple.MacOS.AEDesc */
    private static Constructor aeDescConstructor; /** The findFolder method of com.apple.mrj.MRJFileUtils */
    private static Method findFolder; /** The getFileType method of com.apple.mrj.MRJOSType */
    private static Method getFileType; /** The makeOSType method of com.apple.MacOS.OSUtils */
    private static Method makeOSType; /** The putParameter method of com.apple.MacOS.AppleEvent */
    private static Method putParameter; /** The sendNoReply method of com.apple.MacOS.AppleEvent */
    private static Method sendNoReply; /** Actually an MRJOSType pointing to the System Folder on a Macintosh */
    private static Object kSystemFolderType; /** The keyDirectObject AppleEvent parameter type */
    private static Integer keyDirectObject; /** The kAutoGenerateReturnID AppleEvent code */
    private static Integer kAutoGenerateReturnID; /** The kAnyTransactionID AppleEvent code */
    private static Integer kAnyTransactionID; /** JVM constant for MRJ 2.0 */
    private static final int MRJ_2_0 = 0; /** JVM constant for MRJ 2.1 or later */
    private static final int MRJ_2_1 = 1; /** JVM constant for any Windows 9x JVM */
    private static final int WINDOWS_9x = 2; /** JVM constant for any Windows NT JVM */
    private static final int WINDOWS_NT = 3; /** JVM constant for any other platform */
    private static final int OTHER = -1; /** * The file type of the Finder on a Macintosh. Hardcoding "Finder" would keep non-U.S. English * systems from working properly. */
    private static final String FINDER_TYPE = "FNDR"; /** * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the * application. */
    private static final String FINDER_CREATOR = "MACS"; /** The name for the AppleEvent type corresponding to a GetURL event. */
    private static final String GURL_EVENT = "GURL"; /** * The first parameter that needs to be passed into Runtime.exec() to open the default web * browser on Windows. */
    private static final String FIRST_WINDOWS_PARAMETER = "/c"; /** The second parameter for Runtime.exec() on Windows. */
    private static final String SECOND_WINDOWS_PARAMETER = "start";
    * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
    * on many command-line systems.
    private static final String NETSCAPE_OPEN_PARAMETER_START = " -remote openURL(";
    private static final String NETSCAPE_OPEN_PARAMETER_END = ")"; /** * The message from any exception thrown throughout the initialization process. */
    private static String errorMessage; /** * An initialization block that determines the operating system and loads the necessary * runtime data. */
    static {
    loadedWithoutErrors = true;
    String osName = System.getProperty("os.name");
    if ("Mac OS".equals(osName)) {
    String mrjVersion = System.getProperty("mrj.version");
    String majorMRJVersion = mrjVersion.substring(0, 3);
    try {
    double version = Double.valueOf(majorMRJVersion).doubleValue();
    if (version == 2) {
    jvm = MRJ_2_0;
    } else if (version >= 2.1) { // For the time being, assume that all post-2.0 versions of MRJ work the same
    jvm = MRJ_2_1;
    } else {
    loadedWithoutErrors = false;
    errorMessage = "Unsupported MRJ version: " + version;
    } catch (NumberFormatException nfe) {
    loadedWithoutErrors = false;
    errorMessage = "Invalid MRJ version: " + mrjVersion;
    } else if (osName.startsWith("Windows")) { //still needs verification against Win2K
    if (osName.indexOf("9") != -1) {
    jvm = WINDOWS_9x;
    } else {
    jvm = WINDOWS_NT;
    } else {
    jvm = OTHER;
    if (loadedWithoutErrors) { // if we haven't hit any errors yet
    loadedWithoutErrors = loadClasses();
    } /** * This class should be never be instantiated; this just ensures so. */
    BrowserLauncher() { }
    * Called by a static initializer to load any classes, fields, and methods required at runtime * to locate the user's web browser.
    * @return <code>true</code> if all intialization succeeded * <code>false</code> if any portion of the initialization failed */
    private static boolean loadClasses() {
    switch (jvm) {
    case MRJ_2_0:
    try {
    Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
    macOSErrorClass = Class.forName("com.apple.MacOS.MacOSError");
    Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
    Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
    Class aeClass = Class.forName("com.apple.MacOS.ae");
    aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
    aeTargetConstructor = aeTargetClass.getDeclaredConstructor( new Class []{ int.class });
    appleEventConstructor = appleEventClass.getDeclaredConstructor( new Class[]{ int.class, int.class, aeTargetClass, int.class, int.class });
    aeDescConstructor = aeDescClass.getDeclaredConstructor( new Class[]{ String.class });
    makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class []{ String.class });
    putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[]{ int.class, aeDescClass });
    sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[]{ });
    Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
    keyDirectObject = (Integer) keyDirectObjectField.get(null);
    Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
    kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
    Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
    kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
    } catch (ClassNotFoundException cnfe) {
    errorMessage = cnfe.getMessage();
    return false;
    } catch (NoSuchMethodException nsme) {
    errorMessage = nsme.getMessage();
    return false;
    } catch (NoSuchFieldException nsfe) {
    errorMessage = nsfe.getMessage();
    return false;
    } catch (IllegalAccessException iae) {
    errorMessage = iae.getMessage();
    return false;
    } break;
    case MRJ_2_1:
    try {
    mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
    mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
    Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
    kSystemFolderType = systemFolderField.get(null);
    findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[]{ mrjOSTypeClass });
    getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[]{ File.class });
    } catch (ClassNotFoundException cnfe) {
    errorMessage = cnfe.getMessage();
    return false;
    } catch (NoSuchFieldException nsfe) {
    errorMessage = nsfe.getMessage();
    return false;
    } catch (NoSuchMethodException nsme) {
    errorMessage = nsme.getMessage();
    return false;
    } catch (SecurityException se) {
    errorMessage = se.getMessage();
    return false;
    } catch (IllegalAccessException iae) {
    errorMessage = iae.getMessage();
    return false;
    break;
    return true;
    * Attempts to locate the default web browser on the local system. Caches results so it
    * only locates the browser once for each use of this class per JVM instance.
    * @return The browser for the system. Note that this may not be what you would consider
    * to be a standard web browser; instead, it's the application that gets called to
    * open the default web browser. In some cases, this will be a non-String object
    * that provides the means of calling the default browser.
    private static Object locateBrowser() {
    if (browser != null) {
    return browser;
    switch (jvm) {
    case MRJ_2_0:
    try {
    Integer finderCreatorCode = (Integer) makeOSType.invoke(null, new Object[]{ FINDER_CREATOR });
    Object aeTarget = aeTargetConstructor.newInstance( new Object[]{ finderCreatorCode });
    Integer gurlType = (Integer) makeOSType.invoke(null, new Object[]{ GURL_EVENT });
    Object appleEvent = appleEventConstructor.newInstance( new Object[]{ gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID });
    // Don't set browser = appleEvent because then the next time we call
    // locateBrowser(), we'll get the same AppleEvent, to which we'll already have
    // added the relevant parameter. Instead, regenerate the AppleEvent every time.
    // There's probably a way to do this better; if any has any ideas, please let
    // me know.
    return appleEvent;
    } catch (IllegalAccessException iae) {
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    } catch (InstantiationException ie) {
    browser = null;
    errorMessage = ie.getMessage();
    return browser;
    } catch (InvocationTargetException ite) {
    browser = null;
    errorMessage = ite.getMessage();
    return browser;
    case MRJ_2_1:
    File systemFolder;
    try {
    systemFolder = (File) findFolder.invoke(null, new Object[]{ kSystemFolderType });
    } catch (IllegalArgumentException iare) {
    browser = null;
    errorMessage = iare.getMessage();
    return browser;
    } catch (IllegalAccessException iae) {
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    } catch (InvocationTargetException ite) {
    browser = null;
    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
    return browser;
    String[] systemFolderFiles = systemFolder.list();
    // Avoid a FilenameFilter because that can't be stopped mid-list
    for (int i = 0; i < systemFolderFiles.length; i++) {
    try {
    File file = new File(systemFolder, systemFolderFiles);
    if (!file.isFile()) {
    continue;
    Object fileType = getFileType.invoke(null, new Object[]{ file });
    if (FINDER_TYPE.equals(fileType.toString())) {
    browser = file.toString();
    // Actually the Finder, but that's OK return browser;
    } catch (IllegalArgumentException iare) {
    browser = browser;
    errorMessage = iare.getMessage();
    return null;
    } catch (IllegalAccessException iae) {
    browser = null;
    errorMessage = iae.getMessage();
    return browser;
    } catch (InvocationTargetException ite) {
    browser = null;
    errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException(). getMessage();
    return browser;
    browser = null;
    break;
    case WINDOWS_NT:
    browser = "cmd.exe";
    break;
    case WINDOWS_9x:
    browser = "command.com";
    break;
    case OTHER: //fall through
    default:
    browser = "netscape";
    break;
    return browser;
    * Attempts to open the default web browser to the given URL.
    * @param url The URL to open
    * @throws IOException If the web browser could not be located or does not run
    public static void openURL(String url) throws IOException {
    if (!loadedWithoutErrors) {
    throw new IOException("Exception in finding browser: " + errorMessage);
    Object browser = locateBrowser();
    if (browser == null) {
    throw new IOException("Unable to locate browser: " + errorMessage);
    switch (jvm) {
    case MRJ_2_0:
    Object aeDesc = null;
    try {
    aeDesc = aeDescConstructor.newInstance( new Object[]{ url });
    putParameter.invoke(browser, new Object[]{ keyDirectObject, aeDesc });
    sendNoReply.invoke(browser, new Object[]{ });
    } catch (InvocationTargetException ite) {
    throw new IOException( "InvocationTargetException while creating AEDesc: " + ite.getMessage());
    } catch (IllegalAccessException iae) {
    throw new IOException( "IllegalAccessException while building AppleEvent: " + iae.getMessage());
    } catch (InstantiationException ie) {
    throw new IOException( "InstantiationException while creating AEDesc: " + ie.getMessage());
    } finally {
    aeDesc = null; // Encourage it to get disposed if it was created
    browser = null; // Ditto
    } break;
    case MRJ_2_1:
    Runtime.getRuntime().exec( new String[]{ (String) browser, url });
    break;
    case WINDOWS_NT://fall through
    case WINDOWS_9x:
    Runtime.getRuntime().exec( new String[]{ (String) browser, FIRST_WINDOWS_PARAMETER, SECOND_WINDOWS_PARAMETER, url });
    break;
    case OTHER: // Assume that we're on Unix and that Netscape is installed
    // First, attempt to open the URL in a currently running session of Netscape
    Process process = Runtime.getRuntime().exec((String) browser + NETSCAPE_OPEN_PARAMETER_START + url + NETSCAPE_OPEN_PARAMETER_END);
    try {
    int exitCode = process.waitFor();
    if (exitCode != 0) { // if Netscape was not open
    Runtime.getRuntime().exec( new String[]{ (String) browser, url });
    } catch (InterruptedException ie) {
    throw new IOException( "InterruptedException while launching browser: " + ie.getMessage());
    } break;
    default: // This should never occur, but if it does, we'll try the simplest thing possible
    Runtime.getRuntime().exec( new String[]{ (String) browser, url });
    break;
    // Driver to test class
    public static void main(String[] args) throws IOException {
    BrowserLauncher br = new BrowserLauncher();
    if (args.length != 1) br.openURL("http://199.233.155.110:8080");
    else br.openURL(args[0]);

  • How do I open my Blog on another computer?

    I have created an iWeb blog on one computer. But now want to edit it on my other Mac. How do I do that? I have iWeb on both.
    Also - where is my Blog saved on my Mac? What's the default iWeb websites folder?
    Thanks,
    - Greg

    Hi Greg,
    Your question of where iWeb saves its information is exactly the answer to your first question of editing from multiple computers.
    iWeb saves all information about your website in a file called Domain. This file is located at the following folder pathway: Users/yourname/Library/Application Support/iWeb/ This is the file that needs to be copied to the other computer that you want to edit from. It's probably "best" to have one computer where you will do your iWeb work from. Otherwise, you will need to become familiar with methods of copying this Domain file back and forth so that you make sure you are always editing using the most recent Domain file (copying to iDisk, flash drives, FTP, etc).
    Don't forget to always backup this Domain file!!!

  • Sharing two folders with the same name

    Hi all.
    I have two folders with the same name and I would like to be able to share these under different share names. Problem is, this doesn't seem to be possible.
    For instance, try doing this in File Sharing under Server Preferences:
    * Click +, add /Data/Media
    * Edit permissions on "Media" to permit guest access
    * Click +, add /Volumes/Drobo/Media
    * Edit permissions on "Media" (make sure you click the right one!) to permit guess access.
    This appears on the surface to work, but what it has actually done is to delete the share for /Data/Media. If you exit the File Sharing pane and go back into it again, it will be gone.
    Server Admin has the ability to rename a share's name from AFP,SMB,FTP,etc. but this doesn't appear to help either -- I tried adding the second media first, renaming its shared name to Media2 over in Server Admin, and then adding the first. Server Preferences just deletes the second one.
    Such a basic thing as being able to rename the share from Server Preferences would appear to be enough to get around this, but since Apple didn't make it possible, I have no idea how to proceed.
    Does anyone else have this working, and how did you do it?

    The best way to solve this, would be make sure you use database paraneter GLOBAL_NAME, to change your database from lets say orcl1 to orcl1.mycorpdomain.com, by this you can make sure each database actualy has a different name. Your other database then could be named orcl1.example.com.
    When chaning the display name in EM you might face other issues later on when for instance trying to run a restore using EM for one of these databases.
    Regards
    Rob
    http://oemgc.wordpress.com

  • Help, please!  I've Been Hacked!  Firewall & Admin permissions changed?

    Running on 10.4
    MacBook Pro
    You guys have been great, and I tried to read as many threads as I could to solve the problem on my own, but I'm in way too over my head. Okay, I'm going to struggle through explaining this as best I can and just list the "highlights" of what has been going on. More details are below.
    Several events occurred simultaneously, and I'm not sure which did what damage.
    Scanned my machine with ClamXav. Trojan was found. I deleted the Trojan.
    I downloaded a script (against my better judgement), opened it and my machine started working hard. Activity monitor was going crazy. Immediately shut down Airport. Looked at my Firewall, and EVERYTHING was open. I always keep Firewall on. Looked at logs (and saved a few). Good thing I did because for some reason, I now do not have permission to view sa or security logs. Awesome.
    Here is a more detailed account of what happened. I know it's long, but I'm trying to answer any questions you guys might have.
    Two nights ago, I scanned my machine using Clam. It was the first time I had run the scan, and it found a Trojan in the form of an mp3. I located the file in Finder so that I would know where it was located to delete it, clicked on info, and iTunes opened, which I had not planned on because I had only selected info. I immediately force quit iTunes and deleted the file. I was never prompted for my password, so *was the virus executed*? I have since run Clam several times, and there are no infected files.
    Next thing: I downloaded a script which I'm 99% sure was malicious. I'm not a techie, and I know this was incredibly stupid given my lack of knowledge. After opening it, I saw that it was all in a different language (Portuguese, I think?), and immediately closed and deleted. Then my machine started running hard... I checked activity monitor, and things were going crazy. I immediately disconnected from Airport. I don't remember exactly what the numbers were, but there were a lot of page ins/page outs and data being read/written. (I don't even know what those mean exactly, but I check Activity Monitor fairly frequently to look at memory and see what programs are taking up space.) But I was also doing a scan with Clam and I had about 14 tabs open in Safari, so I'm not certain if the activity was correlated to the scan or to the script or to having so many things open and going at once.
    I checked my firewall, and it was off. I hadn't looked at it in a few months, but I'm fairly certain I had it activated. Remote access, FTP, etc. - basically all sharing options were enabled. I disabled everything and started the Firewall. I looked at the logs (even though I don't really know how to read them) and saved several of them which I would be glad to post here. One I saved was the Secure Log - I tried to look at any new activity today, and I got the message "You do not have permission to read this log file". What's strange is that my Firewall has logs dated for preceding days and months... but the Firewall was not activated when I initially checked it.?? That doesn't make a lot of sense to me.
    I created a Master Password (alphanumeric 17 characters) in File Vault, but I did not turn on Fire Vault... I'm not sure if this changed any settings and has to do with why I can't read certain log files.? To my knowledge, I'm still the admin.? How do I tell if that has been changed? I ran Disk Utility, and it changed a few permissions, fwiw, but I still don't have access to particular logs.
    I have Little Snitch running, and it hasn't shown anything abnormal. I looked at my DNS, and it's the same as what it always has been. I'll be glad to post the logs I have, but I don't know what's pertinent and what isn't. Here's a Big Problem: I don't have my installation disk. I know I will probably be advised to wipe everything and reload, but the disk is 500+ miles away tucked in a storage facility. This is killing me. I've been reading everything I can on this forum (you guys are awesome, btw), and was going to try to muddle through this on my own, but I'm way over my head. How can I reinstall if I don't have the installation disks? Or maybe I'm being paranoid and someone didn't get in to my system? Any help would be appreciated.

    If this helps, this is my Firewall plist. The plist was created on the day and around the time of all this happening. If everything is enabled to be editable, does that mean that they could have rewritten the codes after I locked everything down?
    <plist version="1.0">
    <dict>
    <key>allports</key>
    <array/>
    <key>alludpports</key>
    <array/>
    <key>firewall</key>
    <dict>
    <key>Apple Remote Desktop</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>3283</string>
    <string>5900</string>
    </array>
    <key>row</key>
    <integer>5</integer>
    <key>udpport</key>
    <array>
    <string>3283</string>
    <string>5900</string>
    </array>
    </dict>
    <key>FTP Access</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>21</string>
    </array>
    <key>row</key>
    <integer>4</integer>
    </dict>
    <key>Network Time</key>
    <dict>
    <key>editable</key>
    <integer>1</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>row</key>
    <integer>11</integer>
    <key>udpport</key>
    <array>
    <string>123</string>
    </array>
    </dict>
    <key>Personal File Sharing</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>548</string>
    <string>427</string>
    </array>
    <key>row</key>
    <integer>0</integer>
    </dict>
    <key>Personal Web Sharing</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>80</string>
    <string>427</string>
    <string>443</string>
    </array>
    <key>row</key>
    <integer>2</integer>
    </dict>
    <key>Printer Sharing</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>631</string>
    <string>515</string>
    </array>
    <key>row</key>
    <integer>7</integer>
    </dict>
    <key>Remote Apple Events</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>3031</string>
    </array>
    <key>row</key>
    <integer>6</integer>
    </dict>
    <key>Remote Login - SSH</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>22</string>
    </array>
    <key>row</key>
    <integer>3</integer>
    </dict>
    <key>Samba Sharing</key>
    <dict>
    <key>editable</key>
    <integer>0</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>139</string>
    </array>
    <key>row</key>
    <integer>1</integer>
    <key>udpport</key>
    <array>
    <string>137</string>
    <string>138</string>
    </array>
    </dict>
    <key>iChat Rendezvous</key>
    <dict>
    <key>editable</key>
    <integer>1</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>5297</string>
    <string>5298</string>
    </array>
    <key>row</key>
    <integer>8</integer>
    </dict>
    <key>iPhoto Rendezvous Sharing</key>
    <dict>
    <key>editable</key>
    <integer>1</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>8770</string>
    </array>
    <key>row</key>
    <integer>10</integer>
    </dict>
    <key>iTunes Music Sharing</key>
    <dict>
    <key>editable</key>
    <integer>1</integer>
    <key>enable</key>
    <integer>0</integer>
    <key>port</key>
    <array>
    <string>3689</string>
    </array>
    <key>row</key>
    <integer>9</integer>
    </dict>
    </dict>
    <key>loggingenabled</key>
    <integer>1</integer>
    <key>state</key>
    <true/>
    <key>stealthenabled</key>
    <integer>1</integer>
    <key>udpenabled</key>
    <integer>1</integer>
    </dict>
    </plist>

Maybe you are looking for

  • Missing Excel Macro - Didn't save as .xlsm

    So I realized that I didn't save my file as a macro-enabled workbook before I closed it, and now my macro is completely gone.  I haven't shut down the computer since then, and I was wondering if it was still in my computer in a temporary folder somew

  • Tables used

    Hi experts, Need to write to FSpecs. what are the tables/Fields i have to give for the ABAP'er? Cheque  Layout Journal Voucher printing Cash payment voucher Cash receipt voucher Remittance/Payment advice for payments to vendor Debit/Credit Advice Ite

  • Ramifications of setting valuation level to company

    Hello, Our company is using an actual cost system in our current ERP system that works somewhat like the material ledger in SAP. However, one of our requirements is that we valuate COGS transactions for the month at the actual average material price

  • Smartforms. Text in Main is overwritten by a BMP picture

    Dear all, I have the following problem: If I print in the first page of the main a picture the following text element is not printed under the picture. The text is printed into the picture. On all other pages this process scenario works only on the f

  • One earphone not working in Macbook pro

    For some reason the audio output on my macbook pro is only working on one earphone. It is not the earphones as I have tried other earphones and the same thing happens. I had a problem recently with the output not working at all...and there was a red