2012-02-26 29 views
-3

我使用eclipse製作了這個java計算器和一個基於文本的遊戲。我想要做的是有某種.exe或.jar文件或任何當我運行它運行我的Java程序。我希望能夠把它下載,以便其他人可以在沒有日食的情況下播放我的基於文本的遊戲。我問的是我希望我的程序能夠在瀏覽器或其他人的計算機上運行。 我不知道你爲什麼會需要它,但也許它在某處的代碼,我的繼承人計算器代碼如何把我的java程序下載

package calculator; 
import java.util.Scanner; 

public class calculator { 


    public static void main(String args[]){ 
     Scanner test = new Scanner(System.in); 
     System.out.println("enter a number"); 
     int a = test.nextInt(); 
     System.out.println("enter 1 to add 2 to subtract 3 to multiply 4 for divide"); 
     int t = test.nextInt(); 
     if(t == 1){ 
      System.out.println("enter the second number"); 
      int g = test.nextInt(); 
      int u = a + g; 
      System.out.println("The answer is " + u); 
     } 
     if(t == 2){ 
      System.out.println("enter the second number"); 
      int l = test.nextInt(); 
      int m = a - l; 
      System.out.println("The answer is " + m); 
     } 
     if(t == 3){ 
      System.out.println("enter the second number"); 
      int j = test.nextInt(); 
      int v = a * j; 
      System.out.println("The answer is " + v); 
     } 
     if(t == 4){ 
      System.out.println("enter the second number"); 
      int p = test.nextInt(); 
      int z = a/p; 
      System.out.println("The answer is " + z); 
     } 
    } 
} 

回答

0

您需要打包的文件作爲一個可執行的JAR文件。請谷歌。

0

BlueJ的在我的經驗是最好的與此有關。

如果您使用BlueJ,則類會靈活切換,並且添加它們並不是NetBeans對接中的麻煩。我想單擊包含源文件和BlueJ文件的兩個按鈕,以備日後編輯時使用(所有文件保存在一起)。

你有它!

這比較快,NetBeans再次創建JAR文件非常痛苦。

相關問題