Discussion Locked

how to port java program to c language

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi:
I have a very big c language program and now I hope add some java program in this c program .But I don't know how to embody this java program to my c program .whether I need include all java library file to c program .How run this java program.How to compile java program ,I use special compiler to compile my c program .
thanks your help!

5 replies

by jay eckles

There are at least a couple of options. The most straightforward but most time consuming is to translate your Java code to C code. This could be very difficult depending on how reliant you are on the standard java.* packages, which may or may not have equivalents in the standard library or whatever flavor of C you're using. Another option if you're programming on Windows is to make an ActiveX control or DLL out of the Java application using some of the specialized software that's out there -J-Integra is the only one of which I'm personally aware, but there are surely others.

by bayard-generationjava

One answer is to use JNI from your C program to run the Java program. An embedded JVM.

While most JNI sources will focus on calling C from Java, the good ones also show how to call Java from C.

This discussion is closed to new replies.