Results 1 to 11 of 11
  1. #1
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    Question Java From Terminal
    I have a Powerbook G4 1.3 GHz (OS X)

    I have been programming in C and C++ for a while now for school related projects using Xcode and the terminal to compile. I recently recieved a project that requires the use of java. So I downloaded the newest version of Eclipse. I tried to use the application after copying it to my HD and it wouldn't open, yielding some odd java error. I then figured it was my version of java, so i downloaded the newest version of java from the apple webpage, and it said that my version of java did not need to be updated. So i went to the terminal and coded out a small java program that makes random numbers and prints to the screen. I then typed as series of commands as shown below. Each time a new empty command prompt was displayed with no error message.

    jamesgaines$ java -version
    jamesgaines$

    'the directory has my Random_1.java file'
    jamesgaines$ javac *.java
    jamesgaines$

    'Graph is a class file'
    jamesgaines$ java Graph
    jamesgaines$

    None of these used any processes or yielded any output.

    Does anyone know what this means or how i can fix it?

    I also did a 'where' on java and found that i have all the java files needed to run java, but it would have updated during the update if i had needed anything extra hopefully. Applications that run on java do not work either. Thanks in advance.

  2. #2
    meltbanana314
    Guest
    XCode is an IDE for Java as well, not just C/C++/Obj-C. Installing Eclipse is kind of redundant.

  3. #3
    Kokopelli
    Guest
    Quote Originally Posted by meltbanana314
    Installing Eclipse is kind of redundant.
    Not really. It is an alternative that some prefer. I am not too fond of the java support in XCode. I like Mac UI design in XCode (EDIT: I guess technically that is Interface Builder) but for core work or platfom independent code in Java, Eclipse is better suited.

    If "java -version" does not return output something is wrong. You might confirm the java framework is installed. "which java" reports a location of /usr/bin/java, which is a link to /System/Library/Frameworks/JavaVM.framework/commands/java you could try navigating there and calling the java command directly and see if it works, might be a bad link from /usr/bin. If all else fails you might try reinstalling java.

  4. #4
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    Quote Originally Posted by Kokopelli
    Not really. It is an alternative that some prefer. I am not too fond of the java support in XCode. I like Mac UI design in XCode (EDIT: I guess technically that is Interface Builder) but for core work or platfom independent code in Java, Eclipse is better suited.

    If "java -version" does not return output something is wrong. You might confirm the java framework is installed. "which java" reports a location of /usr/bin/java, which is a link to /System/Library/Frameworks/JavaVM.framework/commands/java you could try navigating there and calling the java command directly and see if it works, might be a bad link from /usr/bin. If all else fails you might try reinstalling java.
    Actually i did do a which java, thats what i meant by where, i just mis-typed it. And i executed the command there and it did the same thing. I would personally rather use VI from terminal if you want the truth i was just told that eclipse is really nice.

  5. #5
    Kokopelli
    Guest
    Try reinstalling java then. Or as much as I hate the panacea, you might try repairing permissions.

    I used to live and die by emacs. I tend to use eclipse now for Java and switch between Code Warrior, emacs, and recently XCode for everything else. Eclipse is nice but not a magic bullet. If you don't want to use it don't.

    EDIT: You did a "which" to bring you to /usr/bin but did you follow the sim links to the actual location? I am wondering if the links are busted.

  6. #6
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    "repairing permissions" - can you explain this a little better please?

    Man, I feel like such a newbie right now. I have used Linux for 1 year and now the darwin/unix interface for 6 months and i can't figure this out. I have never had a real java failure/error/breakdown like this.

    So basically i navigated to
    :/System/Library/Frameworks/JavaVM.framework/commands jamesgaines$
    java is located here. i did an 'ls' command this is what is in the dir.

    appletviewer java javap policytool servertool extcheck java-rmi.cgi jdb rmic tnameserv idlj javac keytool rmid jar javadoc native2ascii rmiregistry jarsigner javah ardb serilver

    this seems about right. Is there anything else i can do to help someone help me? I really want to have the ability to compile my project. Its very combersome to scp my files every time i want to compile and fix errors and repeat again. I would love to compile from my home machine. Can i REMOVE everything java related CLEANLY somehow and then reinstall. I tried something like this from the cd that came with the computer. I put it in and reinstalled all developer related items. Nothing changed. Like i said i have downloaded the newest release of java from apple.com and it said i didn't need to update... any clues? Thanks in advance.

  7. #7
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    Maybe this will help. I did and ls -l

    :/System/Library/Frameworks/JavaVM.framework/commands jamesgaines$ ls -l
    total 2528
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 appletviewer
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 extcheck
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 idlj
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 jar
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 jarsigner
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 java
    -rwxr-xr-x 1 root wheel 2126 1 Sep 2004 java-rmi.cgi
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 javac
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 javadoc
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 javah
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 javap
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 jdb
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 keytool
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 native2ascii
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 orbd
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 policytool
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 rmic
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 rmid
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 rmiregistry
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 serialver
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 servertool
    -rwxr-xr-x 1 root wheel 61236 10 Feb 15:30 tnameserv
    /System/Library/Frameworks/JavaVM.framework/commands jamesgaines$

  8. #8
    Kokopelli
    Guest
    well that looks right but when I do a java -version I get

    java version "1.4.2_05"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.4)
    Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)

    And I would wager javac is not building a class file so something must be going wrong. I have been in the Linux world for about 4 years, and *nix for 15, but I only got a Mac 3 months ago so here I am a newbie myself. The common answer to all ills on a Mac seems to be repair permissions (which can be done using Disk Utility and some 3d party products like Yasu). I am not fond of giving that as an answer since usually it is not the problem, and if it is I would prefer do make sure it is the problem via command line first. But most Mac users seem to frown upon going to CLI so I don't bother anymore. As it stands you permissions are set properly there so that is not likely to be the problem. I find it odd that you do not get any response positive or negative to the java command. It is grasping at straws but from the command line in that directory can you try ./java -version?

  9. #9
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    Quote Originally Posted by Kokopelli
    well that looks right but when I do a java -version I get

    java version "1.4.2_05"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.4)
    Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)

    And I would wager javac is not building a class file so something must be going wrong. I have been in the Linux world for about 4 years, and *nix for 15, but I only got a Mac 3 months ago so here I am a newbie myself. The common answer to all ills on a Mac seems to be repair permissions (which can be done using Disk Utility and some 3d party products like Yasu). I am not fond of giving that as an answer since usually it is not the problem, and if it is I would prefer do make sure it is the problem via command line first. But most Mac users seem to frown upon going to CLI so I don't bother anymore. As it stands you permissions are set properly there so that is not likely to be the problem. I find it odd that you do not get any response positive or negative to the java command. It is grasping at straws but from the command line in that directory can you try ./java -version?
    i tried ./java -version nothing happpend. do you think anyone at the apple store near my house would know anything? What abou tthis Yasu thing?

  10. #10
    Kokopelli
    Guest
    Genius Bar is worth a try. Yasu won't help, your permissions are correct for those files. In *nix terms all YASU or repair permissions does is go through the standard file system and makes sure that the permissions match what they are supposed to for each folder. i.e. /usr/bin should be owned by root:wheel and have a minimum permission of 555. If the permissions do not match the default mask it sets them to at least be compliant if the minimal values.

    Occasionally an install will screw up the permissions for a folder and thus cause things to not work right. In the *nix world it is expected that if something like this would happen that the user would discover the problem and chmod/chown the files to an appropriate value. To force this on a Mac or typical non *nix user would cuase undue headaches and spoil the pleasant experience.

    Did you install the developers kit, or whatever Apple calls it? (XCode and all that?) If so... Well either way you might try installing or reinstalling it. Could not hurt. Either that or as you suggested hit up the genius bar at the local Apple Store.

  11. #11
    Java From Terminal
    jdgti's Avatar
    Member Since
    Mar 14, 2005
    Location
    Atlanta, GA
    Posts
    443
    Specs:
    17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
    Talking
    Genius Bar... Not Genius. They didn't know what to do. But I found a way around it though. I just reinstalled the OS 'Archived' Style. So I didn't loose any of my precious files.

    Thanks for all your help guys.

    This is the most beautiful line from terminal to see now that java works.

    jamesgaines$ java -version
    java version "1.4.2_05"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-141.3)
    Java HotSpot(TM) Client VM (build 1.4.2-38, mixed mode)
    jamesgaines$

    Wonderful :cool:

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Java for Mac OS X 10.6 Update 17 latest java version?
    By Applet in forum OS X - Operating System
    Replies: 2
    Last Post: 09-12-2014, 02:07 AM
  2. Taking screenshot with java applet using java robot class not working
    By sagngh8 in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 07-06-2011, 08:53 AM
  3. Mac java and terminal and ecpilse
    By heist in forum OS X - Operating System
    Replies: 5
    Last Post: 12-11-2010, 02:54 PM
  4. Java Problem! Java games freezing!!
    By L33t Walrus in forum Apple Desktops
    Replies: 1
    Last Post: 02-28-2010, 02:21 PM
  5. Replies: 15
    Last Post: 01-08-2010, 05:06 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
  •