[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

java.net.SocketException: Unrecognized Windows Sockets error: 10106

Posted on 2004-10-28
20
Medium Priority
?
5,354 Views
Last Modified: 2008-01-09
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..
0
Comment
Question by:luseng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
20 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432213
Why use runtime exec btw? Why not

OtherClass.main(stringArray);

?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432230
Or maybe it's not a Java program?
0
 

Author Comment

by:luseng
ID: 12432255
 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..
   
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:luseng
ID: 12432261
they are java programs..

 for example  : Runtime.getRuntime().exec("a.jar")
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432275
>>for example  : Runtime.getRuntime().exec("a.jar")

That particular example, if accurate, makes no sense. Can you give the actual commands?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432285
>>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)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432310
>>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
0
 

Author Comment

by:luseng
ID: 12432468
   I use the following commands :  

    String javaexec = System.getProperty("java.home") + File.separator +
                          "bin" + File.separator + "java";

     String cmd =  "\"" +javaexec + "\" -jar " + "a.jar";
            
    Runtime.getRuntime().exec(cmd , env, file);
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 300 total points
ID: 12432509
Personally i would attack this problem by first lowering the complexity of invoking the programs in the first place, and that means calling their main methods. They'll also start much faster if you do that
0
 

Author Comment

by:luseng
ID: 12432537
 ok...
  what about using Runtime.getRuntime().exec? what can be the reason of exception? i am  wondering that..
  thanks..
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432592
Have you missed my point - i'm saying to *not* use Runtime?
0
 

Author Comment

by:luseng
ID: 12432623
 sorry, i missed it.  
  why not?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12432672
Because it's introducing a layer of complexity you don't need, that can lead to problems
0
 

Author Comment

by:luseng
ID: 12433002
ok, thanks..
0
 
LVL 9

Expert Comment

by:Venci75
ID: 12433028
0
 

Author Comment

by:luseng
ID: 12434267
 do i need to call main class of a.jar?
 
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12436342
>> 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
0
 
LVL 92

Expert Comment

by:objects
ID: 12439325
try running:

cmd /c java -jar a.jar
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question