I am trying run a command in Java,which runs in console of Linux properly.
But while I am trying to run in Java then it flushes errors.
What might be the possible reasons?
The command follows.. keytool -genkey -keyalg RSA -dname "CN=DEBASISBHATTACHARYYA, OU=MS, O=IIT, C=IN" -validity 24 -alias debasis -keypass password -keystore /DATA/keystore/userkey/E84009.jks -storepass password
And the error ..what i m getting is ... keytool error: java.lang.RuntimeException: Usage error, OU=MS, is not a legal command
Please help me.
it's urgent!
10 4629
How did you handle those double quotes in Java?
kind regards,
Jos
ps. I fixed those bold tags for you; please preview your post before hitting submit.
How did you handle those double quotes in Java?
kind regards,
Jos
ps. I fixed those bold tags for you; please preview your post before hitting submit.
As it supposed to be handled ...
using \" ... :-)
Am i wrong?
One more thing ... it is running properly in windows platform.
please suggest ..it's urgent on tomorrow!
As it supposed to be handled ...
using \" ... :-)
Am i wrong?
please suggest ..it's urgent on tomorrow!
Don't mention that it's urgent; it may be urgent to you but it isn't for me nor anyone
else. Can you show a bit of relevant code?
kind regards,
Jos
Don't mention that it's urgent; it may be urgent to you but it isn't for me nor anyone
else. Can you show a bit of relevant code?
kind regards,
Jos
Yeah sorry!!! -
String command = "keytool -genkey -dname \"CN=" +
-
keyStoreInfo.getCommon_name() + ", OU=" + keyStoreInfo.getOrganizational_unit() +
-
", O=" + keyStoreInfo.getOrganization() + ", C=" + keyStoreInfo.getCountry() + "\"" +
-
" -alias " + keyStoreInfo.getAlias() +
-
" -keypass " + keyStoreInfo.getAlias_password() + " -keystore " + keyStoreFilePath +
-
" -storepass " + keyStoreInfo.getKeyStorePassword() + " -validity " + keyStoreInfo.getValidity() +
-
" -keyalg RSA";
-
-
System.out.println("Command : " + command);
-
isGenerated = runCommand(command);
-
This is the runCommand method.... -
boolean runCommand(String command) {
-
boolean isCompleted = false;
-
-
try {
-
Process p = Runtime.getRuntime().exec(command);
-
p.waitFor();
-
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-
//proc=rt.exec("keytool -list -keystore keystore -storepass storepass");
-
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
-
//proc=rt.exec("keytool -list -keystore keystore -storepass storepass");
-
String s = null;
-
-
while ((s = stdInput.readLine()) != null) {
-
System.out.println(s);
-
}
-
if (stdError == null) {
-
-
} else {
-
while ((s = stdError.readLine()) != null) {
-
System.out.println(s);
-
}
-
-
}
-
isCompleted = true;
-
} catch (InterruptedException ex) {
-
isCompleted = false;
-
Logger.getLogger(KeyStoreGeneration.class.getName()).log(Level.SEVERE, null, ex);
-
} catch (IOException ex) {
-
isCompleted = false;
-
Logger.getLogger(KeyStoreGeneration.class.getName()).log(Level.SEVERE, null, ex);
-
}
-
return isCompleted;
-
}
-
In your runCommand() method, print out that command String and see what it is
actually trying to exec.
kind regards,
Jos
In your runCommand() method, print out that command String and see what it is
actually trying to exec.
kind regards,
Jos
I am simply pass the command parameter.
Is there any chance to loose characters?
Why should i check that out as we copy the printed command -
System.out.println("Command : " + command);
-
and paste the command to console and it runs properly.
What might be the reasons?
I am simply pass the command parameter.
Is there any chance to loose characters?
Why should i check that out as we copy the printed command -
System.out.println("Command : " + command);
-
and paste the command to console and it runs properly.
What might be the reasons?
Just to be sure; what did it print? Was it the correct command string?
kind regards,
Jos
Just to be sure; what did it print? Was it the correct command string?
kind regards,
Jos
Josh I solved that problem.
Actually I read this link ... Runtime.exec() pifalls and came to know the reality.
I used command array instead of using the whole command in a single string.
Thanks for your help Josh.
Josh I solved that problem.
Actually I read this link ... Runtime.exec() pifalls and came to know the reality.
I used command array instead of using the whole command in a single string.
Thanks for your help Josh.
From what I can see from your posts above you were using a single String for
your command, not an array; so what's up?
kind regards,
Jos
From what I can see from your posts above you were using a single String for
your command, not an array; so what's up?
kind regards,
Jos
I posted it in my 3rd post in dis thread.
Anyway now the picture runtime.exec cum to me.
Thanks for kind help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Stefano Bianchi |
last post by:
Ciao,
I need to start a java form compiler from linux.
The script that comes with the program simply says (after some
checks):
java -classpath Packager.jar:Filler.jar -jar EPT.jar
However,...
|
by: Thomas Casanova |
last post by:
Hi,
I am compiling a MSVC++ project on linux gcc 3.3.4.
gcc is whimsical about templates. It does understand the declaration
of the template type PointerList. It scream the error :...
|
by: global |
last post by:
Hi, can anyone help me
I'm on Linux with UDB Runtime-Client 8.1.4 and try to connect to
a windows udb-server 8.1.4 via Websphere and jdbc , and get this
error:
3e1a29e5 WebGroup E...
|
by: Hemant Shah |
last post by:
Folks,
I have DB2 UDB 7.2 EE installed on AIX 5.2 system. I think I am at
latest fixpack, see output of lslpp below. I have also installed DB2
UDB 7.2 EE on RedHat Linux 7.3 I believe that is...
|
by: srihari |
last post by:
Hai,
I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My
machine is Intel XEON 64bit. The installation went well except for the
creation of tools catalog. When I tried to install the tools...
|
by: phil campaigne |
last post by:
Tom Lane wrote:
> phil campaigne <pcampaigne@charter.net> writes:
>
>
>> when I login to linux and check the env's I see:
>>...
|
by: Tomek |
last post by:
Welcome.
I`m trying to prepere some project that shows how to use Corba technology i
heterogenic systems. I`d like to create CORBA server with Borland Delphi (or
C#.NET) and few client...
|
by: crabbie_upk |
last post by:
Hi,
Need help in tuning JAVA on LINUX.
From http://www.trutek.com/index.php?id=173 I understand that on Linux operating system with 4GB memory, JVM can be run with maximum memory of 3800m. But...
|
by: ganeshp |
last post by:
Hi ,
In Java using socket programming is it possible to have a server program on windows that services a client program on linux?
I tried the code in the below given link:...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |