繁体   English   中英

如何在ide之外运行java文件

[英]How to run java file out side of ide

因此,我有这个程序要提供给其他人使用。 问题是此人没有想法,他们也不知道如何使用cmd。 那我该怎么办? 该程序在eclipse中运行良好,但是我知道如何使它在eclipse之外工作。

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 );
}

}

右键单击项目->选择Export然后选择Runnable Jar 只需在以下窗口中提供导出路径即可。

出口可运行罐

快速搜索将使您获得SO结果

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM