2017-03-05 1 views
1

J'ai créé un fichier JAR exécutable et il s'exécute correctement sur mon PC (Windows 10) sur lequel Eclipse est installé. mais quand je cours ce dossier d'un autre PC avec le même système d'exploitation. ça ne marche pas (ça peut ouvrir le navigateur mais ne pas avoir le site que j'ai mentionné). Aidez-moi, s'il vous plaît.Le fichier JAR exécutable java ne fonctionne pas sur un autre ordinateur

voici mon code:

import java.awt.EventQueue; 
import javax.swing.JFrame; 
import javax.swing.JLabel; 
import static java.util.concurrent.TimeUnit.SECONDS; 
import java.awt.Color; 
import java.awt.Font; 
import javax.swing.JButton; 
import javax.swing.JFileChooser; 
import javax.swing.JTextField; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.firefox.FirefoxDriver; 
import java.awt.event.ActionListener; 
import java.io.File; 
import java.awt.event.ActionEvent; 

public class clAutomationWindow { 

private JFrame frame; 

private String DeriverFilePath; 

private JTextField driverPath; 


/** 
* Launch the application. 
*/ 
public static void main(String[] args) { 
    EventQueue.invokeLater(new Runnable() { 
     public void run() { 
      try { 
       clAutomationWindow window = new clAutomationWindow(); 
       window.frame.setVisible(true); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 
     } 
    }); 
} 

/** 
* Create the application. 
*/ 
public clAutomationWindow() { 
    initialize(); 
} 

/** 
    * Initialize the contents of the frame. 
*/ 
private void initialize() { 
    frame = new JFrame(); 
    frame.getContentPane().setBackground(Color.WHITE); 
    frame.getContentPane().setLayout(null); 

    JLabel lblNewLabel = new JLabel("AICT CL- Renew Post Automation "); 
    lblNewLabel.setForeground(new Color(102, 102, 102)); 
    lblNewLabel.setFont(new Font("Centaur", Font.BOLD, 26)); 
    lblNewLabel.setBounds(24, 11, 378, 43); 
    frame.getContentPane().add(lblNewLabel); 

    JButton btnNewButton = new JButton("Start Renew"); 
    btnNewButton.addActionListener(new ActionListener() { 
     public void actionPerformed(ActionEvent arg0) { 




     System.setProperty("webdriver.firefox.marionette", DeriverFilePath); 
     WebDriver browserDeriver = new FirefoxDriver(); 





      browserDeriver.manage().timeouts().pageLoadTimeout(30, SECONDS); 

      browserDeriver.get("https://www.google.com"); 



     }}); 
    btnNewButton.setForeground(new Color(102, 102, 102)); 
    btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 11)); 
    btnNewButton.setBounds(23, 374, 120, 40); 
    frame.getContentPane().add(btnNewButton); 

    JButton button = new JButton("Show Driver"); 
    button.addActionListener(new ActionListener() { 
     public void actionPerformed(ActionEvent arg0) { 

      JFileChooser Deriverpath = new JFileChooser(); 
      Deriverpath.showOpenDialog(null); 
      File selectFile = Deriverpath.getSelectedFile(); 
      String placeOfFile= selectFile.getAbsolutePath(); 
      DeriverFilePath = placeOfFile.replace("\\","\\\\"); 
      driverPath.setText(placeOfFile); 
     } 
    }); 
    button.setForeground(new Color(102, 102, 102)); 
    button.setFont(new Font("Tahoma", Font.BOLD, 11)); 
    button.setBounds(24, 182, 120, 40); 
    frame.getContentPane().add(button); 

    driverPath = new JTextField(); 
    driverPath.setColumns(10); 
    driverPath.setBounds(154, 187, 248, 30); 
    frame.getContentPane().add(driverPath); 
    frame.setBounds(100, 100, 450, 550); 
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
} 

}

+0

Avez-vous un message d'exception/d'erreur? –

+0

J'utilise le fichier jar exécutable à un autre pc. donc je n'ai pas eu de message d'erreur. est-il possible d'obtenir un message d'erreur à partir du fichier jar exécutable? –

Répondre

0

je résoudre ce problème. selenium.firefox.FirefoxDriver ne fonctionne pas avec la nouvelle version de FireFox. 44.0.2 fonctionne bien. J'espère que bientôt ce problème sera résolu

+0

Votre déclaration est fausse et le problème se trouve devant le PC. FirefoxDriver fonctionne avec les versions FF actuelles, il vous suffit de mettre à jour la version du pilote. ;-) – kriegaex

+0

Mais j'utilise geckodriver-v0.14.0-win64 et selenium-java-3.0.1 (1). qui sont les derniers. : -o –

+0

Alors comment expliquez-vous que je peux travailler avec la même version du pilote 0.14.0-win64 et FF 51.0.1 (32 bits)? Peut-être que vous devriez être plus précis que "ne fonctionne pas avec les versions actuelles de FF". Qu'est-ce qui ne fonctionne pas exactement? – kriegaex