LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-26-2003, 07:34 AM   #1
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Rep: Reputation: 30
Java2 SDK doesn't work?


I've successfully installed Java2 SDK on Debian, however when i start it I get this error:

ganni@debian:~$ javac dummyfile.java
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

ganni@debian:~$ javac -v
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object


I've had successfully used the j2sdk on other distros such as Redhat.. Does this mean that it is not compatible with Debian? I've installed the j2sdk_1.4.2_02-1_i386.deb package (converted by means of alien).

Thanks a lot. Ganninu.
 
Old 10-26-2003, 10:12 AM   #2
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
Use the J2SDK directly from Sun instead, it always works fine for me. I have copied-and-pasted my reply to a similar question on the knoppix.net forums below.

Quote:
Sun does not use an open license for Java so it is not included with the official Debian archives, so you can't apt-get install with a stock /etc/sources.list file.

However, the Blackdown project (blackdown.org) provides Java packages for Debian (and many others). These are not very up to date (usually) so I just download the Java SDK (not the JRE!) from Sun and install it.

Here's how you do it:

1. Download the "Linux self-extracting file" package from http://java.sun.com/j2se/1.4.2/download.html

2. Create a directory for Java related stuff under /usr/local:
$ cd /usr/local
$ su (enter password for root, note that the prompt changes when you're root)
# mkdir java
# cd java

3. Then you need to run the file. With this file you can do it like this:
# sh j2sdk-1_4_2_01-linux-i586.bin
....or like this:
# chmod +x j2sdk-1_4_2_01-linux-i586.bin (this makes the file executable)
# /home/hw/downloads/j2sdk-1_4_2_01-linux-i586.bin (execute it - run this from the /usr/local/java directory)

4. Now it's installed. Still, the java and javac commands won't work from the command line because the /bin subdirectory from the SDK isn't in the path. We need to add them somehow. There are many different ways of doing this but this is how I usually do it:
Edit /etc/profile (as root) with your favourite text editor. There should be a line that specifies directories that contain executables and should be added to the PATH environment variable. Something like this:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"
The directories are separated by colons(. Add a colon at the end of the line (but before the closing quote) and add the Java bin directory. If you followed my outline above it should be /usr/local/java/j2sdk1.4.2/bin/.
Now the line looks like this:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/java/j2sdk/bin"
Save the file!

Either log out and log in again or do a "source /etc/profile" to let the changes take effect. Type "javac" at the shell prompt and you should see the exact same thing as you see on Windows!
Håkan
 
Old 10-26-2003, 10:39 AM   #3
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
Well, before commencing any further - that was exactly what i have done, with the difference that the bin file extracted an RPM which i converted to a DEB package by using alien. Then I've installed it using dpkg -i, and of course, set the correct PATH... I'll try to download the non-RPM version... Let you know if that was the problem.

Last edited by ganninu; 10-26-2003 at 10:41 AM.
 
Old 10-26-2003, 11:06 AM   #4
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
..As predicted - the problem was that I've installed the RPM version...
 
Old 09-13-2005, 03:13 PM   #5
Bresenham
LQ Newbie
 
Registered: Sep 2005
Location: Lisboa/Beja, Portugal
Distribution: Ubuntu 5.10
Posts: 3

Rep: Reputation: 0
Greetings.

Well, I've done that but i still can't use javac anywhere.
I need to be in /usr/local/java/jdk1.5.0_04/bin and type "./javac" instead of just "javac".
Here's (the interesting part of) my /etc/profile:

if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/java/jdk1.5.0_04/bin"

Shall I insert the path of java in the "if" line or is it ok only in the "else" line?
If it's not that, then what must I do?

Thanks for help, stay well.

Last edited by Bresenham; 09-13-2005 at 03:16 PM.
 
Old 09-13-2005, 04:36 PM   #6
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 51
if you don't mind blackdown jvm which is working very well , do the following :
Code:
echo 'deb http://metalab.unc.edu/pub/linux/dev...wn.org/debian/ testing non-free'>> /etc/apt/sources.list;apt-get update && apt-get install j2sdk1.4;
See if it works
Code:
#java -version
java version "1.4.2-02"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-02)
Java HotSpot(TM) Client VM (build Blackdown-1.4.2-02, mixed mode)
#javac -v
javac: invalid flag: -v
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
  -sourcepath <path>        Specify where to find input source files
  -bootclasspath <path>     Override location of bootstrap class files
  -extdirs <dirs>           Override location of installed extensions
  -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
  -help                     Print a synopsis of standard options
BTW, jdk 1.5 is fine too... add it to your path in the file /home/username/.bash_profile
 
Old 09-13-2005, 04:55 PM   #7
dastrike
Member
 
Registered: Apr 2004
Location: Stockholm, Sweden
Distribution: Debian 'sid'
Posts: 250

Rep: Reputation: 30
See these instructions that I have written:
Java JRE/JDK Installation on Debian
 
Old 09-13-2005, 05:32 PM   #8
Bresenham
LQ Newbie
 
Registered: Sep 2005
Location: Lisboa/Beja, Portugal
Distribution: Ubuntu 5.10
Posts: 3

Rep: Reputation: 0
Greetings.

Thanks for the quick awnsers!

Well, it's already working! I tried what mrcheeks said and now it seems to be working good. Thanks a lot!
Also, dastrike, nice stuff you have there, I can definitly see the symlink thing work.

Thanks a lot, stay well!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java2 SDK (1.4.1 or higher) need to Install cherokee10 Linux - Newbie 3 02-01-2005 07:35 AM
How to Install java2 sdk on a remote Red Hat 9 Machine? shelldinesh Linux - Software 0 10-06-2004 11:54 AM
Installing Java2 RE from .bin GT I.N.C Linux - Newbie 51 12-23-2002 11:16 PM
limewire + java sdk + mandrake8.2 = not work :0 tulip#5 Linux - Software 2 11-13-2002 11:13 PM
Installed Java2 SDK bkxsammy Programming 5 11-11-2002 01:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration