如果是用C,VB,C++等做成的应用程序,可以做成exe文件,双击就可以运行。但是用Java做成的就比较麻烦。Class和打包成Jar都得用命令来运行,而且需要安装Java环境。

不知道有方法可以做的像exe那样方便的没有?

Jar文件的执行,Java环境配好有时候双击就能执行,有时候却不行,我至今想不明白是什么问题。写个批处理倒是都可以执行。经常遇到的问题是自己做个程序发给朋友运行时,发现朋友根本没Java环境或者根本就不知Java环境为何物。也不会配置环境变量。一步一步去教的话,又会觉的繁琐。一直想如果不用配置path怎么运行Java程序呢。那天不停的试,终于试出来了。

比如想运行x.jar文件,写个start.bat,在普通运行jar文件的命令上写个path指定。例如:

      path=“jdk1.5.0_08\jre\bin”

      java -jar x.jar

这样的话,就可以在没有安装java环境的机器或者是没有配置环境变量path的电脑上运行java程序了。当然自己的程序文件夹中要包含一个jre,“path=”句改成发的文件夹中jre的相对路径。这是我能想到的唯一办法,不知道还有其他的方法在没有Java环境的机器上运行Java程序没有?可以用工具把jar文件变成exe来双击运行,不过Java环境还是需要配置的。而且我试了变成exe后启动会更慢,文件变大了好多倍,不知是什么原因。

评论
jamesji 2008-05-02
What you are looking for is a technology named "Java Web Start". The url is http://java.sun.com/products/javawebstart/overview.html.

Using Java Web Start technology, standalone Java software applications can be deployed with a single click over the network. Java Web Start ensures the most current version of the application will be deployed, as well as the correct version of the Java Runtime Environment (JRE).

A main feature of the Java Network Launching Protocol and API technology is the ability to automatically download and install Java Runtime Environments onto the users machine.
jasongreen 2008-05-02
放弃java吧,它将寿终了。个人观点,D语言将成为最好的桌面语言。python、ruby将成为更好的web开发语言。server端的其他服务,C、D、python、ruby 都可以有所表现。

I hate java because of it's too fat...
发表评论

您还没有登录,请登录后发表评论

zwm512327
搜索本博客
最新评论