Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:41:36+00:00 2026-06-04T15:41:36+00:00

I need your help. I have a C executable called generator.out that is a

  • 0

I need your help. I have a C executable called “generator.out” that is a main() function that receives int argc and char * argv[]. The arguments for this main function are a file (let’s call it sample.da) and a target file (let’s call it out.bn). I need to create a java interface that can read those names (sample.da and out.bn) and run my function. The code I have so far is:

package swingapps;

import javax.swing.*;
import java.awt.Dimension;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.lang.*;


public class Swingapps {
private JButton button = new JButton("Generate Bayesian Network");
private JTextField path=new JTextField(40);
private JTextField name=new JTextField(40);
public Swingapps(JPanel jp) {
    jp.add(button);
    jp.add(path);
    jp.add(name);
    button.addActionListener(new Handler());
    path.addActionListener(new Read());
    name.addActionListener(new Call());
}
String text;
private class Read implements ActionListener {
    public void actionPerformed(ActionEvent evt) {
    text = path.getText();
    path.selectAll();
}
}

String namet;
private class Call implements ActionListener {
    public void actionPerformed(ActionEvent evt) {
    namet = name.getText();
    path.selectAll();
}
}
File filep=new File("text"+File.separator+"text");
File filen=new File("namet"+File.separator+"namet");

private class Handler implements ActionListener {
    public void actionPerformed(ActionEvent e) {
        try {
        Process p= Runtime.getRuntime().exec("/home/user/workspace/proj2/./generator.out");
        }
        catch(IOException ioex)
        {
            ioex.printStackTrace();
        }
    }
}

public static void main(String[] args) {
    JFrame frame = new JFrame("Contador               ");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel p = new JPanel();
    frame.setContentPane(p);
    p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
    Swingapps app = new Swingapps(p);
    frame.pack();
    frame.setVisible(true);
    }

}

Please note that I’m a newbie in java so I don’t understand very much of this. I just need a simple interface to run this program!

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:41:38+00:00Added an answer on June 4, 2026 at 3:41 pm

    Take a look at ProcessBuilder class, here’s an example that could fit your situation :

    String command = "generator.out";
    String arg1    = "sample.da";
    String arg2    = "out.bn";
    java.io.File workinDir = new java.io.File("/tmp");
    ProcessBuilder pb = new ProcessBuilder(command, arg1, arg2);
    pb.directory(workinDir);
    Process p = pb.start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need your help with my PHP/MYSQL array. I have a php script that selects
I need your help :/ I have a register that points to one memory
I am a bit confused and need your help. I have a database that
I need your help. I have write my own custom NSOperation class called GetNewsOperation.
I need your help. I have this javascript function to write a message to
I need your help in following case. i have table ChartData in that table
i've no idea how to do that and need your help! i have an
I need your help! I have a tab function by jquery in my site.
I need your help. Say I have a code inside a for statement similar
I need your help. I have a php script to send email to people

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.