
正文
javaexe代码案例,Javaex
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
java如何使用代码运行.exe文件
分情况看:
(1)如果你没用非官方集成的开发环境的话,首先在你电脑上装个JDK,然后设置下电脑环境变量,里面有PATH和CLASSPATH这两个参数,具体怎么设置呢?就是把安装目录的地址拷贝到里面就好了,略有不同这两个参数的设置.安装完成后,把源代码文件的目录记下,源代码拷贝到记事本上,把后缀名改成".java";打开CMD窗口,先执行"javac 文件名.java"命令,在目录下会生成一个".class"的文件,那是编译生成的文件,如果顺利通过编译,说明源代码没错误,OK,你再执行"java 文件名.class"就执行程序了.
(2)如果你用的是Eclipse或者Jbuilder这类的集成开发环境的话,那太简单了,导入源代码的文件,点工具栏上的快捷图标,是个平放着的三角形,就可以执行了
总之,你只要把JDK装上,调试成功了,剩余的就小意思,如果实在搞不定,把你代码发过来,我给你生成".jar"文件好了,就像".exe"的可执行文件.呵呵,说了这么多,自己要多摸索下啊,我是学java的,欢迎交流,希望你能顺利解决,编程要自己多摸索
求采纳为满意回答。
相关问答
Q1: 我是一个Java初学者,请问怎样做一个简单的exe格式的程序?
这个你随便到一个源代码网站上面下载一个记事本的东西来就行了。。
其实swing很简单的。。你想成html就行了。。
不过swing界面一直都是一个很麻烦的事情。。如果你用eclipse8。0以上的版本就能实现拖动。。不过eclipse生成的代码很臃肿,至于你要弄成exe的。。那就更简单了。。你在百度上面一搜索java exe工具。。多得是。学习不要以出现什么问题就想要源代码。没事看看说。。想想你想怎么实现。。然后试试。。不行再考虑要源代码。
Q2: 恳求在java中调用exe文件的与源代码
java.lang.Runtime
Process exec(String command)
Executes the specified string command in a separate process.
Process exec(String[] cmdarray)
Executes the specified command and arguments in a separate process.
Process exec(String[] cmdarray, String[] envp)
Executes the specified command and arguments in a separate process with the specified environment.
Process exec(String[] cmdarray, String[] envp, File dir)
Executes the specified command and arguments in a separate process with the specified environment and working directory.
Process exec(String command, String[] envp)
Executes the specified string command in a separate process with the specified environment.
Process exec(String command, String[] envp, File dir)
Executes the specified string command in a separate process with the specified environment and working directory.







