September 07, 2010, 04:18:10 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Call C# method within a Java program  (Read 827 times)
0 Members and 1 Guest are viewing this topic.
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« on: June 14, 2009, 11:22:37 AM »

So i was curious how to call c# methods using Java and found this article: http://www.codeproject.co...-platform/javacsharp.aspx

Let's say this is your c# application:
Code
GeSHi (csharp):
  1. using System;
  2.  
  3. public class CSharpHelloWorld
  4. {
  5.    public CSharpHelloWorld() {}
  6.  
  7.    /// <summary>
  8.  
  9.    /// displayHelloWorld will be the method called from within java.
  10.  
  11.    /// </summary>
  12.  
  13.    public void displayHelloWorld()
  14.    {
  15.        Console.WriteLine("Hello World, from C#!");
  16.    }
  17. }
Created by GeSHI 1.0.7.20

Then this would be how to load and call the c# method:
Code
GeSHi (java):
  1. public class HelloWorld {
  2.    public native void displayHelloWorld();
  3.    static {
  4.        System.loadLibrary("HelloWorld");
  5.    }
  6.  
  7.    public static void main (String[] args) {
  8.        new HelloWorld().displayHelloWorld();
  9.    }
  10. }
Created by GeSHI 1.0.7.20
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net :: a community about Java software development.
« on: June 14, 2009, 11:22:37 AM »

 Logged
Koâk
Member
*

Reputation: 0
Offline Offline
Posts: 13
Referrals: 0

Awards
« Reply #1 on: June 23, 2009, 06:21:17 AM »

woo nice Suprised

is it also possible to load java things in C#?
if so you could make apps for the Nintendo DS in Java?
just load the java in C# then Suprised
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #2 on: June 23, 2009, 06:34:28 AM »

woo nice Suprised

is it also possible to load java things in C#?
if so you could make apps for the Nintendo DS in Java?
just load the java in C# then Suprised

I'm not sure if Java can be loaded into .NET but you can load .NET DLL components into Java.
The nintendo DS uses c++ as the language to develop NDS software.

Quoted from wikipedia

Quote
Programming

Homebrew DS applications are generally programmed using C/C++. A popular toolchain is devkitARM. A few libraries that make programming easier include libnds, libfat, dswifi and PAlib. libfat helps developers write to a FAT file system on the homebrew storage device while dswifi allows developers use WiFi on the DS. Several tutorials have been written about the various aspects of the system. fpc4nds is a port of FreePascal for cross compile for DS.

Popular development packages:

    * devkitPro offers devkitARM, libnds, dswifi, libfat and maxmod.

Tools and libraries:

    * PAlib, "Programmers Arsenal". As of April 8 2009 PAlib 090408 supports r25 of devkitArm and 1.3.2 of libnds. Previously the toolchain maintainers strongly recommended avoiding PAlib because it did not work with the latest versions of devkitARM and libnds.
    * DS Game Maker, a shareware frontend for PAlib that appeals to users new to the homebrew scene.
    * Maxmod, an addon library which supports playback of MOD, S3M, XM, and IT modules.
    * libfat, library for using the Filesystem (successor of GBA NDS FAT)
    * libellen, a library addon for libnds which allows easy development of basic concepts such as sprites and backgrounds[4]
    * GBA NDS FAT, outdated Library for using the Filesystem

Other tools and libraries:

    * MicroLua, a new library which uses Lua scripts. Scripts can be written and compiled on the DS itself, for handy development.
    * DSLua, an old outdated Nintendo DS library using Lua (.lua) programmed scripts.
    * Python, a converted Stackless Python port, which runs Python (.py) scripts. A updated version of this available at DSPython.
« Last Edit: June 23, 2009, 06:36:01 AM by HappyFace » Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Koâk
Member
*

Reputation: 0
Offline Offline
Posts: 13
Referrals: 0

Awards
« Reply #3 on: June 23, 2009, 06:40:03 AM »

I'm not sure if Java can be loaded into .NET but you can load .NET DLL components into Java.
The nintendo DS uses c++ as the language to develop NDS software.

Quoted from wikipedia


Allright, thanks!
Logged
Javaforums.net :: a community about Java software development.
   

 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.229 seconds with 35 queries.

Google visited last this page Yesterday at 08:39:03 PM