locked
Converting Java to VB or C# assistance... RRS feed

  • Question

  • I've tried to use Java to C# or VB converters but they don't work very well as they seem to just assume everythings a unknow Object.

    I need to convert this Java code to either C# or VB (VS 2008 platform using .NET 3.5) in a web applications (ASPX using VB.NET code behind).
    String post = "https://www.somewebsite.com/2?xml=" + URLEncoder.encode(xml);
    URL url = new URL(post);
    HttpURLConnection connection = (HttpURLConnection)url.openConnection();
    connection.setDoOutput(true);
    
    InputStream in = connection.getInputStream();
    BufferedReader inBuf = new BufferedReader(new InputStreamReader(in));
    StringBuffer xmlResponse = new StringBuffer();
    String str = inBuf.readLine();
    while (str != null) {
    xmlResponse.append(str);
    str = inBuf.readLine();
    }
    System.out.println("Response: " + xmlResponse.toString());
    

    Thanks, Rob.
    Wednesday, June 24, 2009 11:14 PM

All replies

  • Try ASP.NET forum may be someone can convert this to vb or C#  for you http://forums.asp.net/.  You can see that this j# forum is dead since microsoft annouced the discontinuation of Visual J# from its Visual Studio Language. Also, you can try this online tool conversion may be it will help http://www.tangiblesoftwaresolutions.com/Product_Details/Java_to_VB_and_CSharp_Converter_Details.html

    kaymaf


    I hope this helps, if that is what you want, just mark it as answer so that we can move on
    Friday, June 26, 2009 2:49 AM
  • Have you tried JUMP to .NET? It was included in VS.net 2005 (not in 2008 though) and would import Java sources (from File/Import menu if I remember well), converting them to C#. Very useful wizard to get you started. Then can use C# to VB.net converters (many such on the internet, best are the ones that use CodeDOM in the background). Not sure if VS.net 2005 express edition had that feature, maybe not

    If you have MSDN subscription, maybe VS.net 2005 is still available for download, else check your CD/DVDs (if they were sending you such)

    could even try getting some copy of it from torrents (not exactly legal, but since it would be to evaluate that technology...), install on a virtual machine (to be safe), convert the sample there and then throw away the VM

    Anyway the tool mentioned below has a demo version allowing to convert samples of up to 100 lines, so it may suite you

    Microsoft MVP J# 2004-2009, Borland Spirit of Delphi 2001
    Saturday, August 8, 2009 3:10 PM
  • Try ASP.NET forum may be someone can convert this to vb or C# for you http://forums.asp.net/. You can see that this j# forum is dead since microsoft annouced the discontinuation of Visual J# from its Visual Studio Language. Also, you can try this online tool conversion may be it will help http://www.tangiblesoftwaresolutions.com/Product_Details/Java_to_VB_and_CSharp_Converter_Details.html

    kaymaf


    I hope this helps, if that is what you want, just mark it as answer so that we can move on

    It helps me out of the problem, Thanks for your instruction!
    Monday, February 14, 2011 12:12 AM