Re: Running .JAR file issue.
You shouldn't be killing the process, just wait for it to terminate normally.
Code java:
p = Runtime.getRuntime().exec("command");
p.waitFor(); // waits until process p terminates
Re: Running .JAR file issue.
But it never terminate, and even if I dont add that in the code, it still dont run
--- Update ---
Still don't run in windows xp
Re: Running .JAR file issue.
So nobody has an Idea, why is this not working on windows xp?
Re: Running .JAR file issue.
I don't have an XP machine to test with, but I did find this post over at stack exchange where they were able to read/write to the Windows registry without having to use JNI, reg processes, etc. It may solve your problem by simply avoiding it to begin with.
Re: Running .JAR file issue.
My problem is not reading or modifying the registry. (Thats what I think)
Because it actually create the registry, that I want and read from it, bot it just don't continue. As you can see in my code the first "while" is not executing which will open a dialog box and ask for some info, but that does not happen in windows xp.
--- Update ---
And I downloaded Eclipse in a windows xp machine to test if it was a 64x 32x problem and copying and pasting the code in the console, does the same thing. Thanks.
Re: Running .JAR file issue.
What I meant was the solution presented in that post doesn't use external processes at all. No need to worry about any processes terminating correctly or having to parse piped output, you just get your results and get on with your program.
Re: Running .JAR file issue.
Okay, thanks.
I'll try that.
--- Update ---
Now, I'm using the code from the link that you posted.
Let's say that you run this code:
Code JAVA:
String value = WinRegistry.readString (
WinRegistry.HKEY_CURRENT_USER, //HKEY
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Korbel\\" + server, //Key
"Certified"); //ValueName
System.out.println("Value = " + value);
In your computer since that string does not exist, the program is going to print this out:
Now, I want to create that string, if is not in your system.
I'm trying to user this:
Code :
if(value.contains("null"))
{
...
}
But it does not do anything, meaning that the null that is printed out at the beginning is not a string, or something else that i yet don't understand.
What could the problem be? And how can I solve this? Thanks.
Re: Running .JAR file issue.
What variable is used to print this:
Value = null
To test that if the variable used to create the above printout is null compare it to null, not the String "null"
If value was null then the following would give a NPE:
Code :
if(value.contains("null"))
Re: Running .JAR file issue.
Re: Running .JAR file issue.
NPE = NullPointerException
Re: Running .JAR file issue.
I solved the problem by doing this:
Code JAVA:
if((value = Error) != null)
{
...
}
Re: Running .JAR file issue.
Why not just test the value of the Error variable directly?
if(Error != null)