Results 1 to 12 of 12
  1. #1
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default Need help with eclipse 3.4 and external jar file

    Hi all,,

    i'm trying to develop billing application for my assignment,, when trying to develop this app,, i'm stuck on this problem..

    i want to run external jar file on eclipse,, here me source code.. ( i've modify a little,, just to save space)

    public static void main(String args[]) {
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    try {

    Desktop.getDesktop().open( new File(this.getClass().getResource("jrdesktop-0.3b.jar").getFile()));

    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    });
    }

    and receive error :

    The file: C:\Documents%20and%20Settings\Om%20Dino\workspace\ BillingServer-Eclipse\bin\jrdesktop-0.3b.jar doesn't exist

    any help would be vary appreciate..

    thx..

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Does the file exist on the reported path then?

  3. #3
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default

    thx for quick reply..

    i put that file on bin directory of my project..

    any suggestion for me ?

    thx b4..

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by point_Base View Post
    ...

    i put that file on bin directory of my project..

    ...
    Is that the same path reported for the error above?

  5. #5
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default

    yup..

    same folder..

  6. #6
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default

    yup..

    same folder..

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    As you can see from your code Netbeans can't find it from that path. Perhaps you need to refresh your project after the jar there.
    So why are you trying to run the jar file from your code any way? Why can't people just double click that jar file if they want to run it?

  8. #8
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default

    sory for taking so Long..

    i'm using eclipse IDE,,

    As you can see,, those jar (jrdesktop-0.3b.jar) was intended to be run inside my java app..

    in future development i want handle an event click to run those jar from my app..

    id don not want user to run those jar without my application.
    (i assume in billing application,, only my application permitted to be run)

    any suggestion for me ?

    thx..

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Instead of running the jar file, why not just do what it's main class' main method does on the event handler?

  10. #10
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

    Default

    i'm sory, but i dont know what you meant..

    sorry..

    would you explain to me..

  11. #11
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    The jar file is runnable so it has a main class specified in it's manifest. The main method of that main class is going to be run when that jar file is clicked. So in your handler you can just do
    Java Code:
    MainClass.main(null);

  12. #12
    point_Base is offline Member
    Join Date
    Sep 2009
    Posts
    13
    Rep Power
    0

Similar Threads

  1. Replies: 19
    Last Post: 11-27-2010, 01:31 AM
  2. Execute external file/program
    By sirwiggles in forum New To Java
    Replies: 3
    Last Post: 04-22-2009, 12:35 AM
  3. External runtime resources access in Eclipse
    By batkins61 in forum Eclipse
    Replies: 0
    Last Post: 01-07-2009, 06:42 PM
  4. Replies: 1
    Last Post: 12-13-2008, 02:24 AM
  5. Use a external file in my program
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:28 AM

Posting Permissions

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