Find the answer to your Linux question:
Results 1 to 10 of 10
Installed jdk-1_5_0_06 from sun website(Not the Netbeans) Install went fine but i'm getting the javac command not found error when I try to complie a .jar file I made. tried ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2005
    Posts
    13

    jacac comand not found.


    Installed jdk-1_5_0_06 from sun website(Not the Netbeans)
    Install went fine but i'm getting the javac command not found error when
    I try to complie a .jar file I made.
    tried as root and normal user, tried after a reboot as well.
    Using Slack 10.2, XFCE 4.2.
    Do I need to set the path???
    If so could some one give me an example?

  2. #2
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Yes, you're probably having a path problem. Did you install it as root or regular user? Did you use an RPM or a shell script? Do you know where the JVM installed itself? What is the exact command you're typing when you try to run your .JAR?
    Registered Linux user #270181
    TechieMoe's Tech Rants

  3. #3
    Just Joined!
    Join Date
    Dec 2005
    Posts
    13
    I installed it using the self extracting file from the sun website.
    I installed as root.
    I have no idea where the jvm is installed, I'm sure there is a way to find out though.
    I just don't know it.

    javac filename .jar

  4. #4
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by sunking
    I installed it using the self extracting file from the sun website.
    I installed as root.
    I have no idea where the jvm is installed, I'm sure there is a way to find out though.
    I just don't know it.

    javac filename .jar
    Type java --version in a console and see if it finds anything. I do not run JAR files using "javac", I run them like this:
    Code:
    java -jar nameOfSomeJarFile.jar
    Registered Linux user #270181
    TechieMoe's Tech Rants

  5. #5
    Just Joined!
    Join Date
    Dec 2005
    Posts
    13
    java -version gives me: java version 1.5.0.04
    Java 2 Runtime Enviroment Standard Edition.
    Dosen't give me the JDK version
    I tried java -jar filenam.jar I get 'unable to acess filename.jar
    But don't you have to compile the jar file first>>jacac filename.jar to make it run???

  6. #6
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Quote Originally Posted by sunking
    java -version gives me: java version 1.5.0.04
    Java 2 Runtime Enviroment Standard Edition.
    Dosen't give me the JDK version
    I tried java -jar filenam.jar I get 'unable to acess filename.jar
    But don't you have to compile the jar file first>>jacac filename.jar to make it run???
    No. Java is an interpreted language rather than a compiled one. JAR files are just a collection of compressed .java source code (like a .ZIP file), which the Java virtual machine interprets into bytecode.

    Try giving java an absolute path to the jar file like this:
    Code:
    java -jar /home/user/javafiles/jarfile.jar
    Registered Linux user #270181
    TechieMoe's Tech Rants

  7. #7
    Just Joined!
    Join Date
    Dec 2005
    Posts
    13
    Yes I 've tried that I get a compile error: 'unable to acces jar file'

  8. #8
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    How did you build this jar file? Did you download it from somewhere? Have you tried unzipping the JAR file into a directory and running the main class directly?
    Registered Linux user #270181
    TechieMoe's Tech Rants

  9. #9
    Just Joined!
    Join Date
    Dec 2005
    Posts
    13
    Damn I'm not on my slack box right now.
    I made the file myself, use jedit i think.
    It's just a simple 'Hello World' type jar file.

    Any way I found a version a of jdk-1_5 on one of the 'slackpkg' mirrors
    downloaded and installed it
    slackpkg install jdk-1_5_0_04
    That seems to fix most things, I no Longer get the 'javac not found' error.
    However javac now gives me the help menu when I try to complie a jar file.

    javac FileName>>>Error 'option File Name not recognized'.
    It seems to think the FileName is an option and not the .jar file.
    So i try javac with the -g option, but still gives the same error.
    Maybe my syntax is wrong:
    javac -g FilName

    After trying this for a while I simply just did java FileName.
    It ran the program and it gave the output I was looking for---go figure?
    I think most of the problmes were from using 'jedit' the Jcompiler plugin
    wasn't loading correctly.

    But javac stil gives the 'option FileName not recognized' error.
    This I still like to find a fix for.

  10. #10
    Linux Guru techieMoe's Avatar
    Join Date
    Aug 2004
    Location
    Texas
    Posts
    9,496
    Jar files are really only useful for larger projects. HellowWorld apps you could quite easily just run straight from the .class files.
    Registered Linux user #270181
    TechieMoe's Tech Rants

Posting Permissions

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