intellij idea

I wanted to try intellij idea as an IDE for java programming. I have 64-bit openSUSE 10.3 installed. I installed 64-bit Sun java from the rpm. However,
echo $JDK_HOME
yields a blank line. I think that the shell script that is supposed to start IDEA doesn’t work because $JDK_HOME is not properly set. Any suggestions? Thank you.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Have you tried setting JDK_HOME to wherever your JDK from Sun ended up?
~ export JDK_HOME=/path/to/your/jdk

To set permanently add the line above to your user’s ~/.bashrc or
~/.profile file.

Good luck.

Cross AM wrote:
| I wanted to try intellij idea as an IDE for java programming. I have
| 64-bit openSUSE 10.3 installed. I installed 64-bit Sun java from the
| rpm. However,
| echo $JDK_HOME
| yields a blank line. I think that the shell script that is supposed to
| start IDEA doesn’t work because $JDK_HOME is not properly set. Any
| suggestions? Thank you.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIUsOB3s42bA80+9kRAracAJ90fkG/psPdP5fmjQvnCsl6BbX4fQCfXws3
OaTOyWfNv5vOuv8TRY72ISw=
=mYad
-----END PGP SIGNATURE-----

Well I tried to find out where the JDK was installed using
which javac
which yielded
/usr/bin/javac.
However, that didnt work either. There was again an error with the script or may be I exported the wrong path.

In that case, you’d want your export to be:

export JDK_HOME=/usr/bin

[Get rid of any leading ‘~’ that was shown
by the suggester…it was a typo/mistake.]

Hmm…now that I look at my other box, I
think maybe you want:

export JDK_HOME=/usr

[because they assume there will be a following ‘/bin’.
That was true back when it was called JAVA_HOME rather
than JDK_HOME. If the first still wasn’t working,
try this one.]

cookdav wrote:

>
> Hmm…now that I look at my other box, I
> think maybe you want:
>
> export JDK_HOME=/usr
>
> [because they assume there will be a following ‘/bin’.
> That was true back when it was called JAVA_HOME rather
> than JDK_HOME. If the first still wasn’t working,
> try this one.]
>
>
Thank you for the advice. I tried it but now another error has come up. I am
pasting the details of the exception that occured when I ran the script.
Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass2(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:719)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes… sorry about that leading ‘~’… twas a typo.

Regarding your current error if you run /usr/bin/java -version does it
show the version you are hoping to use? Also in SUSE Linux Enterprise
/usr/bin/java is just a softlink to a real version somewhere else in the
filesystem. With that said, where does /usr/bin/java point? Mine
refrences a 1.4.2 version but I have a 1.6 version elsewhere that I’ve
installed and can reference manually.

Good luck.

Cross_AM wrote:
| cookdav wrote:
|
|> Hmm…now that I look at my other box, I
|> think maybe you want:
|>
|> export JDK_HOME=/usr
|>
|> [because they assume there will be a following ‘/bin’.
|> That was true back when it was called JAVA_HOME rather
|> than JDK_HOME. If the first still wasn’t working,
|> try this one.]
|>
|>
| Thank you for the advice. I tried it but now another error has come
up. I am
| pasting the details of the exception that occured when I ran the script.
| Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad
| version number in .class file
| at java.lang.ClassLoader.defineClass2(Native Method)
| at java.lang.ClassLoader.defineClass(ClassLoader.java:719)
| at
| java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160)
| at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
| at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
| at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
| at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
| at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
| at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIU/1x3s42bA80+9kRAvgAAJ43rUK99Jx9SFTu1kOqIXjM4D6/AwCfYGpb
vmMBJfKwpK21zKHNACDdb88=
=JiRH
-----END PGP SIGNATURE-----

ab@novell.com wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Yes… sorry about that leading ‘~’… twas a typo.
>
> Regarding your current error if you run /usr/bin/java -version does it
> show the version you are hoping to use? Also in SUSE Linux Enterprise
> /usr/bin/java is just a softlink to a real version somewhere else in the
> filesystem. With that said, where does /usr/bin/java point? Mine
> refrences a 1.4.2 version but I have a 1.6 version elsewhere that I’ve
> installed and can reference manually.
>
> Good luck.

The JDK I installed in the 1.6 version. However,
/usr/bin/java -version
yields 1.5 version. How can I use the 1.6 version java?

