Results 1 to 4 of 4

Thread: execute .jar via VB

  1. #1
    New Member
    Join Date
    May 12
    Location
    east texas
    Posts
    11

    execute .jar via VB

    im trying to code a simple GUI to launch a .jar with a user specified memory range. for example this is the command line im currently using in a .bat

    java.exe -Xmx3g -Xms512m -jar program-name.jar

    i want to call this in VB and replace the Xmx"" and Xms"" with the input from the text box
    any help is greatly appreciated

    im new here so chances are this is in the wrong forum section if it is i apologize

  2. #2
    Frenzied Member
    Join Date
    Sep 06
    Posts
    1,255

    Re: execute .jar via VB

    Use Shell, something like this
    vb Code:
    1. Private Sub Command1_Click()
    2.     Shell "java.exe " & Text1.Text & " " & Text2.Text & "jar program-name.jar", vbNormalFocus
    3. End Sub

  3. #3
    PowerPoster
    Join Date
    Feb 06
    Posts
    8,576

    Re: execute .jar via VB

    If java.exe isn't in the current PATH you might need to provide a fully-qualified path to it too. If your .jar file isn't in the Current Directory you'll want a full name here as well. Both of those mean extra quotes:

    Code:
    Shell """C:\Program Files\Java\jre6\bin\java.exe"" " _
        & Text1.Text _
        & " " _
        & Text2.Text _
        & " jar ""D:\My Java Stuff\program-name.jar""", _
          vbNormalFocus

  4. #4
    New Member
    Join Date
    May 12
    Location
    east texas
    Posts
    11

    Re: execute .jar via VB

    Quote Originally Posted by 4x2y View Post
    Use Shell, something like this
    vb Code:
    1. Private Sub Command1_Click()
    2.     Shell "java.exe " & Text1.Text & " " & Text2.Text & "jar program-name.jar", vbNormalFocus
    3. End Sub
    that did it (with a bit of tinkering) thanks

Posting Permissions

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