14 Replies - 1134 Views - Last Post: 03 November 2007 - 10:18 PM Rate Topic: -----

#1 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

O.K. I am new to Java and sort of new to Linux

Post icon  Posted 03 November 2007 - 11:30 AM

Hello all,
I would like to try my hand at Java programming, I see plenty of tutorials on the Web, but I need a little help getting the Java SDK up and going.

I am running Ubuntu 6.06 and I see there is both a free-java-sdk and of course Sun's version sun-java6-SDK both of which I can install with the Synaptic Package Manager. After that I read there is some command line stuff to do..and that's the part I am unsure of...Would appreciate any help in this regards, It would be great if someone could get on AIM with me and walk me through the steps if they have been there before. I am normally more experimental, but this is a loaned machine so I don't want to mess anything up on this equipment...

Thanks,
Mark Lytle

Is This A Good Question/Topic? 0
  • +

Replies To: O.K. I am new to Java and sort of new to Linux

#2 bobwrit  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 01:13 PM

can you open the terminal and enter the shell comand's there(the one's on the sites you were refering to)?
Was This Post Helpful? 0
  • +
  • -

#3 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 01:26 PM

View Postbobwrit, on 3 Nov, 2007 - 01:13 PM, said:

can you open the terminal and enter the shell comand's there(the one's on the sites you were refering to)?

Hi Bobwrit,

I can open a terminal, no problem, but the directions on the Ubuntu site are a little vague: this is what it says for the free SDK:

"After installation of this package you should be able to set JAVA_HOME environment variable to /usr/lib/fjsdk (and preferably add /usr/lib/fjsdk/bin at the beginning of your PATH) and use the common java utilities just like in a non-free Java SDK. Packages that can be built and run with help from free-java-sdk's Java environment are in general eliglible to be placed in the "main" section of Debian distribution."

So do I type "set JAVA_HOME=/usr/lib/fjsdk" ? and the path stuff, not real familiar with that..

Regards,
Mark Lytle
Was This Post Helpful? 0
  • +
  • -

#4 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5764
  • View blog
  • Posts: 12,580
  • Joined: 16-October 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 01:44 PM

Class paths are the bane of any Java programmer. Rather than letting that be your stumbling block, I'd start out with a nice friendly IDE willing to handle such stuff. Eclipse is a common IDE for java and lives on the Ubuntu tree. This should be all you need to get it going:

sudo apt-get install eclipse


Personally, I quite like the new version of netbeans. I find it has all the stuff I need with less of the extras I don't care about. You'll have to download it and install, but its not a real hassle. Once it's downloaded, just do the following:

chmod 777 netbeans-5_5_1-linux.bin
sudo sh netbeans-5_5_1-linux.bin


That's it, you're there. If you don't have the SDK, I believe something like sudo apt-get install sun-java6-sdk will get you it for you.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#5 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 02:43 PM

View Postbaavgai, on 3 Nov, 2007 - 01:44 PM, said:

Class paths are the bane of any Java programmer. Rather than letting that be your stumbling block, I'd start out with a nice friendly IDE willing to handle such stuff. Eclipse is a common IDE for java and lives on the Ubuntu tree. This should be all you need to get it going:

sudo apt-get install eclipse


Personally, I quite like the new version of netbeans. I find it has all the stuff I need with less of the extras I don't care about. You'll have to download it and install, but its not a real hassle. Once it's downloaded, just do the following:

chmod 777 netbeans-5_5_1-linux.bin
sudo sh netbeans-5_5_1-linux.bin


That's it, you're there. If you don't have the SDK, I believe something like sudo apt-get install sun-java6-sdk will get you it for you.

Hope this helps.


Hi baavgai,
Thanks for your info...I'm almost there, I got Eclipse installed , and downloaded netbeans and did the CHMOD stuff, but it can't find the Sun JAVA SDK. although I know I was able to load it with Ubuntu's Synaptic package manager..it shows it's in there..I'm sure it some kind of path issue, maybe I need to run the Javabeans bin from the same directory as the Java SDK? If I can figure out where it is...


Regards,
Mark Lytle

This post has been edited by mlytle: 03 November 2007 - 02:46 PM

Was This Post Helpful? 0
  • +
  • -