Cross_AM wrote:

> ab@novell.com wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Yes… sorry about that leading ‘~’… twas a typo.
>>
>> Regarding your current error if you run /usr/bin/java -version does it
>> show the version you are hoping to use? Also in SUSE Linux Enterprise
>> /usr/bin/java is just a softlink to a real version somewhere else in the
>> filesystem. With that said, where does /usr/bin/java point? Mine
>> refrences a 1.4.2 version but I have a 1.6 version elsewhere that I’ve
>> installed and can reference manually.
>>
>> Good luck.
>
> The JDK I installed in the 1.6 version. However,
> /usr/bin/java -version
> yields 1.5 version. How can I use the 1.6 version java?

YaST did the work for me. Now,
/usr/bin/java -version
yields the 1.6 version. Idea did work but it tells me that tools.jar is not
in IDEA classpath. It tells me to check whether JAVA_HOME points to jre
rather than the jdk.
echo $JAVA_HOME
yields /usr/lib64/jvm/jre.

What I want to know is that whether changing the JAVA_HOME environmental
variable will affect other applications. I guess to make IDEA work I will
have to do the following.
export JAVA_HOME="/usr"

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Find out where your new one is installed and point JDK_HOME to THAT
location. For example, on my laptop:

rpm -qa | grep jre | grep 6
returns
jre-1.6.0_06-fcs

rpm -ql jre
has a whole lot of paths that start with:
/usr/java/jre1.6.0_06/

So:
export JDK_HOME=/usr/java/jre1.6.0_06

Now mine is just the runtime environment and yours will be a full JDK so
your installed package will probably reflect that, assuming you
installed an RPM. If you didn’t install an RPM then find out where you
installed whatever you did install. Keep in mind that the path is to
the directory holding the entire environment and not the ‘bin’ directory
or the ‘java’ command itself.

Good luck.

Cross_AM wrote:
| ab@novell.com wrote:
|
|> -----BEGIN PGP SIGNED MESSAGE-----
|> Hash: SHA1
|>
|> Yes… sorry about that leading ‘~’… twas a typo.
|>
|> Regarding your current error if you run /usr/bin/java -version does it
|> show the version you are hoping to use? Also in SUSE Linux Enterprise
|> /usr/bin/java is just a softlink to a real version somewhere else in the
|> filesystem. With that said, where does /usr/bin/java point? Mine
|> refrences a 1.4.2 version but I have a 1.6 version elsewhere that I’ve
|> installed and can reference manually.
|>
|> Good luck.
|
| The JDK I installed in the 1.6 version. However,
| /usr/bin/java -version
| yields 1.5 version. How can I use the 1.6 version java?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIVAG+3s42bA80+9kRAq0UAJwNr0vbf5aTtidUt1NcpKYglRxinACeO3XA
3C7+lydXWz76T1YaOiCvjzA=
=JIe4
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Keep in mind a couple things. First, JDK_HOME and JAVA_HOME are very
different. If your software wants JDK_HOME set then use that one.

Second, any environment variable you set in a shell is only set in THAT
shell and not system-wide… even if you are root. You aren’t even
setting that variable for all of your other user-based stuff unless you
set it for your entire user on purpose by putting it in ~/.bashrc or
~/.profile. To set something system-wide you need to have it set on
bootup so everything loaded from that point on has the setting. Yast
may be doing this for you but unless you are using Yast or modifying
system files you shouldn’t affect any other programs. This is nice
because you can create a script, put it in your own user’s ‘./bin’
directory (in your home directory), and have it set the variable and
make the call to the program and know that you are only affecting the
program being called right then.

Good luck.

Cross_AM wrote:
| Cross_AM wrote:
|
|> ab@novell.com wrote:
|>
|>> -----BEGIN PGP SIGNED MESSAGE-----
|>> Hash: SHA1
|>>
|>> Yes… sorry about that leading ‘~’… twas a typo.
|>>
|>> Regarding your current error if you run /usr/bin/java -version does it
|>> show the version you are hoping to use? Also in SUSE Linux Enterprise
|>> /usr/bin/java is just a softlink to a real version somewhere else in the
|>> filesystem. With that said, where does /usr/bin/java point? Mine
|>> refrences a 1.4.2 version but I have a 1.6 version elsewhere that I’ve
|>> installed and can reference manually.
|>>
|>> Good luck.
|> The JDK I installed in the 1.6 version. However,
|> /usr/bin/java -version
|> yields 1.5 version. How can I use the 1.6 version java?
|
| YaST did the work for me. Now,
| /usr/bin/java -version
| yields the 1.6 version. Idea did work but it tells me that tools.jar
is not
| in IDEA classpath. It tells me to check whether JAVA_HOME points to jre
| rather than the jdk.
| echo $JAVA_HOME
| yields /usr/lib64/jvm/jre.
|
| What I want to know is that whether changing the JAVA_HOME environmental
| variable will affect other applications. I guess to make IDEA work I will
| have to do the following.
| export JAVA_HOME="/usr"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIVAKT3s42bA80+9kRArM0AJ9gonB2OuasBTPcA16qZ6+eCulM0wCZAUZJ
jCc1uG5rzv3KGZhvfjPs+60=
=U9jn
-----END PGP SIGNATURE-----

ab@novell.com wrote:

> rpm -qa | grep jre | grep 6
It just returns without any message.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes… see my other post. I have a JRE, you have a JDK. You’ll
probably need to search a little more.

rpm -qa | grep 6 | grep -i jdk
rpm -qa | grep 6 | grep -i java
rpm -qa | grep 6 | grep -i j

Good luck.

Cross_AM wrote:
| ab@novell.com wrote:
|
|> rpm -qa | grep jre | grep 6
| It just returns without any message.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIVART3s42bA80+9kRAs59AJwIr4dZDLheqZVHruMqWzlDFpAl/gCcDLvd
Gp9hUXQbzk7NHsZ37KTLD2w=
=4ecj
-----END PGP SIGNATURE-----

ab@novell.com wrote:

> Keep in mind a couple things. First, JDK_HOME and JAVA_HOME are very
> different. If your software wants JDK_HOME set then use that one.
>
> Second, any environment variable you set in a shell is only set in THAT
> shell and not system-wide… even if you are root. You aren’t even
> setting that variable for all of your other user-based stuff unless you
> set it for your entire user on purpose by putting it in ~/.bashrc or
> ~/.profile. To set something system-wide you need to have it set on
> bootup so everything loaded from that point on has the setting. Yast
> may be doing this for you but unless you are using Yast or modifying
> system files you shouldn’t affect any other programs. This is nice
> because you can create a script, put it in your own user’s ‘./bin’
> directory (in your home directory), and have it set the variable and
> make the call to the program and know that you are only affecting the
> program being called right then.
>
> Good luck

Thank you. After setting JDK_HOME to “/usr”, the script works. However, then
it tells me that JAVA_HOME needs to be set to the jdk as well. I tried to
set JAVA_HOME to “/usr” but that doesn’t work.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Better yet…

rpm -qf /path/to/your/1.6/bin/java

You’ll need to find the actual ‘java’ file yourself as /usr/bin/java is
just a symlink but once you find it the command above will tell you the
package name.

Good luck.

ab@novell.com wrote:
| Yes… see my other post. I have a JRE, you have a JDK. You’ll
| probably need to search a little more.
|
| rpm -qa | grep 6 | grep -i jdk
| rpm -qa | grep 6 | grep -i java
| rpm -qa | grep 6 | grep -i j
|
|
| Good luck.
|
|
|
|
| Cross_AM wrote:
| | ab@novell.com wrote:
| |
| |> rpm -qa | grep jre | grep 6
| | It just returns without any message.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIVATb3s42bA80+9kRAtKxAJ4icnUdBQWQQ1C4ZBxJEtmCvNrc0wCfUjJy
snI63R7/2WVpHjfDUwehVQo=
=bdul
-----END PGP SIGNATURE-----

ab@novell.com wrote:

> rpm -qf /path/to/your/1.6/bin/java

The result I get is the following message:
file /usr/bin/java is not owned by any package

ab@novell.com wrote:

> rpm -qa | grep 6 | grep -i jdk
> rpm -qa | grep 6 | grep -i java

The commands in order yield the following:
jdk-1.6.0_06-fcs
java-1_6_0-sun-1.6.0.u6-3.1

ab@novell.com wrote:

> export JDK_HOME=/usr/java/jre1.6.0_06
changing jre to jdk in the above line did it for me. thank you. the problem
was due to the soft link as you pointed out.

OT, I find it a bit hard to find the actual location of java files

