luseng
asked on
java.net.SocketException: Unrecognized Windows Sockets error: 10106
hi,
i open a socket in my program. when i execute this program from another program (by using Runtime.getRuntime().exec( )), the problem occurs. the program i tried to open a socket gives the following exception :
java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
what can be the reason? if i execute the program by itself, there is no problem..
thanks..
i open a socket in my program. when i execute this program from another program (by using Runtime.getRuntime().exec(
java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
what can be the reason? if i execute the program by itself, there is no problem..
thanks..
Or maybe it's not a Java program?
ASKER
i exec 4 different programs in this program.. all of them includes Threads, System.exit(0), etc.. if i execute them by calling main, it seems to me that there can be some problems..
ASKER
they are java programs..
for example : Runtime.getRuntime().exec( "a.jar")
for example : Runtime.getRuntime().exec(
>>for example : Runtime.getRuntime().exec( "a.jar")
That particular example, if accurate, makes no sense. Can you give the actual commands?
That particular example, if accurate, makes no sense. Can you give the actual commands?
>>makes no sense
I know you can 'execute' a jar by double-clicking it, but that's only on account of Windows shell integration. The command should really be
Runtime.getRuntime().exec( "java -jar a.jar")
(if an executable jar)
I know you can 'execute' a jar by double-clicking it, but that's only on account of Windows shell integration. The command should really be
Runtime.getRuntime().exec(
(if an executable jar)
>>it seems to me that there can be some problems..
What problems? You're going to have a much better chance of remaining problem-free doing things this way than using Runtime.exec
What problems? You're going to have a much better chance of remaining problem-free doing things this way than using Runtime.exec
ASKER
I use the following commands :
String javaexec = System.getProperty("java.h ome") + File.separator +
"bin" + File.separator + "java";
String cmd = "\"" +javaexec + "\" -jar " + "a.jar";
Runtime.getRuntime().exec( cmd , env, file);
String javaexec = System.getProperty("java.h
"bin" + File.separator + "java";
String cmd = "\"" +javaexec + "\" -jar " + "a.jar";
Runtime.getRuntime().exec(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok...
what about using Runtime.getRuntime().exec? what can be the reason of exception? i am wondering that..
thanks..
what about using Runtime.getRuntime().exec?
thanks..
Have you missed my point - i'm saying to *not* use Runtime?
ASKER
sorry, i missed it.
why not?
why not?
Because it's introducing a layer of complexity you don't need, that can lead to problems
ASKER
ok, thanks..
I am not sure, but this might help: http://forum.java.sun.com/thread.jsp?thread=329241&forum=54&message=2459095
ASKER
do i need to call main class of a.jar?
>> do i need to call main class of a.jar?
Yes. If you want to try an interim 'quicker fix' pass all commands to Runtime.exec as a String[], not a String
Yes. If you want to try an interim 'quicker fix' pass all commands to Runtime.exec as a String[], not a String
try running:
cmd /c java -jar a.jar
cmd /c java -jar a.jar
OtherClass.main(stringArra
?