#6 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 03:18 PM

View Postmlytle, on 3 Nov, 2007 - 02:43 PM, said:

View Postbaavgai, on 3 Nov, 2007 - 01:44 PM, said:

Class paths are the bane of any Java programmer. Rather than letting that be your stumbling block, I'd start out with a nice friendly IDE willing to handle such stuff. Eclipse is a common IDE for java and lives on the Ubuntu tree. This should be all you need to get it going:

sudo apt-get install eclipse


Personally, I quite like the new version of netbeans. I find it has all the stuff I need with less of the extras I don't care about. You'll have to download it and install, but its not a real hassle. Once it's downloaded, just do the following:

chmod 777 netbeans-5_5_1-linux.bin
sudo sh netbeans-5_5_1-linux.bin


That's it, you're there. If you don't have the SDK, I believe something like sudo apt-get install sun-java6-sdk will get you it for you.

Hope this helps.


Hi baavgai,
Thanks for your info...I'm almost there, I got Eclipse installed , and downloaded netbeans and did the CHMOD stuff, but it can't find the Sun JAVA SDK. although I know I was able to load it with Ubuntu's Synaptic package manager..it shows it's in there..I'm sure it some kind of path issue, maybe I need to run the Javabeans bin from the same directory as the Java SDK? If I can figure out where it is...


Regards,
Mark Lytle



baavgai and others,
Eclipse comes up, does that mean that it sees the SDK? If so, should I run netbeans installer from that directory? and if I can't get net beans to install can I use eclipse by itself?

Regards,
Mark Lytle
Was This Post Helpful? 0
  • +
  • -

#7 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5764
  • View blog
  • Posts: 12,580
  • Joined: 16-October 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 04:38 PM

Hmm, my assumption would be that an apt-get on eclipse would bring it in, but that's not necessarily true.

First, try this to see what's there:
dpkg -l *jdk*


Mine yields:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name		   Version		Description
+++-==============-==============-============================================
ii  sun-java5-jdk  1.5.0-13-0ubun Sun Java(TM) Development Kit (JDK) 5.0
ii  sun-java6-jdk  6-03-0ubuntu2  Sun Java(TM) Development Kit (JDK) 6



You can find what's available like with sudo apt-cache search jdk. This will give you more than you want, don't worry about it.

If you don't have any jdk installed, try sudo apt-get install sun-java6-sdk sun-java6-jre. The jre shouldn't be required, but I didn't think the jdk would be needed, either.

If you're looking for paths and such, something like dpkg -L sun-java6-jdk can find where it's hiding.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#8 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 05:09 PM

View Postbaavgai, on 3 Nov, 2007 - 04:38 PM, said:

Hmm, my assumption would be that an apt-get on eclipse would bring it in, but that's not necessarily true.

First, try this to see what's there:
dpkg -l *jdk*


Mine yields:
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name		   Version		Description
+++-==============-==============-============================================
ii  sun-java5-jdk  1.5.0-13-0ubun Sun Java(TM) Development Kit (JDK) 5.0
ii  sun-java6-jdk  6-03-0ubuntu2  Sun Java(TM) Development Kit (JDK) 6



You can find what's available like with sudo apt-cache search jdk. This will give you more than you want, don't worry about it.

If you don't have any jdk installed, try sudo apt-get install sun-java6-sdk sun-java6-jre. The jre shouldn't be required, but I didn't think the jdk would be needed, either.

If you're looking for paths and such, something like dpkg -L sun-java6-jdk can find where it's hiding.

Hope this helps.



Hi baavgai, thanks again for the assistance, here's what I get from the various queries:

When I run dpkg -l *jdk*

I get:
mark@mark-desktop:~/Java_stuff$ dpkg -l *jdk*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii sun-java6-jdk 6-00-0ubuntu1~ Sun Java™ Development Kit (JDK) 6

So it looks like it's there, although it never came up in the install process and asked me to agree to it's conditions..I think it's supposed to do that...

The sun-java6-jre is loaded also according to the Synaptics package manager. Attempting "sudo apt-cache search jdk" produces:

