Results 1 to 7 of 7
  1. #1
    jasmu is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default Opening the Application

    Hai,

    How to open application(For eg. any file) using java code?

    Thanks in advance....

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    I can only assume you want the DeskTop class. Check out the API docs for that class.

  3. #3
    jasmu is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default

    Hi,

    Thanks for ur reply.

    Actually my requirement to open a pdf file using java program. I installed netbeans in my Mac Machine.

    Without using this type of batch file ,can i open that file in any other way?

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    What "type of batch file"? What are you talking about?

    If you want to display a files contents solely using Java, and no other applications (which runs counter to what you asked in the first post), then you need to program your app in such a way that it recognises the file type and then uses the proper libraries to display it. And, no, there is "super function" that does all this for you.

    For PDF Google for the iText library.

    If you want to be able to have Java use some other application to display whatever file it wishes to display, then, as I have already said, see the API docs for the DeskTop class.

  5. #5
    jasmu is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default

    Thanks for your reply,

    For example,
    in java program, i giving the path and file name to open the file.

    i need a help,

    Java Code:
    File file1 = new File ("\\\\172.16.3.203\\transfer\\Mubeena\\DocStation.pdf");
            if (file1.exists ())
            {
    //            file1.canExecute();
                 // here i want to write the code, to open that file.
             }

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    Like I said, Google for iText if you want to display it yourself, and see the API docs for DeskTop if you want to use an external tool to display it.

    At least try it.

  7. #7
    jasmu is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default

    Thanks for your reply,

    Java Code:
    Desktop desktop = Desktop.getDesktop();
    I Made the job done, using the above code

Similar Threads

  1. opening ports
    By prashant in forum Networking
    Replies: 2
    Last Post: 03-22-2009, 08:23 PM
  2. Opening in Java and .Net
    By techinvo in forum Jobs Offered
    Replies: 0
    Last Post: 03-22-2009, 07:24 AM
  3. opening of an exe in JFrame
    By smartsubroto in forum New To Java
    Replies: 3
    Last Post: 07-16-2008, 05:01 AM
  4. Opening a workspace twice
    By javaplus in forum Eclipse
    Replies: 0
    Last Post: 01-08-2008, 09:56 AM
  5. Opening URLConnection
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-24-2007, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •