2015-11-18 10 views
0

所以我有這個程序,我想給其他人使用。問題是這個人沒有ide,也不知道如何使用cmd。那麼我該怎麼做?該程序在eclipse中運行良好,但我知道如何讓它在eclipse外工作。如何在IDE的外側運行java文件

import javax.swing.JOptionPane; 

public class Encrypter { 
    public static void main(String []args){ 
    //varibles 
     String input; 
     String inputtwo; 
     String inputthree; 
     String inputfour; 
     int x; 
     int y; 
     int z; 
     int n; 
     int xtwo; 
     int ytwo; 
     int ztwo; 
     int ntwo; 

    //takes input 
    input = 
      JOptionPane.showInputDialog("What is your first number?"); 
    inputtwo = 
      JOptionPane.showInputDialog("What is your second number?"); 
    inputthree = 
      JOptionPane.showInputDialog("What is your third number?"); 
    inputfour = 
      JOptionPane.showInputDialog("What is your fourth number?"); 
    // changes the to ints 
    x=Integer.parseInt(input); 
    y=Integer.parseInt(inputtwo); 
    z=Integer.parseInt(inputthree); 
    n=Integer.parseInt(inputfour); 

    //maths and stuff 
    xtwo= (x +7)%10; 
    ytwo= (y +7)%10; 
    ztwo= (z +7)%10; 
    ntwo= (n +7)%10; 


    //shows it 
      JOptionPane.showMessageDialog(null, xtwo + "" + ytwo + "" + ztwo + "" + ntwo); 
    System.exit(0); 
} 

}

+5

當你試圖谷歌這個問題發生了什麼? – Kon

+2

提示:嘗試右鍵單擊您的eclipse項目 - >導出 - > java - > runnable jar – Hulk

+0

您可以執行http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program例如對於一個exe文件。 – zapl

回答

0

右鍵單擊項目 - >選擇Export然後Runnable Jar。只需在下面的窗口中輸出路徑即可。

Export Runnable Jar

快速搜索會得到你的results from SO