Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

1365281

Suspended
Original poster
Oct 27, 2006
82
0
Hi,
I've been trying to install Java J2SE 5.0 version on my Macbook and I'm not sure if I did it right. For learning Java programming I use BlueJ at the beginning which requires JDK/JRE. This time BlueJ doesn't work(buttons aren't active). Having in mind that it worked on a PowerBookG4 where I have previously installed Java, I'm supposing that most likely the installation wasn't right this time. How do I double-check Java installation? or maybe reinstall it ?
thanks for suggestions
 

Lyle

macrumors 68000
Jun 11, 2003
1,874
1
Madison, Alabama
You can check to see which version of Java is installed by opening a Terminal window (Applications -> Utilities -> Terminal) and typing "java -version" at the command prompt. If you have Java 5 installed, it should report something like this:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)
I'm not familiar with BlueJ so I can't offer any advice on that problem. You should check the BlueJ web site (if you haven't already) to see if there are any solutions to this problem.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Hi,
I've been trying to install Java J2SE 5.0 version on my Macbook and I'm not sure if I did it right. For learning Java programming I use BlueJ at the beginning which requires JDK/JRE. This time BlueJ doesn't work(buttons aren't active). Having in mind that it worked on a PowerBookG4 where I have previously installed Java, I'm supposing that most likely the installation wasn't right this time. How do I double-check Java installation? or maybe reinstall it ?
thanks for suggestions

