LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-08-2005, 07:58 PM   #1
papa Strumpf
LQ Newbie
 
Registered: Aug 2004
Location: Croatia
Distribution: Debian
Posts: 5

Rep: Reputation: Disabled
Java 1.5.0_04 extremely slow startup [SOLVED]


Hi,
I'm a PHP, Pascal and was a VisualBasic programmer (until I stopped using Windows)...
So considering the fact that I have all the time in the world (still in highschool) I decided to try java, but there is a huge problem:
Every, and I mean every java application I start loads abnormally slow.
NetBeans won't load and what's even worse is that java freezes firefox when it tries to load a java applet.
Therefore I came to the conclusion that something must be wrong with my system.
So I fired up Azureus and made a -verbose pass to java and this is what I've found out:

Azureus stops for at lease 5 minutes between this:
[Loaded sun.reflect.GeneratedMethodAccessor1 from __JVM_DefineClass__]
and this:
[Loaded sun.nio.ch.OptionAdaptor from /opt/jre1.5.0_04/lib/rt.jar]

And the question is...
Does anybody know why java starts so slow?

Thanks,
papa Strumpf

P.S.:
My system is an Athlon XP 3200+ with 512 MB of RAM
kernel is 2.6.12-1.1456_FC4 (yes, I'm using Fedora Core 4)

[SOLVED]
installing JRE 1.5.0_05 fixed the problem


Last edited by papa Strumpf; 10-24-2005 at 03:53 AM.
 
Old 10-09-2005, 05:55 PM   #2
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
First, did you read the FC4 release notes about java? Try that see what happens. No idea about FC4, but FC3 worked fine.

HTH
 
Old 10-09-2005, 08:06 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

That's definitely good detective work on your part, and it definitely sounds like you're encountering some kind of hang in sun.nio.ch.OptionAdaptor.

But I can't account for *why* it might be hanging (until it times out ... in 5 minutes ... 300 seconds ... a not uncommon timeout value in many different system- and application level networking/socket options).

I'm using JDK 1.5_04 on SuSE Linux, with and without Netbeans, and it works fine for me.

I'd suggest the following:

1. Completely uninstall your current JDK.
2. Reboot Linux, and reinstall (the current JDK 1.5_05 from Sun, if at all possible)
3. Make *sure* there are no other JDKs and/or JRE's in your path
4. See what happens.

For whatever it's worth, here's an "strace" of my starting a command-line "Hello world" (the startup and execution is basically immediate):
Code:
class hello {
  public static void main (String[] args) {
    System.out.println ("Hello Java!\n");
  }
}
Quote:
javac -version hello.java
javac 1.5.0_04
linuxdev2:/tmp # strace -c java hello
Hello Java!

% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
48.88 0.005967 6 1056 gettimeofday
12.75 0.001556 26 61 futex
6.20 0.000757 7 104 59 open
5.08 0.000620 19 33 read
4.71 0.000575 7 83 mmap2
4.05 0.000494 7 76 39 stat64
1.99 0.000243 5 50 lstat64
1.97 0.000241 121 2 write
1.90 0.000232 6 40 old_mmap
1.27 0.000155 6 26 munmap
1.16 0.000142 3 47 close
1.11 0.000136 10 13 madvise
1.09 0.000133 3 45 fstat64
1.03 0.000126 126 1 execve
0.87 0.000106 106 1 ftruncate
0.65 0.000079 79 1 unlink
0.61 0.000074 11 7 clone
0.52 0.000064 3 23 rt_sigaction
0.46 0.000056 14 4 getdents
0.40 0.000049 25 2 readlink
0.38 0.000046 5 9 mprotect
0.35 0.000043 3 15 rt_sigprocmask
0.27 0.000033 6 6 4 access
0.23 0.000028 28 1 connect
0.21 0.000026 26 1 sched_yield
0.20 0.000024 3 8 _llseek
0.16 0.000020 3 7 brk
0.16 0.000020 10 2 gettid
0.16 0.000019 3 6 6 sched_setscheduler
0.11 0.000014 4 4 uname
0.10 0.000012 6 2 _sysctl
0.10 0.000012 3 4 fcntl64
0.10 0.000012 12 1 socket
0.09 0.000011 3 4 getrlimit
0.07 0.000009 5 2 poll
0.07 0.000008 8 1 pread
0.07 0.000008 3 3 getuid32
0.06 0.000007 7 1 writev
0.05 0.000006 3 2 getgid32
0.05 0.000006 2 3 geteuid32
0.05 0.000006 6 1 recvmsg
0.04 0.000005 5 1 time
0.04 0.000005 5 1 1 mkdir
0.04 0.000005 5 1 getcwd
0.04 0.000005 3 2 getegid32
0.04 0.000005 3 2 set_thread_area
0.03 0.000004 2 2 set_tid_address
0.02 0.000003 3 1 setrlimit
------ ----------- ----------- --------- --------- ----------------
100.00 0.012207 1768 109 total
'Hope that helps .. PSM

Last edited by paulsm4; 10-09-2005 at 08:09 PM.
 
Old 10-10-2005, 10:05 AM   #4
papa Strumpf
LQ Newbie
 
Registered: Aug 2004
Location: Croatia
Distribution: Debian
Posts: 5

Original Poster
Rep: Reputation: Disabled
did it with JRE... doesn't work
I couldn't uninstall all java runtimes because of some dependencies (OO.org depends on gcj)
I, however, did try to load Azureus with Java being first in my PATH (just to make sure)... no, it didn't work.
Your HelloWorld program compiled and ran just fine... I guess there's a problem with interacting with X.
The strange this is that everything worked fine until I've upgraded to Fedora Core 4...
and before you blame it all on the FC4 team, Java runs just fine on my laptop with a fresh FC4 install

papa Strumpf
 
  


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
kernel 2.4.24 crash after 5-10 days running 1 java prog in JRE1.5.0_04 Yodagold Debian 0 11-08-2005 09:23 AM
java programs (LimeWie, Azureus etc) loading extremely slow rutgerw Linux - Software 1 11-08-2005 07:28 AM
Java 1.5.0_04 papa Strumpf Fedora 1 09-27-2005 04:47 AM
plugin for java jre1.5.0_04 on Redhat 9 Peter Shepard Red Hat 1 08-21-2005 12:31 AM
K3B Extremely Slow Startup K3yMaster Linux - Software 0 10-10-2003 03:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:59 AM.

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