libc6-i686 - GNU C Library: Shared libraries [i686 optimized]
openoffice.org-gcj - OpenOffice.orgs Java libraries (native for use with GIJ)
free-java-sdk - Complete Java SDK environment consisting of free Java tools
japitools - Java API compatibility testing tools
kaffe - A JVM to run Java bytecode
libcommons-lang-java - Extension of the java.lang package
libcommons-launcher-java - cross platform java application launcher
libnbio2-java - NBIO: Nonblocking I/O for Java, Version 2
libpg-java - Java database (JDBC) driver for PostgreSQL
mmake - Makefile generator for Java programs
usepackage - utility to manage environment variables from within dotfiles
libgnujaxp-java - free implementation of jaxp api
jde - JDEE, Java Development Environment for Emacs(en)
sun-java5-bin - Sun Java™ Runtime Environment (JRE) 5.0
sun-java5-demo - Sun Java™ Development Kit (JDK) 5.0 demos and examples
sun-java5-doc - Sun JDK™ Documention -- integration installer
sun-java5-jdk - Sun Java™ Development Kit (JDK) 5.0
sun-java5-jre - Sun Java™ Runtime Environment (JRE) 5.0
sun-java5-source - Sun Java™ Development Kit (JDK) 5.0 source files
sun-java6-bin - Sun Java™ Runtime Environment (JRE) 6
sun-java6-demo - Sun Java™ Development Kit (JDK) 6 demos and examples
sun-java6-doc - Sun JDK™ Documention -- integration installer
sun-java6-jdk - Sun Java™ Development Kit (JDK) 6
sun-java6-jre - Sun Java™ Runtime Environment (JRE) 6
sun-java6-source - Sun Java™ Development Kit (JDK) 6 source files

so again, it looks like it's all there...

attempting : sudo apt-get install sun-java6-sdk sun-java6-jre, produces:
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package sun-java6-sdk
mark@mark-desktop:~/Java_stuff$

Seems all a bit contradictory...like it's there and it's not there..using the Synaptic manager I have installed and uninstalled sun-java6-sdk a number of times just to see if it changes anything..but seems like it's not taking somehow..

It's challenging me, no doubt about that....

Scratching my head,
Mark Lytle
Was This Post Helpful? 0
  • +
  • -

#9 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5764
  • View blog
  • Posts: 12,580
  • Joined: 16-October 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 05:58 PM

Here's a java sanity check to try: This should work if we have any kind of JDK.
baavgai@bambox1:~$ mkdir javatest
baavgai@bambox1:~$ cd javatest/
baavgai@bambox1:~/javatest$ cat > t.java <<EOF
> class test1 {  public static void main(String args[]) { System.out.println("Hello World!");  } }
> EOF
baavgai@bambox1:~/javatest$ ls
t.java
baavgai@bambox1:~/javatest$ javac t.java
baavgai@bambox1:~/javatest$ ls
test1.class  t.java
baavgai@bambox1:~/javatest$ java test1 
Hello World!


Now, time to confirm what java we're really using... in Ubuntu, this is not as clear as it could be. I'll give the whole mess, then explain:

baavgai@bambox1:~/javatest$ which java
/usr/bin/java
baavgai@bambox1:~/javatest$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2007-10-25 12:49 /usr/bin/java -> /etc/alternatives/java
baavgai@bambox1:~/javatest$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 36 2007-10-27 20:42 /etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java


My which says java is under /usr/bin, but I don't trust it. An ls -l tells me that it's a link to /etc/alternatives/java, but that still sounds odd. An ls -l on that tells the real story, /usr/lib/jvm/java-6-sun/jre/bin/java. Using the same method, my javac resolves to /usr/lib/jvm/java-6-sun/bin/javac.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

#10 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 06:53 PM

View Postbaavgai, on 3 Nov, 2007 - 05:58 PM, said:

Here's a java sanity check to try: This should work if we have any kind of JDK.
baavgai@bambox1:~$ mkdir javatest
baavgai@bambox1:~$ cd javatest/
baavgai@bambox1:~/javatest$ cat > t.java <<EOF
> class test1 {  public static void main(String args[]) { System.out.println("Hello World!");  } }
> EOF
baavgai@bambox1:~/javatest$ ls
t.java
baavgai@bambox1:~/javatest$ javac t.java
baavgai@bambox1:~/javatest$ ls
test1.class  t.java
baavgai@bambox1:~/javatest$ java test1 
Hello World!


Now, time to confirm what java we're really using... in Ubuntu, this is not as clear as it could be. I'll give the whole mess, then explain:

baavgai@bambox1:~/javatest$ which java
/usr/bin/java
baavgai@bambox1:~/javatest$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2007-10-25 12:49 /usr/bin/java -> /etc/alternatives/java
baavgai@bambox1:~/javatest$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 36 2007-10-27 20:42 /etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java


My which says java is under /usr/bin, but I don't trust it. An ls -l tells me that it's a link to /etc/alternatives/java, but that still sounds odd. An ls -l on that tells the real story, /usr/lib/jvm/java-6-sun/jre/bin/java. Using the same method, my javac resolves to /usr/lib/jvm/java-6-sun/bin/javac.

Hope this helps.



Well, here's what I got: the second test first:

mark@mark-desktop:~/Java_stuff/javatest$ which java
/usr/bin/java
mark@mark-desktop:~/Java_stuff/javatest$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2007-10-31 17:43 /usr/bin/java -> /etc/alternatives/java
mark@mark-desktop:~/Java_stuff/javatest$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 34 2007-11-03 13:02 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java

Now the test itself failed, I got:


mark@mark-desktop:~/Java_stuff/javatest$
mark@mark-desktop:~/Java_stuff/javatest$ cat > t.java <<EOF
> class test1 { public static void main(String args[]) { System.out.println("Hello World!"); } }
> EOF
mark@mark-desktop:~/Java_stuff/javatest$ ls
t.java
mark@mark-desktop:~/Java_stuff/javatest$ javac t.java
mark@mark-desktop:~/Java_stuff/javatest$ ls
test1.class t.java
mark@mark-desktop:~/Java_stuff/javatest$ java test1
Exception in thread "main" java.lang.ClassFormatError: test1 (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.7)
at java.lang.ClassLoader.defineClass(libgcj.so.7)
at java.security.SecureClassLoader.defineClass(libgcj.so.7)
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at gnu.java.lang.MainThread.run(libgcj.so.7)
mark@mark-desktop:~/Java_stuff/javatest$

So there is something there but it's broken, I guess...

Interesting test....
Mark
Was This Post Helpful? 0
  • +
  • -

#11 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5764
  • View blog
  • Posts: 12,580
  • Joined: 16-October 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 08:03 PM

Excellent, you're getting there. You can compile to a .class file but it doesn't run. Reasonably, your javac and your java are different versions.

Do a [li]ls -l /etc/alternatives/java[/li]. Based on prior diagnostics, this should be something like mine, /usr/lib/jvm/java-6-sun/jre/bin/java. If you're set up properly, java should be /usr/lib/jvm/java-6-sun/jre/bin/java.

However, you noted your java is /usr/lib/jvm/java-gcj/jre/bin/java. Oops, you have mismatches. Try this
ls -l /etc/alternatives/java*


Everything should map to a similar place. I'm betting it doesn't. Try removing all Java stuff. Go into synaptic, search on java, and take it all out.

Then, put back in sun-java6-sdk and sun-java6-jre. Then try the simple test program compile and run you tried before.

Good luck.
Was This Post Helpful? 0
  • +
  • -

#12 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 09:06 PM

View Postbaavgai, on 3 Nov, 2007 - 08:03 PM, said:

Excellent, you're getting there. You can compile to a .class file but it doesn't run. Reasonably, your javac and your java are different versions.

Do a [li]ls -l /etc/alternatives/java[/li]. Based on prior diagnostics, this should be something like mine, /usr/lib/jvm/java-6-sun/jre/bin/java. If you're set up properly, java should be /usr/lib/jvm/java-6-sun/jre/bin/java.

However, you noted your java is /usr/lib/jvm/java-gcj/jre/bin/java. Oops, you have mismatches. Try this
ls -l /etc/alternatives/java*


Everything should map to a similar place. I'm betting it doesn't. Try removing all Java stuff. Go into synaptic, search on java, and take it all out.

Then, put back in sun-java6-sdk and sun-java6-jre. Then try the simple test program compile and run you tried before.

Good luck.



I see..
hereis the results of:ls -l /etc/alternatives/java

