• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error FRM-40039: can not attach the test file  RSS feed

 
karterdesc sunday
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form with a button that launches different programs out of form
programs names read them with a connection to a database in a table
with the help of a combobox I choose the program and launch it by pressing the button

public class Frame1 extends javax.swing.JFrame {
static final DBConnection conn= new DBConnection();
private Hashtable appNames;
private Hashtable appPaths;
   
public Frame1() throws SQLException {
        initComponents();
    
         jComboBox1.removeAllItems();
         ArrayList<String>  names = conn.getListApps();
         for (String name: names)
         { jComboBox1.addItem(name);
         }
        appNames= conn.getAppNames();
        appPaths= conn.getAppPaths();
    }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
       String name= (String)jComboBox1.getSelectedItem() ;
       String id = (String)appNames.get(name);
       String cale = (String)appPaths.get(name);
      
       if ( cale.contains("http://") ){
          URL url=null;
           try { url = new URL(cale);
           } catch (MalformedURLException ex) {
               Logger.getLogger(Frame1.class.getName()).log(Level.SEVERE, null, ex);
           }
        
      openWebpage(url) ; 
        }else if( cale.contains("exe") || cale.contains("fmx") ){
            String[] parts ;
            parts = cale.split("/");
            System.out.println(" parts: " + parts);
            String dir ="";
             for(int i =0; i < parts.length-1; i++)
                 dir += parts[i]+"\\";
            System.out.println(" dir: " + dir);
           try {
               Runtime.getRuntime().exec(cale, null, new File(dir));
           } catch (IOException ex) {
               Logger.getLogger(Frame.class.getName()).log(Level.SEVERE, null, ex);
           }
       }
       else{
           try {
               Desktop.getDesktop().open(new File(cale));
           } catch (IOException ex) {
               Logger.getLogger(Frame1.class.getName()).log(Level.SEVERE, null, ex);
           }
       }
    }                                       

public static void openWebpage(URI uri) {
        Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
        if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
            try {
                desktop.browse(uri);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

public static void openWebpage(URL url) {
        try {
            openWebpage(url.toURI());
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }

public static void main(String args[]) {
       java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new Frame1().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(Frame1.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

the problem is that one of the programs is an oracle8 (TEST.fmx), the release of which gets the message "FRM-40039: can not attach the test file while opening TEST" ( there is also a test.plx library in the test.fmx folder ),other fmxs that do not have libraries are launching smoothly).
I would also like to launch TEST.fmx with credential arguments (username, password)
How can I Should first launch F50RUN32.exe and then TEST.fmx?
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I moved your post because it didn't seem relevant to its original location. Please explain where those programs are and how you are adding them to your CLASSPATH, or are they databases?
You have some very old‑fashioned code, using Hashtable, which has been regarded as legacy code for nearly twenty years. Why is the database connection marked static?
Is that message from an exception? What sort of exception? What is FRM‑40039? Are there any more details about 40039 in the database handbook?
 
karterdesc sunday
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch

I moved your post because it didn't seem relevant to its original location. Please explain where those programs are and how you are adding them to your CLASSPATH, or are they databases?
You have some very old‑fashioned code, using Hashtable, which has been regarded as legacy code for nearly twenty years. Why is the database connection marked static?
Is that message from an exception? What sort of exception? What is FRM‑40039? Are there any more details about 40039 in the database handbook?



I want to run an oracle (fmx) program by pressing a button from a netbeans form
the error message is an oracle  forms message due to the fact that the oracle program is being launched but not attach too the test.plx library
how can this be done?

thanks
 
Dave Tolls
Ranch Foreman
Posts: 3061
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the command line, can you show us what steps you would need to do to execute this Oracle form?
 
karterdesc sunday
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:From the command line, can you show us what steps you would need to do to execute this Oracle form?



the contents of a batch file look like this:

D:
cd D:\TEST\
D:\orant\bin\F50RUN32.EXE D:\TEST\test.fmx username/password@string

where "username/password@string" are login credentials to the database for test.fmx

with the following script we go to launch the program but do not read the credentials:
private void sacfActionPerformed(java.awt.event.ActionEvent evt) {
String command = new String;
command="D: &&  cd D:\\TEST\\  &&  D:\\TEST\\test.fmx && username/password@string";
try {
    Runtime rt = Runtime.getRuntime();
    Process process =rt.exec(command);
BufferedReader input = new BufferedReader(new InputStreamReader(
        process.getInputStream()));
String line = null;
while (( line = input.readLine()) !=null) {
    System.out.println("Command output:"+line);
}} catch (IOException e){
    e.printStackTrace();
}

how can I submit the program credentials?

thanks


 
Dave Tolls
Ranch Foreman
Posts: 3061
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I expect you'll need to interact with the Process to pass it the values?
Actually, does this launch an Oracle Form app?  In which case you won't be able to do that.
Why don't you just run the BAT file?

I will suggest (if you haven't already) that you read this old article on Runtime.exec(), as it covers a lot of the things that can go wrong with it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!