Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

.jar file is not working properly :developed in NETBEANS

usman_noshahiSep 1 2013 — edited Sep 5 2013

Hi Gurus,

i am using NETBEANS IDE 7.2.

i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,

but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.

this is how i call the .bat file...

  1.   String filePath = "D:/pms/Libraries/portlib.bat";  
  2.         try
  3.           Process p = Runtime.getRuntime().exec(filePath); 
  4.         } catch (Exception e) { 
  5.             e.printStackTrace(); 
  6.         } 
  7.     }  

and below is the contents of portlib.bat file

  1. java -jar "D:\SMS\SMS\dist\SMS.jar" 

--------------------------------------------------------------------

you must probably ask why i am calling a .jar file using .bat file .

reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,

if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).

that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.

Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,

thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2013
Added on Sep 1 2013
8 comments
2,238 views