×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / Help. .JAR can't run. When I click the file.jar, the harddisk will run for a while. Then, nothing happend. I click the JAVAW.exe in the \JAVA1.2.2\BIN, it's the same. Nothing will happen except the harddisk running.
    It's Win98 and jdk1.2.2_006. Others are all ok. I uninstalled the jdk first then reinstall the jdk for several times, the problem is still there.
    • Java is not VB
      You cannot run a Java programm by clicking....

      If a Jar file contains an entry point main() function, you may run it as

      java -jar abc.jar
    • In addition, "javaw.exe" is roughly speaking equivalent to "start java.exe". See the inside
      javaw.exe is used to run a Java server progress. If you run Java Web Server, you will see javaw.exe in Task Manager|Process.
      You happened to click javaw.exe and I think this is what you meat by "harddisk running".

      If you needs to run RMI service, you can either use javaw.exe or start java.exe.
      Cay Horstmann argued that "start java.exe" is preferrable because one can kill the Java procecs using Control-C conveniently.
      • Dear Jabber, .JAR is "Executable Jar file" in Windows98 which means it can run directly. I checked the "open with" again, it's "Open with Javaw". Maybe something wrong with the connection?
        Dear Jabber, In fact I downloaded a software(Jedit.jar). The helpme.txt taught me to double click the Jedit.jar in Windows and click next, next then ok. I clicked then found nothing happened. I check the property of the file, it's "Executable Jar file" which means it can run directly. I checked the "open with" again, it's "Open with Javaw".

        I transfered from Win98 to Winnt, all are ok! I could click the file name and it really ran and I could click next , next and finished the whole installation. I thought there must be something wrong with my Win98 or Java1.2.2 in Win98. I reinstalled the java but the problem was still there. Maybe .jar is not opened with Javaw.exe?

        The JAVA -JAR doesn't work because we don't know the package and main().

        Thank you. That's a small problem. At most, I use WinNT from now on although a little slower.

        thank you!
        • Something about Jar files
          本文发表在 rolia.net 枫下论坛A Jar file is a compressed Java package. If this package contains a class which has a main() method, you can run it as

          java -jar xxx.jar

          If you want to want run it as a process, enter

          start java -jar xxx.jar

          or javaw xxx.jar

          As a Java programmer, I have not yet got any opportunities to run an application by double clicking. This is why I said Java is not VB.

          Indeed, some Jar files are "excutable" because they have one main() method.
          In such a case, if you it use javaw.exe,
          it will be run as a server process. You have seen it in the Task Manager|Process.

          As a Java programmer, use on-line commands.

          To "open" a jar file, you can first open Winzip.exe and then drop your jar file into Winzip. Jar file is essentially a kind of zip file.

          Another waty to unzip a jar file is enter the commands

          jar -xvf xxx.jar

          Actually, you can reconfigue your Windows explorer so that jar files are open by Winzip.exe instead of javaw.exe, by default.
          I have never tried it.更多精彩文章及讨论,请光临枫下论坛 rolia.net
        • in you file explore /Tools /Foder Options /File Types , edit Executable Jar File
          what action will be do compeletely decided by you, note the parameter , generally ,if no paramter (%1) ,when you double click the file , there is no means let your action connected with the concrete jar instance.
          • Desirable to use on-line command and scripts
            本文发表在 rolia.net 枫下论坛I know many people like drag-and-drop and double-cliking. Of course, I use it too because it is convenient.

            If we want to become a "professional" programmer instead of a Windows user,
            we should use on-line commands and scripts. If we stick to drag-and-drop and double-clicking, we never know what's under the hood.

            Most Java developmen environments have
            Unix server. I have witnessed many programmers get embarrassed before Unix operating system. The reason is that they have been spoiled by the Microsoft Windows.

            One of my colleagues can only write Java code Jbuilder because he was taught how to use JBuilder. As we worked using JDK directly, he had no idea how to write scripts to build our package.

            It seems to me we need to invoke javaw.exe using command-on-line, because it runs a Java server process and we need to input some parameters. Of course, we may write a Windows Script to fulfill this task. So far, I know Java Web Server uses javaw.exe, but this server will be out of the stage soon.更多精彩文章及讨论,请光临枫下论坛 rolia.net