Incorporate a C application into a Java application

Hi,there:
Now I have a C application.What i want to do is write a Java 3D application
and using the the output of the C program as the input of the Java program.
Can I use JNI to incorporate the C application into my Java program?
And how to do it?
Thanks
Jian

Have you looked at the JNI examples?
If so, what don't you understand?

Similar Messages

  • How to assign the Thems into Webdynpro Java Application

    HI All,
                   I Downloaded the plugin for them editor and i add those plugins and i created the Them. Please any one can help me how to add that Them into Webdynpro java application.

    Hi ep bhargav,
    You can check this link.....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ccb6bcf4-0401-0010-e3bc-ec0ef03e13d1
    Re: webdynpro theme editor
    Thanks.
    Venkat.

  • How to add images into a java application (not applet)

    Hello,
    I am new in java programming. I would like to know how to add images into a java application (not an applet). If i could get an standard example about how to add a image to a java application, I would apreciated it. Any help will be greatly apreciated.
    Thank you,
    Oscar

    Your' better off looking in the java 2d forum.
    package images;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.FileInputStream;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    /** * LogoImage is a class that is used to load images into the program */
    public class LogoImage extends JPanel {
         private BufferedImage image;
         private int factor = 1; /** Creates a new instance of ImagePanel */
         public LogoImage() {
              this(new Dimension(600, 50));
         public LogoImage(Dimension sz) {
              //setBackground(Color.green);      
              setPreferredSize(sz);
         public void setImage(BufferedImage im) {
              image = im;
              if (im != null) {
                   setPreferredSize(
                        new Dimension(image.getWidth(), image.getHeight()));
              } else {
                   setPreferredSize(new Dimension(200, 200));
         public void setImageSizeFactor(int factor) {
              this.factor = factor;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              //paint background 
              Graphics2D g2D = (Graphics2D) g;
              //Draw image at its natural size first. 
              if (image != null) {
                   g2D.drawImage(image, null, 0, 0);
         public static LogoImage createImage(String filename) { /* Stream the logo gif file into an image object */
              LogoImage logoImage = new LogoImage();
              BufferedImage image;
              try {
                   FileInputStream fileInput =
                        new FileInputStream("images/" + filename);
                   image = ImageIO.read(fileInput);
                   logoImage =
                        new LogoImage(
                             new Dimension(image.getWidth(), image.getHeight()));
                   fileInput.close();
                   logoImage.setImage(image);
              } catch (Exception e) {
                   System.err.println(e);
              return logoImage;
         public static void main(String[] args) {
              JFrame jf = new JFrame("testImage");
              Container cp = jf.getContentPane();
              cp.add(LogoImage.createImage("logo.gif"), BorderLayout.CENTER);
              jf.setVisible(true);
              jf.pack();
    }Now you can use this class anywhere in your pgram to add a JPanel

  • Launching Java Application From A Java Application

    Hello,
    I am building a compiler and would like to have run feature. The problem is I can not seem to figure out the righ syntax to run and application from my java application.
    Here is the code I am using to run an application:
    public void RunClass()
    try
    Runtime rtr=Runtime.getRuntime();
    Process pr = rtr.exec("java " + CurrentDirectory + FileNoExt);
    String line;
    BufferedReader rerr = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    if((line = rerr.readLine()) == null) { CompileMessageArea.setText("Program Running\n"); }
    while ((line = rerr.readLine()) != null) { CompileMessageArea.append(line +"\n"); }
    rerr.close();
    catch(Exception re) { re.printStackTrace(); }
    The following is an example of what the above would send to the:
    java c:\MyJava\Programs\test
    If you try to type something like that in a DOS prompt it will not work. You must first change to that directory, but I am hoping there is an easy way to change the syntax. On the other hand if you want to compile a program you can type:
    javac c:\MyJava\Programs\test.java
    and it will work just fine. This is kind of funny and I use this syntax for my compiler in my program. You would think that the same syntax would work the same for both compiling and running but it does not. So, I know that if I just know what the correct syntax that dos would except for running an application it would work.
    So, if you have the answer for me PLEASE LET ME KNOW.
    It is easily testable by keying it into the dos prompt.
    Sincerely,
    Eric Kohr

    If you want to do it that way you need to use the environment parameter of the exec() method. Use it to set your classpath to the directory that's need for the java application you are about to run... for instance.
    String[] env = new String[] {"CLASSPATH=c:\classes"}
    String command = "java somePackage.someProgram";
    Runtime.getRuntime().exec( env, command);Where your program is in the file "c:\classes\somePackage\someProgram"
    your mileage may vary :)
    You can also reflectively load classes into the running VM and invoke their main methods. This give you the ablility to control them a bit more.

  • Starting and stopping applications via a Java-application on Windows/Unix

    Hello,
    I want to start java and other applications via a java application.
    This java application should start several different applications on windows and
    on unix systems and take care of their current state (e.g. running/not running).
    For all applications to be started there are .sh-scripts for unix and .bat-scripts
    for windows. In the scripts there could be a java call, e.g. "java someApplication",
    or some executables could be called. These scripts set the applications' environment etc.
    and start the application finally.
    My java application calls these scripts via the ProcessBuilder API, which is working fine.
    But there is the following problem: on windows, when executing a script that starts
    some other application, the ProcessBuilder gives me process-handle to the started
    process. If calling destroy() on this handle, only the cmd.exe gets killed which
    started the application. The application itself is running on. This is undesired behaviour
    since I want to be able to control the started applications, at least start and stop it which
    is impossible that way.
    On unix, it is working when using
    "exec java someApplication"
    instead of just
    "java someApplication"
    in the .sh-scripts. The exec command substitutes the shell process with the underlying
    process started in the script, so everything is working as expected on unix.
    But how could I get this working on windows systems? Is there any equivalent to the exec
    command on unix? Any suggestions appreciated.
    If something's unclear in my description, please let me know.

    Yes - after looking at this option - I think that's the direction I am going to go. It probably makes sense to give my JMS topics and my BPEL server their own OC4J instances anyway - for a number of reasons.
    Lon

  • Can I convert a Lookout application into a labview application?

    We here are seriously thinkig to migrate to Labview. There is a complex application done with Lookout 6.0 that we want to convert to a labview application. Having the proper Labview, is there a way of compiling it, open and save, or convert the Lookout application into a Laview application?
    Excuse my ignorance in this matter.
    Best regrads.
    Rudy
    Solved!
    Go to Solution.

    Rudy,
    First of all I hope you first question regarding lookout is solved. If so then mark my answer as solution.
    For the next time, if you have other questions, which are not related to the one you started the thread of, then open a new thread!
    And no, National Instruments don't has drivers for Non-NI Products, so LabVIEW has no driver for your motion card. Anyhow National Instruments has it's own Motion Hardware and Software (ni.com/motion).
    And for LabVIEW and Linux just go to ni.com/linux, and you will find supported hardware/software and the linux derivates it works on.
    Christian
    Message Edited by Christian_M on 11-20-2009 01:28 AM

  • Embed a Flash Application into a Flex Application

    Hello everybody,
    I'd like to know if there is a way to embed a Flash
    Application into a Flex Application. My goal is to wrap Flash apps
    in Flex Modules, and I don't know how to do it.
    I know it is possible to embed swf by using @Embed and an
    mx:Image tag, or to use flash content by creating a flash swc
    component. However these two solutions don't allow to call the
    methods of the Flash app.
    On the other hand, it is possible to load a swf file via the
    Loader Class, and then call the methods via loader.content. But
    with this solution I can't embed the swf in my flex application and
    I have to load it at runtime.
    Any ideas ?

    Look into SWFLoader.
    Be aware though, you can not directly access AS2/FP8/Flash8
    swf's from within an AS2/FP9 app. Local connection is used in this
    case.
    There are dataType and timing issues with SWFLoader. Here is
    a complete example:
    http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=690
    Tracy

  • How to convert an existing db application into a clustered application

    Hi,
    I want to know how can i convert my application into a clustered application.
    my current application there are 5 modules and thses modules have 5-10 tables in common.Since these modules work simultaeously the processing time gets increased drastically.Is it possible that to have seperate instances of these tables and every module works independently and oracle take care of the consistency.
    I want to know if RAC could be the solution?

    user8731258 wrote:
    Hi,
    I want to know how can i convert my application into a clustered application.
    my current application there are 5 modules and thses modules have 5-10 tables in common.Since these modules work simultaeously the processing time gets increased drastically.Is it possible that to have seperate instances of these tables and every module works independently and oracle take care of the consistency.
    I want to know if RAC could be the solution?Sounds like an application design issue. I think you'd be best served tracing the applications and see where the overhead is being introduced when they do their process concurrently.
    Throwing RAC at a poorly developed application would do nothing except amplify the poor design (it'll make things worse).
    Cheers,

  • How to plug a web browser like firefox into a java application

    I am developing a sftware that conect to de internet and get a web page source code.
    Problems i have.
    im using URL clas and the open conect method
    this is the source:
    public String Connect(String pUrl) throws HtmlConnectionException{
            String lTxtHtml = "";
            String lLine = "";
            BufferedReader lInput = null;
            int lTimeout = 15000;
            URL url;
            try {
                if(gProxyIP != ""){              
                    url = new URL("http",gProxyIP,Integer.parseInt(gProxyPort),pUrl);
                }else{
                    url = new URL(pUrl);
                URLConnection urlc = url.openConnection();
                urlc.setDefaultUseCaches(false);
    //            urlcsetReadlTimeout(lTimeout);
                lInput = new BufferedReader(new InputStreamReader(new DataInputStream(url.openStream())));
                while ((lLine = lInput.readLine()) != null) {
                    lTxtHtml += (lLine) + "\n";
                lInput.close();
            } catch (SocketTimeoutException e){
                 gLogger.severe(e.getMessage());
                //e.printStackTrace();
                lTxtHtml = "lTimeout";
                throw new HtmlConnectionException(lTxtHtml);
            } catch (MalformedURLException e) {
                 gLogger.severe(e.getMessage());
                //ex.printStackTrace();
                lTxtHtml = "Bad URL";
                throw new HtmlConnectionException(lTxtHtml);
            } catch (IOException e) {
                 gLogger.severe(e.getMessage());
                //ex.printStackTrace();
                lTxtHtml = "Invalid";
                throw new HtmlConnectionException(lTxtHtml);
            return lTxtHtml;
        }but i dont know how to handle redirection of pages becose some teimes when it redirect me to anoder page an snd me an 30X mensage it crash and throw an IO Exception.
    Probelm 2
    i show the source of the web page but wat i nned is to plug a web wrowser into my application that let me se the web page in one JPanel and its source hig ligted in a JEditPane.
    becose i ned to parse tags to identify string automatically
    or the otehr option is to plug my application into a web wrobser (as a plugin of firefox) an be a ble to run it when i chose it from a contextual menu
    please. can u help me to find the way?

    You can use the Runtime class for this. It can run any command. So, you can run the .exe file of your Web browser.
    The following code will run Internet Explorer (assuming iexplorer.exe is in C:\Program Files\Internet Explorer):
    import java.lang.Runtime;
    public class Explore{
    public static void main(String[] args) {
    try{
    Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore");
    }catch (Exception e) {
    System.out.println("Exception: " + e);

  • Is it possible to Drag and Drop from KDE into a Java application?

    Can someone please let me know if it is possible to drag a file, or any other object from KDE (linux) to a Java application? If so, could you give any code examples that could help supplement an explaination?

    http://java.sun.com/products/jfc/tsc/articles/dragndrop/index.html
    http://java.sun.com/j2se/1.4.2/docs/guide/dragndrop/index.html

  • Opening a java application from a java application

    I am trying to write a simple patching application for a program I am writing. The application must work on both Windows and Mac computers. The program is compiled into a single jar file. To patch the program, I'd like to see if an update is available, download the update if it's available and if the user requests it, and then apply the patch. Since this is a very simple, relatively small program, the "patch" is actually just a newer version of the jar file.
    I've haven't had any problems in detecting or downloading the updated jar file. The problem I'm having is that I can't overwrite the old jar file with the new one while the program is running (of course). Therefore, I wrote a separate patch program that does the actual downloading and replacing work. The order of operations should look like this:
    Open program -> Check for patch -> If user wants to patch then...
    Open patch application -> Close program -> Patch application downloads new jar file and replaces old jar file -> Open original program -> Close patch application.
    However, I can't seem to open the patch application from the original application. I'm using Runtime.getRuntime().exec("java -jar patchApp.jar") but I'm not getting any output whatsoever, neither the program running nor an exception. Can anyone suggest something here? Any help is appreciated.

    However, I can't seem to open the patch application
    from the original application. I'm using
    Runtime.getRuntime().exec("java -jar patchApp.jar")
    but I'm not getting any output whatsoever, neither the
    program running nor an exception. Can anyone suggest
    something here? Any help is appreciated.I've had bad results using the Runtime.exec method. It doesn't seem to be very reliable, at least not in Windows (that's probably not Java's fault.)
    Can you run java by just typing java at the console or do it have to be qualified. Make sure your patchApp.jar argument is in the correct case also.
    I gave up on exec and use JNI to delegate this task to native code. That's going to a little more complicated if you are running in two environemts.

  • Running a java application from a java application

    hello ,
    please who knows how i can run a java application 'B' from inside another java application 'A' and get the error messages (if any) from the application 'B'

    how are you executing application B from application A? Please explain the java code you are using?

  • Using an other web dynpro application into an actual application

    Hello,
    I have a web dynpro application into a developer component previously developed. I want to import it an another web dynpro application.
    The goal is to click a button, display the window of the other application and then once it is finished, go back to the first application (with some context parameters)
    Is it possible ?
    Thanks
    Quentin

    Hi,
    Solved same issue in this thread Re: Data transfer between two different Web Dynpro components
    PradeeP

  • How can I communicate with other applications from my Java application?

    Hello,
    I need help about how can i communicate with other application(say textpad.exe/wordpad.exe/MS word.exe) from my Java program.
    More precisely, I need to know how i can get the current position of the cursor whether it is in any .txt/.doc files, then I may write some text in my java application and click a button and then my program will append the line(string) in that position of the file which is running under another appliction(Notepade.exe/MSword.exe).
    Please provide me some help.

    I may be wrong (and anyone, please correct me if so), but Java may not be the best tool for something such as this. I envision that you'd have to make some OS calls such as calls to the user32.dll, and while this can be done through the JNI, you'd still have to have a C or C++ program doing the dirty work.

  • Merging Two JSF, ADF BC Web Applications into One web application

    What would be the best way to take two JSF, ADF BC web applications written by two developers and merge them into one web application. Any place to start would be greatly appreciated. I'm using Oracle JDeveloper - 11.1.1.4.0
    Edited by: Sunanda on Jul 26, 2011 4:13 AM

    Take a look at this thread:
    Merging Two JSF, ADF BC Web Applications into One...
    Although the thread is old, but it provides about the types of contents you would need to take into consideration while merging.
    With the knowledge from the above thread, you could use refactor option in the JDeveloper menu to move the contents from one project to another.
    Thanks,
    Navaneeth

Maybe you are looking for

  • Need to do a clean sweep and wipe laptop clean

    im definatly no expert but im at the point id just settle to wipe my pc clean and start fresh   how n may i do so>?? hank you so much,,,Cecelia

  • Collect hw counters

    I am running collect on a Niagara system and trying to get harware counter information, but all the counts are assigned to <Unknown>. For example I have run: collect -p on -h +dcm/0,hi program I get the routine timing information but all the d-cache

  • HT1338 How do I download the Epson Perfection 1670 drivers for my Macbook Pro using MAC OS X 10.8.x?

    Hi, Can anyone help me? I need to download the drivers for an Epson Perfection 1670 scanner. I look forward to hearing from you! Thank you.

  • Native TopLink named query with named parameters

    Hello, Defining my metadata in native TopLink xml and using the native TopLink's Session interface I can access and successfully execute a named query using positional parameters (parameters passed to match the ?1 ?2 etc). I used for this the Session

  • DROID 4 to iPhone 4s! Cannot Activate..

    Hey everyone, not too long ago I purchased a Droid 4, had problems with it and ended up buying an iPhone instead from eBay. I was told I could buy a phone from eBay and just activate the iPhone for that line. Well, I purchased the phone, opened it up