Results 1 to 5 of 5
  1. #1
    kd7vea is offline Member
    Join Date
    Apr 2011
    Posts
    9
    Rep Power
    0

    Default #jar is not recognized!!! JAVA_HOME is set. please help.

    Hello everyone. I am not "new" to Java, but it has been at least a year since I have done any type of java programing. I am trying to get everything up and running, so I made a quick Hello World project. The problem I am having is that when I try to run "#jar cvf helloWorld.war ." I get the message that "#jar is not recognized as an internal or external command". I have my JAVA_HOME environment variable set to "C:\Program Files\Java\jdk1.7.0_02\bin". What am I missing, I just cant figure this out, everywhere I look on the internet, the issue is the java_home variable is nor set. mine looks to be set correctly, so I am just not sure where to go from here. any help will be greatly appreciated. Thanks in advance.
    Jake

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: #jar is not recognized!!! JAVA_HOME is set. please help.

    The command to create a jar file is jar, not #jar. Try

    Java Code:
    jar cvf helloWorld.war .

  3. #3
    kd7vea is offline Member
    Join Date
    Apr 2011
    Posts
    9
    Rep Power
    0

    Default Re: #jar is not recognized!!! JAVA_HOME is set. please help.

    Thanks for getting back to me, between that and a few other things I found, it worked. I had my JAVA_HOME variable set, but I had not set the PATH, or CLASSPATH yet. I set both of those, and ran the command without the # and it worked. I would be nice if someone would write up in plain English, beginners terms article on what needs to be set up before getting into Java programming, and how to do it. None of the books I have told how to do any of this, and sadly, none of this was ever mentioned in school. it kind of surprises me that you can get a degree in cs without discussing some of the basics. I just found several sites all over where someone asked the same question as me, and every answer was just set JAVA_HOME variable, when that doesn't work, it kind of leaves you hanging. I spent a few hours bouncing from site to site taking little pieces until I got it working. thanks again.
    jake

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: #jar is not recognized!!! JAVA_HOME is set. please help.

    You're welcome - I'm glad you've got things going as you want.

    I didn't mention any of these environment variables because, in point of fact, none of them are actually necessary for what you were trying to do.

    You see all sorts of stuff on teh internet about to set things up; advice of varying quality.

    My rule (not just with Java, but any software) is distinctly old school: I read the fine documentation that comes with the software/operating system/whatever. And I'm led to reflect on how old this school is rapidly becoming. How many nowadays can remember when a computer came with an OS manual? An honest to goodness printed book! When there was no internet from which the software was downloaded at the click of a link, or by taking a picture of a bunch of little squares? No IDEs to build, package and deploy your software while you watch tutorial videos it delivers from the "community"?

    Anyway, "<whatever> is not recognized as an internal or external command" is number one in Oracle's list of Common problems. (They are talking specifically about javac, and, in this case it was the name of the executable that was wrong.) They link to the distribution documentation which says all that needs be said about setting PATH - including the fact that it's more of a convenience than anything.

    As far as CLASSPATH is concerned, it is usually more convenient to set the classpath when you run one of the executables (java, javac, jar etc) than it is to have a CLASSPATH environment variable. Details (how and what the classpath is) are at the Setting the classpath page which, itself, is linked to from the java, javac and jar reference pages.

    Finally, as far as I know, the J2SE tools don't actually use JAVA_HOME. Sometimes specific software (like Ant) tells you to set JAVA_HOME and the documented instructions in such cases should be followed.

    -----

    I realise that I haven't even attempted the 60 word write up!

    In fact, my advice to someone setting things up would be even briefer: do nothing special. The installer will get the PATH right, and that's more than enough.

    It's only when things go wrong that there are problems ;) And in that case, I recommend the links given above. But I would, given my age....

  5. #5
    kd7vea is offline Member
    Join Date
    Apr 2011
    Posts
    9
    Rep Power
    0

    Default Re: #jar is not recognized!!! JAVA_HOME is set. please help.

    OK, I followed that for the most part, I had to read it twice, but I think I got it. My biggest issue is just like you said, I let everything install like it wants to, I follow along in the books word for word, and then when something goes wrong, the book is no help, and I loose my cool pretty quick. have been messing with this problem for a few days, I gave up after I got to the point that I was seeing red. after a day or two, I thought I would try asking a group that could help. I just hope to one day be able to return the favor to someone seeking advice. thanks again, I am sure we will be chatting again soon.
    Jake

Similar Threads

  1. .Jar Not Recognized
    By Java Tyler in forum New To Java
    Replies: 11
    Last Post: 08-12-2010, 03:36 PM
  2. Javac not recognized
    By OscarLiu in forum New To Java
    Replies: 8
    Last Post: 06-29-2010, 03:10 PM
  3. JAVA_HOME is not defined correctly.
    By mail2vs.dvg1 in forum Advanced Java
    Replies: 2
    Last Post: 06-08-2010, 05:08 PM
  4. Javac is not recognized?
    By Java idiot in forum New To Java
    Replies: 4
    Last Post: 08-03-2009, 06:54 PM
  5. Java_home
    By ravian in forum New To Java
    Replies: 1
    Last Post: 12-27-2007, 10:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •