Can C# code and Java code be written in same project. [Resolved]

Posted by Jitendrasoft09 under .NET Framework on 7/7/2016 | Points: 10 | Views : 839 | Status : [Member] [MVP] | Replies : 5
Hi,

I wanted to know whether java code and c# code can be merged together in a project. Whether it will compile.

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Rajnilari2015 on: 7/7/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
@Jitendra Kumar Sir,

Kindly check IKVM.NET ( http://www.ikvm.net / ) which is an open source.

IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework. It includes the following components:

- A Java Virtual Machine implemented in .NET
- A .NET implementation of the Java class libraries
- Tools that enable Java and .NET interoperability

We can first compile the Java bytecode to .NET bytecode to produce a .NET assembly and then use that along with some IKVM DLL's.

Another option will be to create RESTful Web Services in Java ( http://www.tutorialspoint.com/restful/restful_first_application.htm ) and consume it in Dotnet and viceversa.

The second option I used in one of my earlier project.

Another option could be to build the project using Eclipse which supports both .Net and Java projects . Here is the link for building C# code ( http://www.ibm.com/developerworks/library/os-eclipse-migratenetvs/ ) in Ecplise. For Java you can refer ( http://www.dotnetfunda.com/articles/show/3146/a-step-by-step-guide-to-working-with-javajdk-8-in-eclipsemars-in-windo )

Till VS 2005, MS used to support J#. But the language is now dead. For more information this link ( https://social.msdn.microsoft.com/Forums/en-US/3fbac9ac-c43a-4c7f-9fee-1bc1de2c6fc5/why-is-visual-j-is-not-included-in-visual-studio-2010-?forum=visualjsharpgeneral) will help you. Else that would have been of great help.

Hope that helps.

--
Thanks & Regards,
RNA Team

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 7/7/2016 [Member] [MVP] Starter | Points: 25

Up
0
Down
Thanks for the suggesation Rajnilari Ji. It is useful for me. I understand that java code will compile in dot net. But whether dot net will take care of the both of the code (c# and java) in single project. Or I want to say somethng like in one solution file we can add multiple projects. Suppose I have two solution file (c# and java)) inside one base solution file. Can we build the base solution file or can we deploy or compile the project. Could you please elaborate more on this.


Jitendra Kumar
If my post helps you, plz mark as an answer.

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 7/7/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
@Jitendra Kumar Sir,
That is not possible now. Earlier(till VS 2005), there was a support for J#. But MS removed that from the list from VS2008 onwards. What max you can do is to use Eclipse as your IDE instead of VS IDE.

Hope that helps

--
Thanks & Regards,
RNA Team

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amatya on: 7/12/2016 [Member] Silver | Points: 25

Up
0
Down
I think its not possible

Feel free to share informations 9731764134
mail Id ' adityagupta200@gmail.com
Thanks

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhuvanesh6 on: 7/20/2016 [Member] Starter | Points: 25

Up
0
Down
Yes, however you can use the Java code as assembly and which can be used in C-Sharp project as accessing the un-managed code assembly.

Hope this may be helpful.

Bhuvan

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response