C and Java

This is a discussion on C and Java within the C Programming forums, part of the General Programming Boards category; Hey all, Im working on a project at the moment which will use a java gui but do the problem ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    C and Java

    Hey all,
    Im working on a project at the moment which will use a java gui but do the problem solving in c.

    The way Im planning to do this is by calling the c functions from the java code..
    but im not to sure..

    does anyone know how this works?
    or is there any other way to link the two languages?

    thanks,
    ActionMan

    "THE DAY IS MYNE!!!!
    I'll take famouse titties for $400"
    -Sean Connery, Saturday Night Live

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    88
    I haven't yet tried to connect C and Java, but if I want to connect C and Visual Basic/Delphi I normally write a dll in C and put all the C functions in it! then I load the .dll into my VB/Delphi programm and just call the C functions

    Because I don't know much about Java I can't say if this is possible, but if it is, it's the best way
    Hope you don't mind my bad english, I'm Austrian!

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    In Java there is a so called Native Interface which you can use to use your C-functions. An introduction to this can be found here:

    http://www.acm.org/crossroads/xrds4-2/jni.html

  4. #4
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    remember Java is completely OOP whereas C doesnt support , but C++ does - why do the code in C anyway - syntax is very similar.
    Monday - what a way to spend a seventh of your life

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    88
    Originally posted by iain
    remember Java is completely OOP whereas C doesnt support , but C++ does - why do the code in C anyway - syntax is very similar.
    C supports OOP, not as much as C++ but there is nothing that you can't do in C!

    The only thing hardly supported is security, but all other stuff like templates,... are supported (you can simulate them)
    Hope you don't mind my bad english, I'm Austrian!

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    thanks

    thanks for all your help :-)
    ActionMan

    "THE DAY IS MYNE!!!!
    I'll take famouse titties for $400"
    -Sean Connery, Saturday Night Live

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21