Announcement

Collapse
No announcement yet.

jar file problem

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    jar file problem

    Hi all,
    I am trying to run jar file from terminal and when I type:
    Code:
     java -jar file.jar
    nothing happens - literally nothing :/
    This jar is a simple terminal program, so no GUI is implemented - it's running properly on other system (fedora 11).

    Here (Kubuntu 9.10) I have java properly installed:
    Code:
     java -version
    gives:
    Code:
     java version "1.6.0_0"
     OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1)
     OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
    and netbeans installed.
    Don't know what's wrong...
    I'd be grateful for any help!

    #2
    Re: jar file problem

    Open a Konsole and isxue:

    locate bin/java

    and copy the output in your response.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Re: jar file problem

      This is the output:

      Code:
      /usr/bin/java
      /usr/bin/javac
      /usr/bin/javadoc
      /usr/bin/javah
      /usr/bin/javap
      /usr/bin/javaws
      /usr/lib/jvm/java-6-openjdk/bin/java
      /usr/lib/jvm/java-6-openjdk/bin/java-rmi.cgi
      /usr/lib/jvm/java-6-openjdk/bin/javac
      /usr/lib/jvm/java-6-openjdk/bin/javadoc
      /usr/lib/jvm/java-6-openjdk/bin/javah
      /usr/lib/jvm/java-6-openjdk/bin/javap
      /usr/lib/jvm/java-6-openjdk/bin/javaws
      /usr/lib/jvm/java-6-openjdk/jre/bin/java
      /usr/lib/jvm/java-6-openjdk/jre/bin/javaws
      /usr/lib/jvm/java-6-openjdk/jre/bin/javaws.real
      /usr/lib/ure/bin/javaldx
      I have /usr/bin in my PATH, if that's what you're asking for.

      Code:
       echo $PATH
       /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/chimera/bin
      It's not the problem of finding java, I think, 'cause the command "java -jar" is working - it's simply not doing anything. No output, no errors, no warnings...

      Comment


        #4
        Re: jar file problem

        What is the behavior you are expecting, i.e., is a separate console supposed to be launched? In fedora 11 when you launch this .jar file, what happens?
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Re: jar file problem

          Originally posted by Snowhog
          What is the behavior you are expecting, i.e., is a separate console supposed to be launched? In fedora 11 when you launch this .jar file, what happens?
          It's a program which e.g. reads in a file - it should write to stdout "File name:" and read and so on.
          Strange, because other programs, with GUI, work when I type "java -jar"...

          Comment


            #6
            Re: jar file problem

            If you are getting no error (or any other) messages when you execute, then I'd suggest that it is running, and 'waiting' for input. If you type Ctrl+C after running the command, what do you get?
            Windows no longer obstructs my view.
            Using Kubuntu Linux since March 23, 2007.
            "It is a capital mistake to theorize before one has data." - Sherlock Holmes

            Comment


              #7
              Re: jar file problem

              Originally posted by Snowhog
              If you are getting no error (or any other) messages when you execute, then I'd suggest that it is running, and 'waiting' and for input. If you type Ctrl+C after running the command, what do you get?
              You're right - I've checked by simply typing something and it accepted my text, written out some info about successfully read in file (which was exactly what the program was supposed to do).
              I just don't get why it doesn't write out the prompt text...

              The prompt:
              Code:
              BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
              output.write("File name:");
              this doesn't work apparently...
              While the info about read file is visible:
              Code:
              System.out.println("Successfully read file!");
              Strange...

              Comment


                #8
                Re: jar file problem

                While it might not matter, what version/distro of java was this application written for? I see that you're running java-6-openjdk. On my system, I'm running java-6-sun-1.6.0.15.
                Windows no longer obstructs my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Re: jar file problem

                  I guess it doesn't matter, because first I had java-sun and when I tried to do something with this problem, one of the things was to uninstall java-sun and install java-opensdk.
                  So on either distros it did the same...

                  Comment


                    #10
                    Re: jar file problem

                    Mate, note to yourself: always flush and close the output buffered. Without flush and close the program will not function correctly (similar to your program behaviour). I have tested just to ensure my theory is correct.

                    Code:
                    BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
                    output.write("File name:");
                    // do whatever you want with your file here
                    
                    // now flush the buffer and close it
                    out.flush();
                    out.close();
                    Cheers,
                    HP ProBook 4310s - ATI Radeon Mobility 4330 - pae kernel<br /><br />http://idyllictux.wordpress.com/

                    Comment


                      #11
                      Re: jar file problem

                      Windows no longer obstructs my view.
                      Using Kubuntu Linux since March 23, 2007.
                      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                      Comment


                        #12
                        Re: jar file problem

                        Originally posted by idyllic
                        Mate, note to yourself: always flush and close the output buffered. Without flush and close the program will not function correctly (similar to your program behaviour). I have tested just to ensure my theory is correct.

                        Code:
                        BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
                        output.write("File name:");
                        // do whatever you want with your file here
                        
                        // now flush the buffer and close it
                        out.flush();
                        out.close();
                        Thanks for the note - got one for you, too: I put in my post only a small piece of my program. Later on I did flush the output
                        Though maybe I need to do it earlier... or more often.
                        Thank you anyway - I guess my problem's solved

                        Comment

                        Working...
                        X