ashish_arp
asked on
problems with "shell" command, not running ".jar" files
hi
why the sheel command is not able to execute
the ".jar" files like ".exe" files even though they are
also exes but in terms of Java. What i want is, if user pushes
certain button on the form then a file,"abc.jar", should be executed.
Is there another way of doing it??
Thanx in advance
Ashish
why the sheel command is not able to execute
the ".jar" files like ".exe" files even though they are
also exes but in terms of Java. What i want is, if user pushes
certain button on the form then a file,"abc.jar", should be executed.
Is there another way of doing it??
Thanx in advance
Ashish
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is a great alternative for you. Just give it a path to your .exe or any other file that is associated with an application and it'll run it for you:
'
' create a new VB project
' Copy+Paste on a module
'
Private Declare Function ShellExecute _
Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal _
hWnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
'
' Copy+Paste into same module
'
Sub RunApp(frm As Form, strXLS As _
String, intWindowStyle As Integer)
Dim lngSuccess As Long
'launch the default browser
lngSuccess = ShellExecute( _
frm.hWnd, "Open", _
strXLS, 0&, 0&, intWindowStyle)
End Sub
'
'Create a button on a form and then copy+paste
'
Private Sub cmdRunApp_Click()
Dim sPath As String
sPath = InputBox("Enter path")
RunApp Me, sPath, 1
End Sub
'
' create a new VB project
' Copy+Paste on a module
'
Private Declare Function ShellExecute _
Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal _
hWnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
'
' Copy+Paste into same module
'
Sub RunApp(frm As Form, strXLS As _
String, intWindowStyle As Integer)
Dim lngSuccess As Long
'launch the default browser
lngSuccess = ShellExecute( _
frm.hWnd, "Open", _
strXLS, 0&, 0&, intWindowStyle)
End Sub
'
'Create a button on a form and then copy+paste
'
Private Sub cmdRunApp_Click()
Dim sPath As String
sPath = InputBox("Enter path")
RunApp Me, sPath, 1
End Sub
ASKER
hi deighton
one more problem with shell. I'm running the shell function for compiling the java file as
shell "c:\jdk1.3.1_04\bin\javac. exe abc.java"
the function is not compiling the java file and not giving any error also. what must be the problem??
Ashish
one more problem with shell. I'm running the shell function for compiling the java file as
shell "c:\jdk1.3.1_04\bin\javac.
the function is not compiling the java file and not giving any error also. what must be the problem??
Ashish
So, if you want to shell a .jar file, try instead this kind of command:
shell "java myProg.jar"
I don't have any longer Sun's Java SDK on my machine, as far as i remember, but this should work.
You can find more options concerning java'c command line arguments into Sun's documentation.
Hope this helps.