你可以用gcj -C xxx.java命令编译Java源文件到*.class文件,然后用java xxx运行。
然后可以gcc -o test test.java即可以把Java源文件编译成*.exe文件,不过我在FC2里不成功。
具体看:man gcj

解决方案 »

  1.   

    其实,简单的"HelloWorld"是能够成功的,
    只要这样:gcj --main=HelloWorld HelloWorld.java -o hello可是只要用到swt的就会出错。:(  
    (我觉得可能是路径的问题)
    所以我现在想先生成.jar(把用到的东东全收进去),然后再将.jar生成.exe。虽说.jar只是把.class压到一起,可是我还是想试试看。:P
      

  2.   

    试试jet,我不想用他,生成的exe太大
      

  3.   

    看来用gcj的很少,前途堪忧啊
      

  4.   

    gcj的问题是没有方便的方法编译。我费尽千辛万苦最后总算编译成功了exe,但exe却不能运行
      

  5.   

    可以用EXE4J吧,这样简单些,省了好多麻烦
      

  6.   

    detecting or distributing suitable JREs and JDKs, startup error handling and much more. 
    ==========
    exe4j生成的exe好像也要jre
      

  7.   

    如果要jre,还不如用jbuilder生成exe方便呢
      

  8.   

    JSmooth 也要JRE JSmooth aims at enhancing the user experience by taking care of all those issues: the java application is wrapped in an .exe binary. 
    When the user clicks on the .exe, the windows application search the most suitable JVM installed on the computer to launch the java application.