I get:/usr/lib/jvm/java-gcj/jre/bin/java

for ls -l /etc/alternatives/java*

I get:
lrwxrwxrwx 1 root root 34 2007-11-03 13:02 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java
lrwxrwxrwx 1 root root 40 2007-11-03 13:02 /etc/alternatives/java.1.gz -> /usr/lib/jvm/java-gcj/man/man1/java.1.gz
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javac -> /usr/lib/jvm/java-6-sun/bin/javac
lrwxrwxrwx 1 root root 52 2007-11-03 17:45 /etc/alternatives/javac.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/man/man1/javac.1.gz
lrwxrwxrwx 1 root root 14 2007-11-03 13:02 /etc/alternatives/javadoc -> /usr/bin/gjdoc
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javah -> /usr/bin/javah-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javah.1.gz -> /usr/share/man/man1/javah-cp.1.gz
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javap -> /usr/bin/javap-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javap.1.gz -> /usr/share/man/man1/javap-cp.1.gz
lrwxrwxrwx 1 root root 40 2007-11-03 17:45 /etc/alternatives/java-rmi.cgi -> /usr/lib/jvm/java-6-sun/bin/java-rmi.cgi
lrwxrwxrwx 1 root root 39 2007-11-01 14:28 /etc/alternatives/java_vm -> /usr/lib/jvm/java-6-sun/jre/bin/java_vm
lrwxrwxrwx 1 root root 38 2007-11-01 14:28 /etc/alternatives/javaws -> /usr/lib/jvm/java-6-sun/jre/bin/javaws
lrwxrwxrwx 1 root root 57 2007-11-01 14:28 /etc/alternatives/javaws.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/jre/man/man1/javaws.1.gz

Will now remove the main Java's although i see a lot of libraries i believe belong to Ubuntu, that have the suffix -java , i presume they stay... Here we go..

This post has been edited by mlytle: 03 November 2007 - 09:20 PM

Was This Post Helpful? 0
  • +
  • -

#13 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 09:36 PM

View Postmlytle, on 3 Nov, 2007 - 09:06 PM, said:

View Postbaavgai, on 3 Nov, 2007 - 08:03 PM, said:

Excellent, you're getting there. You can compile to a .class file but it doesn't run. Reasonably, your javac and your java are different versions.

Do a [li]ls -l /etc/alternatives/java[/li]. Based on prior diagnostics, this should be something like mine, /usr/lib/jvm/java-6-sun/jre/bin/java. If you're set up properly, java should be /usr/lib/jvm/java-6-sun/jre/bin/java.

However, you noted your java is /usr/lib/jvm/java-gcj/jre/bin/java. Oops, you have mismatches. Try this
ls -l /etc/alternatives/java*


Everything should map to a similar place. I'm betting it doesn't. Try removing all Java stuff. Go into synaptic, search on java, and take it all out.

Then, put back in sun-java6-sdk and sun-java6-jre. Then try the simple test program compile and run you tried before.

Good luck.



I see..
hereis the results of:ls -l /etc/alternatives/java

I get:/usr/lib/jvm/java-gcj/jre/bin/java

for ls -l /etc/alternatives/java*

I get:
lrwxrwxrwx 1 root root 34 2007-11-03 13:02 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java
lrwxrwxrwx 1 root root 40 2007-11-03 13:02 /etc/alternatives/java.1.gz -> /usr/lib/jvm/java-gcj/man/man1/java.1.gz
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javac -> /usr/lib/jvm/java-6-sun/bin/javac
lrwxrwxrwx 1 root root 52 2007-11-03 17:45 /etc/alternatives/javac.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/man/man1/javac.1.gz
lrwxrwxrwx 1 root root 14 2007-11-03 13:02 /etc/alternatives/javadoc -> /usr/bin/gjdoc
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javah -> /usr/bin/javah-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javah.1.gz -> /usr/share/man/man1/javah-cp.1.gz
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javap -> /usr/bin/javap-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javap.1.gz -> /usr/share/man/man1/javap-cp.1.gz
lrwxrwxrwx 1 root root 40 2007-11-03 17:45 /etc/alternatives/java-rmi.cgi -> /usr/lib/jvm/java-6-sun/bin/java-rmi.cgi
lrwxrwxrwx 1 root root 39 2007-11-01 14:28 /etc/alternatives/java_vm -> /usr/lib/jvm/java-6-sun/jre/bin/java_vm
lrwxrwxrwx 1 root root 38 2007-11-01 14:28 /etc/alternatives/javaws -> /usr/lib/jvm/java-6-sun/jre/bin/javaws
lrwxrwxrwx 1 root root 57 2007-11-01 14:28 /etc/alternatives/javaws.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/jre/man/man1/javaws.1.gz

