can anyone tell me why this c# console command not running on java?..............
i've made a c# console program as given below
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace face
{
class Program
{
public static void Main(string[] args)
{
String path = args[0];
byte[] imageBytes = File.ReadAllBytes(path);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
// Convert byte[] to Image
ms.Write(imageBytes, 0, imageBytes.Length);
Image image = Image.FromStream(ms, true);
Bitmap S1 = new Bitmap(image);
Console.WriteLine(S1.GetPixel(2, 10));
}
}
}
the EXE is attached below...........
through console when i run Program.exe image.jpg I got
Color [A=255, R=128, G=32, B=128]
through JAVA when i tried to run the same console command i'm getting a error message as Program.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
JAVA code is as given below
class project
{
public static void main(String[] args)
{
String comman="C:\\WINXP\\system32\\Program.exe Sunset.jpg";
try
{
Process process = Runtime.getRuntime().exec(comman);
System.out.println(process.getOutputStream());
} catch (Exception e)
{e.printStackTrace(System.err);}
}
}