|
If you would read the parameter's name, you would see that it's called fileName, therefore - there is no file name called "java -Xm......". Try
<br />
Process proc = Process.Start("java", "-Xms60m...."); <br />
Also, make you that java exec is in your env path, otherwise supply full path to it.
|
|
|
|
|
Thanks for the answer dude, but it's not working still, i dont get an exception, just a ms-dos window for a second.
Process proc = Process.Start("java",
"java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar");
proc.EnableRaisingEvents = false;
proc.WaitForExit();
Have i write it correctly? I really don't understand why waitForExit is neither working..
|
|
|
|
|
FINALLY IS WORKING!!! Here is the code, thanks for ur time..
string path = "C:\\Programming";
Process process = new Process();
process.EnableRaisingEvents = false;
process.StartInfo.FileName = "java.exe";
process.StartInfo.Arguments = "-jar " + '"' + path+ "\\interface.jar";
process.Start();
|
|
|
|
|
Hi,
Use the following code to run .jar file from c#
private int ExecuteProcess(string cmd, string cmdParams, string workingDirectory, int timeout, out string stdOutput)
{
using (Process process = Process.Start(new ProcessStartInfo(cmd, cmdParams)))
{
process.StartInfo.WorkingDirectory = workingDirectory;
//process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
stdOutput = process.StandardOutput.ReadToEnd();
process.WaitForExit(timeout);
return process.ExitCode;
}
}
string stdOutput;
string parameters = "Prajwal";
int exitCode = ExecuteProcess(@"C:\Program Files\Java\jre1.6.0\bin\Java.exe", " -jar samplejarfilename.jar " + parameters
,path, 5000, out stdOutput );
|
|
|
|
|
Dear All,
I have 2 problems with the software I am devoloping.
1. Through data reader it gets data from As400 and inserts it into a local database. I have label that is supposed to notify regarding the status of the process. But its text does not change at all untill data is inserted into local access file. There are several commands to change the text between.
2. Do you have any idea how to get the completion rate of the inserting process?
Thanks in advance
|
|
|
|
|
Ersan Ercek wrote: There are several commands to change the text between
Are you changing th text using a seperate thread?
Ersan Ercek wrote: Do you have any idea how to get the completion rate of the inserting process?
Well, there is nothing as such which can tell you the exact rate of completion, but you may simulate it taking the average of some attempts.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Are you changing the text using a seperate thread?
I did not understand what you mean excatly but here are sample codes.
con.ConnectionString = "Driver={Client Access ODBC Driver (32-bit)};System=xxxx;Uid=xxxxx;Pwd=xxxxxxx";
try
{
con.Open();
cmd = new OdbcCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
lblStatus.Text = "Starting Select Process";
cmd.CommandText = "Select Article, Store, Month, Year, Day, SUM(UD) AS UNIT, " +
"SUM(Value) AS VALUE from Data" +
" Where Year="+txtYil.Text+" AND Month= "+txtAy.Text+" AND Day BETWEEN "+
txtBaslangic.Text+" AND "+txtBitis.Text+
"GROUP BY Article, Store, Month, Year, Day";
cmd.CommandTimeout = 0;
lblStatus.Text = "Data is being selected";
dr = cmd.ExecuteReader();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
lblStatus.Text = "Data is being inserted to Access";
oleCon = u.oleCon("NXAC"+txtYil.Text+txtAy.Text+".mdb");
oleCon.Open();
while (dr.Read())
{
if (olecmd != null)
{
olecmd.Dispose();
}
olecmd = new OleDbCommand();
olecmd.Connection = oleCon;
olecmd.CommandType = CommandType.Text;
|
|
|
|
|
try calling...
this.Refresh();
after each text update, this is a quick fix.
I would suggest you look into the BackgroundWorker component for a better solution
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I went for Background worker, it is a great solution.
Thanks alot.
|
|
|
|
|
I want to send Email in Arabic ;
I have used genaral SmtpMail class to send email,.. but when i send Arabic text email it shows like '?????????' for the all text;
i did objMsg.BodyFormat = MailFormat.Html; also but no Luck.
There are many ActiveX,.Component available,..
But i want to know in using .Net class same SMTP;
If any body know plz tell me;
Your corperation is appreciated!
B/rgs
Anushka
|
|
|
|
|
try using
mailMessage.BodyEncoding = Encoding.Unicode;
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I've used
theMessage.BodyEncoding = Encoding.UTF8;<br />
Is using Encoding.Unicode better for Arabic than Encoding.UTF8 ?
Regards,
Gary
|
|
|
|
|
Hi
I'm trying to add a web reference to my windows app, but .net is not allowing this, i'm getting the following error Operation is not valid due to the current state of the object., i understand that this has to do with proxy, how do i solve his problem, my browser opens the web service without a problem
thanx in advance
|
|
|
|
|
try this in your application's web config/ app config and add the following under the <configuration> element:
<system.net>
<defaultProxy>
<proxy usesystemdefault="True" proxyaddress=http:
</defaultProxy>
</system.net>
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i tried that it doesn't seem to be working.
|
|
|
|
|
Google and I were not friends today, so I ask you guys here!
This project has GridView control and MenuStrip which is set in grid's ContextMenuStrip to pop up when user is pressing right mouse button over the grid.
When user is pressing right mouse button over GridView the current row is not automatically set to the row "under" mouse pointer.
How is it possible to change current row (focus on) to the row under mouse pointer at that point before toolstrip menu is shown?
|
|
|
|
|
Raybarg wrote: How is it possible to change current row (focus on) to the row under mouse pointer at that point before toolstrip menu is shown?
It may not be. Without looking at the Grid documentation I would guess, like other controls, you can determine the row based on the mouse pointer coordinates.
Keep in mind this is a complete guess on my part and if I am wrong someone else will likely reply to you with the correct solution.
|
|
|
|
|
In the cell mouse down event open your context menu rather than using the built in context menu property.
|
|
|
|
|
The row is selected on the left mouse down.
while in your case, you do a right mouse click to show the menu strip.
You can instead fake this in the OnCellMouseClickEvent
if (e.Button == MouseButtons.Right)
{
if(this.datagridview1.SelectedRows.Count > 0)
this.datagridview1.SelectedRows[0].Selected = false;
this.datagridview1.Rows[e.RowIndex].Selected = true;
}
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Yes, that works with the solution Ennis suggested to pop the menu after doing that.
And here is how I got the menu positioned correctly:
Point pt = MyGrid.PointToClient(Control.MousePosition);
MyMenuStrip.Show(MyGrid, pt.X, pt.Y);
Thank you all for helping in this simple matter.
|
|
|
|
|
Hi again!
Since I had CurrencyManager in BindingContext, your suggested solution resulted in CurrencyManager position not changing when user right-clicked the grid so I had to google again, this time with more words in the issue to succeed.
Here's the solution:
Using DataGridViewCellMouseEventArgs e I can change current row by setting CurrentCell property:
this.datagridview1.CurrentCell = this.datagridview1[e.ColumnIndex, e.RowIndex];
And I repaste the code submitted in other post which pops the context menu also:
Point pt = datagridview1.PointToClient(Control.MousePosition);
menustrip1.Show(datagridview1, pt.X, pt.Y);
Thanks for your help again, the grid is working exactly like I want it to now!
|
|
|
|
|
hi. I coded a multi threaded TCP Server (using .net 2.0)
and also I coded a client side program.Client side programs are executing on Mobile Devices
When the client number is six or seven a serious problem occurs , The problem is even if a mobile device send a message to server properly (Socket.Send is succesful and then start waiting for the response ) but often the response message does not arrive to client side.I think this is so weird
Is there a concurrent use of server side network i/o or something and needed to thread synchronization
to send data to clients or this is all about wireless network performance
|
|
|
|
|
It is likely a design issue. Multithreaded programming is an Advanced concept (to do correctly) and sockets programming is up there as well. (Compared to ASP.NET) If you have a TCP/IP socket you are guaranteed to be able to get data in order or get an exception (or socket closed).
|
|
|
|
|
but I look at a lot of sample code of multi threaded server applications.I can not find major diffirences to cause this kind of problem.Just I can see about that I don't use asynchronous functions for example networkstream.BeginWrite.
is that ok the concurrent (from all running threads) use of networkstream.Write function
may be somehow some Write functions fails according to concurrent use I don't know really.
|
|
|
|
|
All of the sample code on the web for multi-threaded tcp/ip code is derived from the MS sample which is crap.
|
|
|
|