How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask ATLPROG Your Own Question
ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7260
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now

I need to convert a chunk of code in Visual Basic into Java.

Customer Question

I need to convert a chunk of code in Visual Basic into Java. Can anyone assist?
Submitted: 3 years ago.
Category: Programming
Expert:  LogicPro replied 3 years ago.

Hi,
Welcome here.
Please let me know the details.

Customer: replied 3 years ago.

Hi, below is the chunk of code that I'd like to convert into java if possible?


 


using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.IO;
namespace WebCapture
{
public class SoapRunner
{
string SoapExecutionLine = "";
public SoapRunner()
{
AssemblyResolveHelper.SetupReflectionAssemblyResolve();
}


const string RunLog = @"C:\Backup Exclusions\soap\results\RunLog.txt";
const string XMLListLocation = @"C:\Backup Exclusions\soap\results\XMLList.txt";
public void ExecuteSoapRunner(string sProject, string sTestSuite, string sTestCase, string sResultsFolder, string sProjectVars)
{
string sCommandLine = "/C testrunner.bat -s\"" + sTestSuite + "\" -c\"" + sTestCase + "\" -a -f \"" + sResultsFolder + "\" " + sProjectVars + " \"" + sProject + "\" && EXIT";
SoapExecutionLine = sCommandLine;
// CommandLine = "cmd.exe /C testrunner.bat -s"""&TestSuite&""" -c"""&TestCase&""" -a -f """&ResultsFolderTimeStamped&""" -PEnvironment="&GetEnvironmentPrefix&" """&SOAPproject


ProcessStartInfo psi = new ProcessStartInfo();
psi.Arguments = sCommandLine;
psi.FileName = @"cmd.exe";
psi.WorkingDirectory = @"C:\Backup Exclusions\SoapUI-Pro-4.6.1\bin";
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;

Process p = new Process();
p.StartInfo = psi;
p.Start();
StreamReader s = p.StandardOutput;
string sOutput = s.ReadToEnd();
p.WaitForExit(600000); //10 minute timeout

//System.Windows.Forms.MessageBox.Show(sOutput);
// if (File.Exists(XMLListLocation))
// {
TextWriter tResultLog = new StreamWriter(RunLog, false);
tResultLog.Write(sOutput);
tResultLog.Flush();
tResultLog.Close();
tResultLog = null;
TextWriter t = new StreamWriter(XMLListLocation, true, Encoding.Default);
t.Write("¬" + RunLog.Replace(@"\", "/"));
t.Flush();
t.Close();
t = null;
// }
}


 



}
}

Expert:  LogicPro replied 3 years ago.

My apologies, I am out of ideas and opting out for other Professionals to answer. Please wait. You will be notified by email as soon as any Professional joins you.

Thank you.



Expert:  Brandon M. replied 3 years ago.
Hello, my name is Brandon and I would be happy to help.

Just looking over this code, it looks like it simply launches a program with some arguments and reads in the output of that program to a text file. Does that sound about right?

Brandon
Customer: replied 3 years ago.

hey brandon,


 


yea that's exactly right. any ideas?

Expert:  Brandon M. replied 3 years ago.
Sounds easy enough. Let me see what I can do for you.

Brandon