Results 1 to 12 of 12
  1. #1
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default Please help => problem when run *.jar

    hi all , i have some problem when i am trying to run jar file .
    i try run *.jar from command prompt , the error message is " Error ,file setting not found " . I don't know what exactly point was wrong .I make the application by netbeans , when i run from netbeans there work well .
    note : i try to run Java2Demo.jar that's JDK have ,it's work well .
    i hope someone can tell me what's wrong with my application ....

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you post the complete error message?

    If you are working on NetBeans, and if you want to run it from outside the NetBeans, you must keep the same folder structure. Did you copied entire dist folder ?

  3. #3
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    from the comand prompt , i go to the the folder structure .and stop at dist .and then iam typing java -jar myaplication.jar
    the error message only "Error , file setting not found "

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Is this a custom message added from your source? I've never see this kind of error message on -jar option.

  5. #5
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    thanks eranga , i was checked .this message from my code . in my code i load some txt file in source package .but why there is problem when run by *.jar , by netbeans no problem i found .

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Can you show some related code segments to that over here. May be something wrong with the file path. Are you use relative path or absolute path to access/read the file?

  7. #7
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    File file = new File ("src/Setting.txt");
    try {
    Scanner input = new Scanner (file);
    while(input.hasNext())

    .....

    i use this for load txt file

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by kalyana View Post
    File file = new File ("src/Setting.txt");
    try {
    Scanner input = new Scanner (file);
    while(input.hasNext())

    .....

    i use this for load txt file
    Yes this is wrong, inside the dist folder you cannot find a folder name src right? Either you've to create a src folder within dist or use the absolute path.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  10. #10
    kalyana is offline Member
    Join Date
    Aug 2010
    Posts
    25
    Rep Power
    0

    Default

    i put setting.txt under of Source package root .
    so , iam set file ( " src/setting.txt") .
    when iam set file( "setting.txt ) , netbeans error . not found file .
    how should i do for this ?? sory iam new in java ...

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Simplest way to solve this is create a folder name src in dist folder, and copy the text file into that src.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Posting Permissions

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