• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can anyone convert c# code to java code

 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this is a code in c# i want to convert it to java , specially the part where tag from the reader can be read & then printed to PC


[ EJFH: Added code tags. ]
 
Joe Harry
Ranch Hand
Posts: 10111
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for some online tools that do such jobs or write one in java for yourself!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam, welcome to Java Ranch

I once translated a large Java app to C# and the steps I did was to rename the source files, run then through the compiler, and fix the problems that the compiler found. Some things, such as changing System.out.println to Console.WriteLine were easy to accomplish globally by a decent text editor. In one case (generation of an image in memory) I had to completely rewrite the code.

However, Looking at this code, I don't see anything that would be hard to translate to Java by hand. Or were you hoping for someone to do this for you?
 
sam sawant
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the prob is when i converted this code to java is not working with the hardware,
especiallt the read tag function,
so do help me to convert read tag function in java


while reading from a keyboard we use readline() method, so what will be the inbuilt method to read from a hardware.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the Java code you have so far. Does your code compile? If you run it, is there and exception? Is so, post the full exception stack trace. If there is no exception, please elaborate on what you mean by "not working with the hardware"

so what will be the inbuilt method to read from a hardware


What hardware? In .NET and Java, input is handled via streams. This is true for keyboard, file, socket, etc. Based on your code, looks you are attempting to read from a socket. Maybe this will help: http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html
 
Anand Hariharan
Rancher
Posts: 272
C++ Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:
I once translated a large Java app to C# and the steps I did was to rename the source files, run then through the compiler, and fix the problems that the compiler found. Some things, such as changing System.out.println to Console.WriteLine were easy to accomplish globally by a decent text editor. In one case (generation of an image in memory) I had to completely rewrite the code.

While I've never undertaken anything quite like this in a long time (I had to rewrite several projects written in VB 6 to C++ some years ago), it is nice to learn that C# and Java are so similar that translating takes no more than changing the file name extension, and make the tweaks suggested by the compiler. Cool.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic