Results 1 to 10 of 10
  1. #1
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default is there a way to tell how to execute a java program in the jar

    Myself am a java user so I know after I have jarred my application i can use the command prompt to do something like
    this: java -Xms10m -Xmx1024m -jar aaron1.jar

    but if I give my average computer user my jarred program they won't be able to do that, they will just double click it and it will automatically use javaw.exe

    because i have certain things that I want to come on the command shell it is insufficient, plus, if they close my program that they double clicked, there will still be a javaw.exe process running in their task manager (the process that was supposed to be in the command shell) it will bog there cpu and they won't know why there is a problem and if they don't know how to go unto the tskmmanager and end their javaw.exe process they won't be able to stop it until they restart their computer.
    Last edited by aaroncarpet; 11-14-2009 at 03:51 PM. Reason: typos

  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
    20

    Default

    If you want to execute your application on command prompt, then use a bat file for the execution.

  3. #3
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default Batch files

    I will have to do my research but from what I hear you are saying i can use a dos batch file to execute the command line but the user won't be able to click the bat file(will they?). I have been searching manifest stuff up and down and it doesn't look possible to do it that way.

  4. #4
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default does vista have an autoexec.bat

    i am going through a tutorial but i think i don't need to modify autoexec.bat

  5. #5
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default

    Eranga is right the batch file can control the command path so the end user doesn't have to think...a smart lady she is

    I am using Vista and there is no autoexec.bat and YES you Can double click a batch file and it will execute
    Last edited by aaroncarpet; 11-14-2009 at 10:48 PM. Reason: forgot something

  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
    20

    Default

    Quote Originally Posted by aaroncarpet View Post
    I will have to do my research but from what I hear you are saying i can use a dos batch file to execute the command line but the user won't be able to click the bat file(will they?). I have been searching manifest stuff up and down and it doesn't look possible to do it that way.
    Use of bat files is not a bad idea. Most of the standalone application use bat files a lot. So in my experience, I'm not worried to use them in my applications. Lot's of people get use of nowadays.

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

    Default

    Quote Originally Posted by aaroncarpet View Post
    i am going through a tutorial but i think i don't need to modify autoexec.bat

    That's the power of bat files. You can edit AUTOEXEC.bat file, which is heavily use by the OS, through your bat files. But you have to really care about that. You are going to do changes on client machines, and different users have different settings on there bat files. So if something is going wrong they will blame on you. :p

  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
    20

    Default

    Quote Originally Posted by aaroncarpet View Post
    Eranga is right the batch file can control the command path so the end user doesn't have to think...a smart lady she is

    I am using Vista and there is no autoexec.bat and YES you Can double click a batch file and it will execute
    In Vista they are no longer use AUTOEXEC.bat, all the settings passes to the environment variables. May be there is a single dummy entries/settings in the initial installation.

    That means you can see a AUTOEXEC.bat file in vista, but write protected. And also it's hidden as in previous Windows OSs. Again it's NOT a good idea to change system protected files.

  9. #9
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default dummy bat

    yeah I got the dummy bat in vista which means that i can create an executeable bat without touching the os....pretty much the bat does the command line...but Eranga? I have j2se installed...what about clients with just the jre do they have java and javaw?

    the original tutorial was for dos based and they wanted the user to modify the autoexec.bat to include the directory of their bat
    so now the question is ....I specified my folder allocation in my bat so how do i control folder allocation when deploying on a client computer
    Last edited by aaroncarpet; 11-16-2009 at 04:38 AM. Reason: explanation

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

    Default

    Quote Originally Posted by aaroncarpet View Post
    I have j2se installed...what about clients with just the jre do they have java and javaw?
    To run your Java application (I hope it's desktop application) JRE is enough.

    Quote Originally Posted by aaroncarpet View Post
    the original tutorial was for dos based and they wanted the user to modify the autoexec.bat to include the directory of their bat
    so now the question is ....I specified my folder allocation in my bat so how do i control folder allocation when deploying on a client computer
    I'm not clear exactly what's you are looking for? Do you want to create folder structure within your application and place bat file there?

Similar Threads

  1. Execute external program from java
    By ankitmcgill in forum New To Java
    Replies: 1
    Last Post: 06-01-2009, 03:58 AM
  2. Execute a jar command from a java program
    By apremanandh in forum New To Java
    Replies: 3
    Last Post: 05-21-2008, 02:04 PM
  3. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  5. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 05:42 AM

Tags for this Thread

Posting Permissions

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