今天测试了一个程序的运行:导出test.jar可执行文件,在本机上test.jar程序能够正常运行。
将test.jar考到另外一台电脑上,并在该电脑上安装了jre,运行test.jar,出现couldn't find the main class,程序退出。请问这是什么原因?

解决方案 »

  1.   

    考虑另一台机子配置是否正确。class path有无位置 .(当前路径)
      

  2.   

    只是运行test.jar需要配置class path吗?
    一个可执行的test.jar文件需要什么样的环境,应该装上虚拟机jre就行了吧?
    望前辈指教!
      

  3.   

    我用exe4j打包,在本机上没问题,但在其它机子上运行出现java.lang.NullPointerException
    at zhao.WebCamSwing.<init>(WebCamSwing.java:81)
    at zhao.start.main(start.java:10)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
    at com.exe4j.runtime.WinLauncher.main(Unknown Source)
    这是什么原因,我用了其它库,也都加进去了