You should have the Java-Runtime installed on your Mac when you bought it, to get the JDK (Java development kit), you need to sign up for an apple developer account (http://connect.apple.com), and login to this site, then click on Java on the right hand side and download the appropriate software.
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
You almost undoutedly already have Java 5 installed.

If you open Terminal and type
Code:
ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
you should see all the installed versions. CurrentJDK will point to the one currently in use.
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
Thanks. I appreciate your advises.
Now let`s take a look at my Terminator window:
total 48
lrwxr-xr-x 1 root wheel 5 Nov 17 19:16 1.3 -> 1.3.1
drwxr-xr-x 8 root wheel 272 Apr 18 2006 1.3.1
lrwxr-xr-x 1 root wheel 5 Apr 18 2006 1.4 -> 1.4.2
drwxr-xr-x 8 root wheel 272 Apr 18 2006 1.4.2
lrwxr-xr-x 1 root wheel 5 Nov 16 21:51 1.5 -> 1.5.0
drwxr-xr-x 8 root wheel 272 Apr 18 2006 1.5.0
lrwxr-xr-x 1 root wheel 5 Nov 17 19:16 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Nov 17 19:16 1.6.0
drwxr-xr-x 6 root wheel 204 Nov 17 19:16 A
lrwxr-xr-x 1 root wheel 1 Nov 16 21:51 Current -> A
lrwxr-xr-x 1 root wheel 3 Nov 17 19:16 CurrentJDK -> 1.5
[Process completed]


What does it mean?



I've registered with Apple's Developper Connection looking for the missing part of my Java appl. There I've found some phrase which I'm not sure I undrstand: "The preview is not removable and should not be installed on systems with critical data. "
a) What is the function of Preview? and
b)What is ment by "critical data"?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
lrwxr-xr-x 1 root wheel 3 Nov 17 19:16 CurrentJDK -> 1.5

This shows you have the current JDK installed.

You have a Macbook so don't want that preview as it's only for Mac OS X 10.3.x

EDIT: Download and unzip the attached Java file, save it in your home directory.

Then load terminal and type,
Code:
javac Test.java
Once that's finished type
Code:
java Test
It should then display "Hello World"
 

Attachments

  • Test.java.zip
    369 bytes · Views: 106

1365281

Suspended
Original poster
Oct 27, 2006
82
0
This shows you have the current JDK installed.

You have a Macbook so don't want that preview as it's only for Mac OS X 10.3.x

EDIT: Download and unzip the attached Java file, save it in your home directory.

Then load terminal and type,
Code:
javac Test.java
Once that's finished type
Code:
java Test
It should then display "Hello World"


The first command result is:
"error: cannot read: Test.java
1 error
[Process exited - exit code 1]"


The second:
"

javac: invalid flag: Test
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system

[Process exited - exit code 2]"


Well, any good news:) ?
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
The first command result is:
"error: cannot read: Test.java
1 error
[Process exited - exit code 1]"
...
First, you likely didn't download (or move) Test.java to your home directory (as opposed to your desktop), so the Java compiler can't find it. Try dragging the file to the home-shaped icon on your Finder window sidebar, then try again.

Second, I believe you typed 'javac' instead of 'java' for the second command, but, since you didn't compile the app with the first command, the second wouldn't have worked anyway.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
HappyElephant, please try the following commands in "Terminator" and capture the entire window contents of the responses.

cd /usr/bin
ls -ltr java*

cd /usr/sbin
ls-ltr java*

Also, it looks like you have installed Mustang (Java6), any particular reason?
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
First, you likely didn't download (or move) Test.java to your home directory (as opposed to your desktop), so the Java compiler can't find it. Try dragging the file to the home-shaped icon on your Finder window sidebar, then try again.

Second, I believe you typed 'javac' instead of 'java' for the second command, but, since you didn't compile the app with the first command, the second wouldn't have worked anyway.

I was really fast finding my home directory icon(only half an hour spent:):
Now the output is :
"Hello World!
[Process completed]"


:)


BlueJ is not active though.
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
HappyElephant, please try the following commands in "Terminator" and capture the entire window contents of the responses.

cd /usr/bin
ls -ltr java*

cd /usr/sbin
ls-ltr java*

Also, it looks like you have installed Mustang (Java6), any particular reason?

Commands in terminator results in:
"ls -ltr java*
lrwxr-xr-x 1 root wheel 85 Nov 16 21:51 java-rmi.cgi -> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java-rmi.cgi
lrwxr-xr-x 1 root wheel 76 Nov 17 19:16 javaws -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws
lrwxr-xr-x 1 root wheel 75 Nov 17 19:16 javap -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javap
lrwxr-xr-x 1 root wheel 75 Nov 17 19:16 javah -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javah
lrwxr-xr-x 1 root wheel 77 Nov 17 19:16 javadoc -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javadoc
lrwxr-xr-x 1 root wheel 75 Nov 17 19:16 javac -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
lrwxr-xr-x 1 root wheel 74 Nov 17 19:16 java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java"


No, no particular reason for installing Mustang. I considered it to be "the latest version". Wasn't I supposed to do this?
P.S.: I'm amazed by the amount of things I'm learning in this forum.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
No, no particular reason for installing Mustang. I considered it to be "the latest version". Wasn't I supposed to do this?
P.S.: I'm amazed by the amount of things I'm learning in this forum.

you don't need Mustang to run anything yet, and since its not official I wouldn't recommend installing it unless you know what you are doing. That said, you DID NOTHING WRONG.

Two more terminator commands please (copy and paste).

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java*

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java*

PS. If you are wondering why, I am just checking that all of your symlinks are pointing at the appropriate java version.
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
you don't need Mustang to run anything yet, and since its not official I wouldn't recommend installing it unless you know what you are doing. That said, you DID NOTHING WRONG.

Two more terminator commands please (copy and paste).

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/java*

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/java*

PS. If you are wondering why, I am just checking that all of your symlinks are pointing at the appropriate java version.

Output:
"Last login: Fri Nov 17 22:20:43 on ttyp2
Welcome to Darwin!
myName-computer:~ myName$ ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/java*
ls: /System/Library/Frameworks/JavaVM.framework/Versions/Current/java*: No such file or directory
myName-computer:~ myName$
myName-computer:~ myName$ ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/java*
ls: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/java*: No such file or directory
myName-computer:~ myName$ "



"No such file or directory" output gives me a feeling of something to be fixed...


P.S;
I've replased user's name by "myName"
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
:eek: :eek: :eek:

Sorry, I meant

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java*

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java*
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
:eek: :eek: :eek:

Sorry, I meant

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java*

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java*


Better looking output this time :)


ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java*

ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java*
__________________myName-computer:~ myName$ ls -ltr /System/LibraVM.framework/Versions/Current/Commands/java*
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javadoc
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javah
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javap
-rwxr-xr-x 1 root wheel 34992 Sep 5 19:42 /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws
myName-computer:~ myName$
myName-computer:~ myName$ ls -ltr /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java*
-rwxr-xr-x 1 root wheel 109944 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javap
-rwxr-xr-x 1 root wheel 109944 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javah
-rwxr-xr-x 1 root wheel 109944 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javadoc
-rwxr-xr-x 1 root wheel 109944 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javac
-rwxr-xr-x 1 root wheel 2126 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java-rmi.cgi
-rwxr-xr-x 1 root wheel 109944 Mar 22 2006 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java
lrwxr-xr-x 1 root wheel 92 Nov 16 21:51 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javaws -> /Applications/Utilities/Java/J2SE 5.0/Java Cache Viewer.app/Contents/MacOS/Java Cache Viewer...


So what would your opinion be about this output?
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
Better looking output this time :)

So what would your opinion be about this output?

I was expecting these to be symlinks (think shortcut) to the 1.5 version, not executables. I'll have to check my setup at home.

Did you ever run

java -version

in "Terminator"?

What I was suspecting is that when I upgraded to Java5, not all of my symlinks were updated properly, so my javac command was pointing at version 5 and my java command was pointing at version 4, so everything was screwy and throwing exceptions and all the jazz.

So what exact issue are you having with BlueJ? Does it launch and you can't do anything, or does it fail to launch? Any exceptions?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Terminator is Terminal (see attached pic) right?
Picture 8.png
God I'm getting confused. :eek:.

BlueJ works on my iMac G5, (I would test on my Macbook but Apple are repairing it currently.), maybe it's got a preferences error. Try dragging the folder org.bluej and the file org.bluej.BlueJ.plist from ~/Library/Preferences to the desktop. (where ~/ represents your home directory which is where I got you to put Test.java earlier.)

EDIT: I tried BlueJ 2.1.3
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
I was expecting these to be symlinks (think shortcut) to the 1.5 version, not executables. I'll have to check my setup at home.

Did you ever run

java -version

in "Terminator"?

What I was suspecting is that when I upgraded to Java5, not all of my symlinks were updated properly, so my javac command was pointing at version 5 and my java command was pointing at version 4, so everything was screwy and throwing exceptions and all the jazz.

So what exact issue are you having with BlueJ? Does it launch and you can't do anything, or does it fail to launch? Any exceptions?


No, I've never run java version in Terminator before.

Just can't believe :I'm able to launch it( both of them netbeans bluej 5.0 and bluej) however here're the comments:


Trying to override old definition of task java
Compiling 1 source file to /Users/myName/EmptyBluej
/Users/myName/EmptyBluej/NewAbstract.java:3: class RemoveDuplicates is public, should be declared in a file named RemoveDuplicates.java
public class RemoveDuplicates {
/Users/myName/EmptyBluej/NewAbstract.java:6: cannot find symbol
symbol : class Set
location: class RemoveDuplicates
Set<Integer> set = new LinkedHashSet<Integer>();
/Users/myName/EmptyBluej/NewAbstract.java:6: cannot find symbol
symbol : class LinkedHashSet
location: class RemoveDuplicates
Set<Integer> set = new LinkedHashSet<Integer>();
3 errors
/Users/myName/EmptyBluej/nbproject/build-impl.xml:293: The following error occurred while executing this line:
/Users/myName/EmptyBluej/nbproject/build-impl.xml:142: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 4 seconds)



and the"hello world"test:

Trying to override old definition of task java
Compiling 1 source file to /Users/myName/EmptyBluej
/Users/myName/EmptyBluej/NewAbstract.java:3: class Test is public, should be declared in a file named Test.java
public class Test {
1 error
/Users/myName/EmptyBluej/nbproject/build-impl.xml:293: The following error occurred while executing this line:
/Users/myName/EmptyBluej/nbproject/build-impl.xml:142: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 10 seconds)

Why would the problem be in simple words, please
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
Terminator is Terminal (see attached pic) right?
View attachment 62269
God I'm getting confused. :eek:.

BlueJ works on my iMac G5, (I would test on my Macbook but Apple are repairing it currently.), maybe it's got a preferences error. Try dragging the folder org.bluej and the file org.bluej.BlueJ.plist from ~/Library/Preferences to the desktop. (where ~/ represents your home directory which is where I got you to put Test.java earlier.)

EDIT: I tried BlueJ 2.1.3

Hey, you're making fun of me now(attaching the icons:) just because it took me a little more ( only half an hour) of time in order to find my home dir icon. It's because of fatigue

Finally, I've launched NetBeans BlueJ and bluej(big thanks to Lyle who indicated me the blueJ site).

I'm trying to figure out what the compiler's problem is for the moment...
 

LtRammstein

macrumors 6502a
Jun 20, 2006
570
0
Denver, CO
BlueJ, after seeing what's going on (and I've used BlueJ before for a class [COSC 1010]).

BlueJ is a complete Java application, that's why it takes so long to run projects and classes and whatnot on it.

If it refuses to open, I recommend DELETING ALL BLUEJ FILES and REINSTALLING BLUEJ.

One, some files they release could be bad with the new Java update (remember BlueJ doesn't have the insight into Sun's Java). Since they released the new update, BlueJ would have an update of it in about two days or so.

If that doesn't work, it could be that the Java environment on your MacBook could be screwing something up.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Hey, you're making fun of me now(attaching the icons:)

I'm really not, when doing something difficult, I find step by step instructions very useful, if something is named incorrectly, then it is more difficult for anyone later browsing the thread who also wants help. I'm not trying to make fun, it is probably possible to use another terminal like application, (or for 'terminator' to be a UNIX program accessed from the command line)

just because it took me a little more ( only half an hour) of time in order to find my home dir icon.
I didn't notice, I don't generally use the thread subscribe option, just come back later to thread's I've posted on.;)


I'm trying to figure out what the compiler's problem is for the moment...

I think it could be a preferences issue for BlueJ, it might have lost the correct compiler locations, have you tried that?

BlueJ works on my iMac G5, (I would test on my Macbook but Apple are repairing it currently.), maybe it's got a preferences error. Try dragging the folder org.bluej and the file org.bluej.BlueJ.plist from ~/Library/Preferences to the desktop. (where ~/ represents your home directory which is where I got you to put Test.java earlier.)

EDIT: I tried BlueJ 2.1.3
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
I'm really not, when doing something difficult, I find step by step instructions very useful, if something is named incorrectly, then it is more difficult for anyone later browsing the thread who also wants help. I'm not trying to make fun, it is probably possible to use another terminal like application, (or for 'terminator' to be a UNIX program accessed from the command line)


I didn't notice, I don't generally use the thread subscribe option, just come back later to thread's I've posted on.;)






I think it could be a preferences issue for BlueJ, it might have lost the correct compiler locations, have you tried that?

I'm just kidding about attaching the icons. Actually, you're explaining things very well. In the end of the day, I have a feeling I've moved a lot this evening.
So thanks everybody(LtRammstein,Kingjr3,jsw,Lyle,eraserhead) ! :)
 

1365281

Suspended
Original poster
Oct 27, 2006
82
0
Terminator is Terminal (see attached pic) right?
View attachment 62269
God I'm getting confused. :eek:.

BlueJ works on my iMac G5, (I would test on my Macbook but Apple are repairing it currently.), maybe it's got a preferences error. Try dragging the folder org.bluej and the file org.bluej.BlueJ.plist from ~/Library/Preferences to the desktop. (where ~/ represents your home directory which is where I got you to put Test.java earlier.)

EDIT: I tried BlueJ 2.1.3

I've followed this advise- it didn't work though... So I kept working on my other computer.
Today again I've been trying to make the compiler (NetBeans 5.0BlueJ) work.
Everytime I end up getting the message:" Trying to override old definition of task java". What does it mean?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.