~> which java
/usr/bin/java
~> ll /usr/bin/java
lrwxrwxrwx 1 root root 22 2007-11-14 23:47 /usr/bin/java -> /etc/alternatives/java
~> ll /etc/alternatives/java
lrwxrwxrwx 1 root root 38 2008-06-05 17:44 /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
~> ll /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
-rwxr-xr-x 3 root root 208 2008-05-05 16:16 /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
~> cat /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java | nl
1 #!/bin/bash
2 # This wrapper script solves the problem that graphical java programs won’t work with the newest X server
3 export LIBXCB_ALLOW_SLOPPY_LOCK=1
4 exec -a readlink -f $0 readlink -f $0.bin ${1+"$@"}
~> echo $JDK_HOME
/usr/lib/jvm/java
~> ll /usr/lib/jvm/java
lrwxrwxrwx 1 root root 26 2008-01-24 09:40 /usr/lib/jvm/java -> /etc/alternatives/java_sdk
~> ll /etc/alternatives/java_sdk
lrwxrwxrwx 1 root root 30 2008-05-08 10:27 /etc/alternatives/java_sdk -> /usr/lib/jvm/java-1.6.0.u6-sun
~> ll /usr/lib/jvm/java-1.6.0.u6-sun
lrwxrwxrwx 1 root root 26 2008-05-08 10:26 /usr/lib/jvm/java-1.6.0.u6-sun -> java-1.6.0.u6-sun-1.6.0.u6
~> ll /usr/lib/jvm/java-1.6.0.u6-sun-1.6.0.u6
total 16
drwxr-xr-x 2 root root 4096 2008-05-08 10:27 bin
drwxr-xr-x 3 root root 4096 2008-05-08 10:26 include
drwxr-xr-x 5 root root 4096 2008-05-08 10:25 jre
drwxr-xr-x 2 root root 4096 2008-05-08 10:27 lib
~> echo $JAVA_HOME
/usr/lib/jvm/java

hro1 wrote:

>
> OT, I find it a bit hard to find the actual location of java files
>
> ~> which java
> /usr/bin/java
> ~> ll /usr/bin/java
> lrwxrwxrwx 1 root root 22 2007-11-14 23:47 /usr/bin/java ->
> /etc/alternatives/java
> ~> ll /etc/alternatives/java
> lrwxrwxrwx 1 root root 38 2008-06-05 17:44 /etc/alternatives/java ->
> /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
> ~> ll /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
> -rwxr-xr-x 3 root root 208 2008-05-05 16:16
> /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java
> ~> cat /usr/lib/jvm/jre-1.6.0.u6-sun/bin/java | nl
> 1 #!/bin/bash
> 2 # This wrapper script solves the problem that graphical java
> programs won’t work with the newest X server
> 3 export LIBXCB_ALLOW_SLOPPY_LOCK=1
> 4 exec -a readlink -f $0 readlink -f $0.bin ${1+"$@"}
> ~> echo $JDK_HOME
> /usr/lib/jvm/java
> ~> ll /usr/lib/jvm/java
> lrwxrwxrwx 1 root root 26 2008-01-24 09:40 /usr/lib/jvm/java ->
> /etc/alternatives/java_sdk
> ~> ll /etc/alternatives/java_sdk
> lrwxrwxrwx 1 root root 30 2008-05-08 10:27 /etc/alternatives/java_sdk
> -> /usr/lib/jvm/java-1.6.0.u6-sun
> ~> ll /usr/lib/jvm/java-1.6.0.u6-sun
> lrwxrwxrwx 1 root root 26 2008-05-08 10:26
> /usr/lib/jvm/java-1.6.0.u6-sun -> java-1.6.0.u6-sun-1.6.0.u6
> ~> ll /usr/lib/jvm/java-1.6.0.u6-sun-1.6.0.u6
> total 16
> drwxr-xr-x 2 root root 4096 2008-05-08 10:27 bin
> drwxr-xr-x 3 root root 4096 2008-05-08 10:26 include
> drwxr-xr-x 5 root root 4096 2008-05-08 10:25 jre
> drwxr-xr-x 2 root root 4096 2008-05-08 10:27 lib
> ~> echo $JAVA_HOME
> /usr/lib/jvm/java
>
>
rpm -ql jdk | less
try this from Konsole; worked for me.