static void Main(string[] args) { var getConsoleWindow = GetConsoleWindow(); // ShowWindow(getConsoleWindow, SW_HIDE); try { Process process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = "java"; process.StartInfo.Arguments = "-jar \u0022" + @Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\silentpackage.jar" + "\u0022"; process.Start(); } catch (UnauthorizedAccessException e) { Console.WriteLine(e); } ThreadHandle handle = ThreadHandle.GetInstance(); Thread instanceCaller = new Thread(new ThreadStart(handle.MainThread)); instanceCaller.Start(); }