Will now remove the main Java's although i see a lot of libraries i believe belong to Ubuntu, that have the suffix -java , i presume they stay... Here we go..


O.K., I have removed both java5 and java6 (don't know why 5 got installed), but problem remains, compile failed.
the java-gcj libraries apparently belong to eclipse as attempts to delete, say, java-gcj-compat and java-common just warn me the eclipse package goes...maybe I need to uninstall eclipse...?
Was This Post Helpful? 0
  • +
  • -

#14 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 10:10 PM

View Postmlytle, on 3 Nov, 2007 - 09:06 PM, said:

View Postbaavgai, on 3 Nov, 2007 - 08:03 PM, said:

Excellent, you're getting there. You can compile to a .class file but it doesn't run. Reasonably, your javac and your java are different versions.

Do a [li]ls -l /etc/alternatives/java[/li]. Based on prior diagnostics, this should be something like mine, /usr/lib/jvm/java-6-sun/jre/bin/java. If you're set up properly, java should be /usr/lib/jvm/java-6-sun/jre/bin/java.

However, you noted your java is /usr/lib/jvm/java-gcj/jre/bin/java. Oops, you have mismatches. Try this
ls -l /etc/alternatives/java*


Everything should map to a similar place. I'm betting it doesn't. Try removing all Java stuff. Go into synaptic, search on java, and take it all out.

Then, put back in sun-java6-sdk and sun-java6-jre. Then try the simple test program compile and run you tried before.

Good luck.



I see..
hereis the results of:ls -l /etc/alternatives/java

I get:/usr/lib/jvm/java-gcj/jre/bin/java

for ls -l /etc/alternatives/java*

I get:
lrwxrwxrwx 1 root root 34 2007-11-03 13:02 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java
lrwxrwxrwx 1 root root 40 2007-11-03 13:02 /etc/alternatives/java.1.gz -> /usr/lib/jvm/java-gcj/man/man1/java.1.gz
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javac -> /usr/lib/jvm/java-6-sun/bin/javac
lrwxrwxrwx 1 root root 52 2007-11-03 17:45 /etc/alternatives/javac.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/man/man1/javac.1.gz
lrwxrwxrwx 1 root root 14 2007-11-03 13:02 /etc/alternatives/javadoc -> /usr/bin/gjdoc
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javah -> /usr/bin/javah-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javah.1.gz -> /usr/share/man/man1/javah-cp.1.gz
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javap -> /usr/bin/javap-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javap.1.gz -> /usr/share/man/man1/javap-cp.1.gz
lrwxrwxrwx 1 root root 40 2007-11-03 17:45 /etc/alternatives/java-rmi.cgi -> /usr/lib/jvm/java-6-sun/bin/java-rmi.cgi
lrwxrwxrwx 1 root root 39 2007-11-01 14:28 /etc/alternatives/java_vm -> /usr/lib/jvm/java-6-sun/jre/bin/java_vm
lrwxrwxrwx 1 root root 38 2007-11-01 14:28 /etc/alternatives/javaws -> /usr/lib/jvm/java-6-sun/jre/bin/javaws
lrwxrwxrwx 1 root root 57 2007-11-01 14:28 /etc/alternatives/javaws.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/jre/man/man1/javaws.1.gz

Will now remove the main Java's although i see a lot of libraries i believe belong to Ubuntu, that have the suffix -java , i presume they stay... Here we go..



Bingo! removing Eclipse made it work..:

mark@mark-desktop:~/Java_stuff/javatest$ javac t.java
mark@mark-desktop:~/Java_stuff/javatest$ ls
test1.class t.java
mark@mark-desktop:~/Java_stuff/javatest$ java test1
Hello World!
mark@mark-desktop:~/Java_stuff/javatest$

Eclipse has it's own SDK..was conflicting with the one I installed..
Will now try installing netbeans..
Was This Post Helpful? 0
  • +
  • -

#15 mlytle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 03-November 07

Re: O.K. I am new to Java and sort of new to Linux

Posted 03 November 2007 - 10:18 PM

View Postmlytle, on 3 Nov, 2007 - 10:10 PM, said:

View Postmlytle, on 3 Nov, 2007 - 09:06 PM, said:

View Postbaavgai, on 3 Nov, 2007 - 08:03 PM, said:

Excellent, you're getting there. You can compile to a .class file but it doesn't run. Reasonably, your javac and your java are different versions.

Do a [li]ls -l /etc/alternatives/java[/li]. Based on prior diagnostics, this should be something like mine, /usr/lib/jvm/java-6-sun/jre/bin/java. If you're set up properly, java should be /usr/lib/jvm/java-6-sun/jre/bin/java.

However, you noted your java is /usr/lib/jvm/java-gcj/jre/bin/java. Oops, you have mismatches. Try this
ls -l /etc/alternatives/java*


Everything should map to a similar place. I'm betting it doesn't. Try removing all Java stuff. Go into synaptic, search on java, and take it all out.

Then, put back in sun-java6-sdk and sun-java6-jre. Then try the simple test program compile and run you tried before.

Good luck.



I see..
hereis the results of:ls -l /etc/alternatives/java

I get:/usr/lib/jvm/java-gcj/jre/bin/java

for ls -l /etc/alternatives/java*

I get:
lrwxrwxrwx 1 root root 34 2007-11-03 13:02 /etc/alternatives/java -> /usr/lib/jvm/java-gcj/jre/bin/java
lrwxrwxrwx 1 root root 40 2007-11-03 13:02 /etc/alternatives/java.1.gz -> /usr/lib/jvm/java-gcj/man/man1/java.1.gz
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javac -> /usr/lib/jvm/java-6-sun/bin/javac
lrwxrwxrwx 1 root root 52 2007-11-03 17:45 /etc/alternatives/javac.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/man/man1/javac.1.gz
lrwxrwxrwx 1 root root 14 2007-11-03 13:02 /etc/alternatives/javadoc -> /usr/bin/gjdoc
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javah -> /usr/bin/javah-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javah.1.gz -> /usr/share/man/man1/javah-cp.1.gz
lrwxrwxrwx 1 root root 17 2007-11-03 17:45 /etc/alternatives/javap -> /usr/bin/javap-cp
lrwxrwxrwx 1 root root 33 2007-11-03 17:45 /etc/alternatives/javap.1.gz -> /usr/share/man/man1/javap-cp.1.gz
lrwxrwxrwx 1 root root 40 2007-11-03 17:45 /etc/alternatives/java-rmi.cgi -> /usr/lib/jvm/java-6-sun/bin/java-rmi.cgi
lrwxrwxrwx 1 root root 39 2007-11-01 14:28 /etc/alternatives/java_vm -> /usr/lib/jvm/java-6-sun/jre/bin/java_vm
lrwxrwxrwx 1 root root 38 2007-11-01 14:28 /etc/alternatives/javaws -> /usr/lib/jvm/java-6-sun/jre/bin/javaws
lrwxrwxrwx 1 root root 57 2007-11-01 14:28 /etc/alternatives/javaws.1.gz -> /usr/lib/jvm/java-6-sun-1.6.0.00/jre/man/man1/javaws.1.gz

Will now remove the main Java's although i see a lot of libraries i believe belong to Ubuntu, that have the suffix -java , i presume they stay... Here we go..



Bingo! removing Eclipse made it work..:

mark@mark-desktop:~/Java_stuff/javatest$ javac t.java
mark@mark-desktop:~/Java_stuff/javatest$ ls
test1.class t.java
mark@mark-desktop:~/Java_stuff/javatest$ java test1
Hello World!
mark@mark-desktop:~/Java_stuff/javatest$

Eclipse has it's own SDK..was conflicting with the one I installed..
Will now try installing netbeans..



Netbeans installed! Looks Good!

baavgai, thanks very much for your patience and insight..I learned quite a bit here...and most important..it's working!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1