This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 58884 - Fatal Error: Unable to find package java.lang in classpath
Summary: Fatal Error: Unable to find package java.lang in classpath
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Platform (show other bugs)
Version: 4.x
Hardware: PC All
: P4 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2005-05-13 16:52 UTC by David Botterill
Modified: 2017-05-15 09:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Full IDE Log (68.09 KB, text/plain)
2005-09-08 08:02 UTC, vnicolici
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Botterill 2005-05-13 16:52:40 UTC
I frequently get the following exceptions even after clearing out my var/cache:

org.netbeans.lib.java.parser.CompilerException: Fatal Error: Unable to find
package java.lang in classpath or bootclasspath
        at org.netbeans.lib.gjast.ASErrorChecker.parse(ASErrorChecker.java:59)
        at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.initCheck(ResourceImpl.java:1428)
        at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.size(ResourceImpl.java:1440)
        at
org.netbeans.modules.java.JavaEditor.refreshAnnotations(JavaEditor.java:389)
        at org.netbeans.modules.java.JavaEditor.access$300(JavaEditor.java:83)
        at org.netbeans.modules.java.JavaEditor$16.run(JavaEditor.java:1416)
        at org.openide.util.Task.run(Task.java:189)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721)


This was after a fresh install of 4.1 pointing to JDK 1.5.02.

java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)
Comment 1 Tomas Zezula 2005-05-16 10:01:41 UTC
What kind of project do you use?
Do you see the rt.jar under the Libraries node?
Is java.lang package under the rt.jar in the Libraries node?
Comment 2 David Botterill 2005-05-16 19:48:48 UTC
I'm using the "module project" (API Support Module).  I don't have a "Libraries"
node in this project type.
Comment 3 Jan Lahoda 2005-05-16 21:18:53 UTC
I have seen similar problem. I think that the problem is this:
The API Support's project selects the platform as follows:
a) find some platform with version ${javac.source} (default javac.source is 1.4).
b) if no platform is found in step a), select default platform.
The platform chosen in step a) is not tested to be valid. If an invalid (removed
from disk) platform is chosen, the exception occurs (in the log).

As a workaround, please go to Tools/Java Platform Manager, remove all invalid
platforms and create a valid one for required javac.source.

Does this help?
Comment 4 David Botterill 2005-05-17 00:54:05 UTC
I did have an invalid java platform reference.  I've removed the invalid
reference and will watch to see if I get the error again.  I usually only see it
when I exit the IDE and come back in.
Comment 5 Jesse Glick 2005-05-17 01:30:22 UTC
Platform manager should remove anything which is not valid.
Comment 6 Tomas Zezula 2005-05-17 08:52:43 UTC
I don't agree that Platform Manager should remove broken platforms. The better
solution is to have isValid () method on the JavaPlatform.
Comment 7 vnicolici 2005-08-29 17:27:56 UTC
I'm also having this problem, on NetBeans 4.1, JDK 1.5.0_04, Windows XP SP2.

I don't have any invalid platforms and I'm working with a free-form web-app 
project, so I don't have any library node

Auto-complete doesn't work, and deleting the cache doesn't help. And I can't 
delete the JDK 1.5 platform, since it's the default platform.

The error is:

Using 'jar:file:/C:/Program%20Files/Java/jdk1.5.0_04/jre/lib/rt.jar!/' pre-
parsed database!
Using 'jar:file:/C:/Program%20Files/Java/jdk1.5.0_04/src.zip!/1.5' pre-parsed 
database!
[org.netbeans.javacore] INFORMATIONAL *********** Exception occurred 
************ at 7:14 PM on Aug 29, 2005
org.netbeans.lib.java.parser.CompilerException: Fatal Error: Unable to find 
package java.lang in classpath or bootclasspath
	at org.netbeans.lib.gjast.ASErrorChecker.parse(ASErrorChecker.java:59)
	at 
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.initChec
k(ResourceImpl.java:1428)
	at 
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl$ErrorList.size
(ResourceImpl.java:1440)
	at org.netbeans.modules.java.JavaEditor.refreshAnnotations
(JavaEditor.java:389)
	at org.netbeans.modules.java.JavaEditor.access$300(JavaEditor.java:83)
	at org.netbeans.modules.java.JavaEditor$16.run(JavaEditor.java:1416)
	at org.openide.util.Task.run(Task.java:189)
	at org.openide.util.RequestProcessor$Task.run
(RequestProcessor.java:330)
	at org.openide.util.RequestProcessor$Processor.run
(RequestProcessor.java:721)
Caused by: com.sun.tools.javac.util.FatalError: Fatal Error: Unable to find 
package java.lang in classpath or bootclasspath
	at com.sun.tools.javac.comp.MemberEnter.importAll(MemberEnter.java:120)
	at com.sun.tools.javac.comp.MemberEnter.visitTopLevel
(MemberEnter.java:503)
	at com.sun.tools.javac.tree.Tree$TopLevel.accept(Tree.java:390)
	at com.sun.tools.javac.comp.MemberEnter.memberEnter
(MemberEnter.java:383)
	at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:777)
	at com.sun.tools.javac.code.Symbol.complete(Symbol.java:355)
	at com.sun.tools.javac.code.Symbol$ClassSymbol.complete
(Symbol.java:614)
	at com.sun.tools.javac.comp.Enter.complete(Enter.java:448)
	at com.sun.tools.javac.comp.Enter.main(Enter.java:426)
	at org.netbeans.lib.gjast.ASErrorChecker.compile
(ASErrorChecker.java:173)
	at org.netbeans.lib.gjast.ASErrorChecker.parse(ASErrorChecker.java:56)
[catch] ... 8 more
Comment 8 vnicolici 2005-08-30 09:26:48 UTC
At the time the error occurred, I had 15-20 projects opened simultaneously, 
and each project had 40-50 entries in Java Sources Classpath and/or the Web 
Sources Classpath.

After closing all projects except one, removing all entries from the 
classpaths of the remaining project, and restarting the IDE, auto-complete 
started working again.

I'll get back if I find the exact project or classpath entry that causes the 
problem.
Comment 9 vnicolici 2005-09-07 18:07:32 UTC
I'm still having this problem, and another developer from my team that uses NB 
4.1 also has this problem.

I was unable to locate a specific classpath entry that causes this issue, and 
the only workaround is to close the project, close the IDE, delete 
the /var/cache folder, start the IDE, reopen the project.

But, after about 5 minutes, the problem reappears.

I have about 60 jars and 10 directories in classpath. When I have less entries 
in classpath, it takes more time to reproduce the problem.

This is a show-stopper for me. And I'm seriously thinking about downgrading to 
NB 3.6 if this bug is not fixed soon.
Comment 10 Martin Matula 2005-09-07 21:53:36 UTC
Why is this a showstopper for you? What key functionality breaks when these
exceptions start to appear in the console? Could you please provide the whole
messages.log as an attachment to this issue? (located in /var/log)
Comment 11 Tomas Zezula 2005-09-08 07:50:32 UTC
It is strange that erasing the var/cache helps. The exception is thrown when the
javac (used to finding errors in the file) cannot find the rt.jar on the project
bootpath, it is strange that path to rt.jar is invalid and becomes valid after
restart.
The erasing of var/cache should not have effect on this behavior.
Comment 12 vnicolici 2005-09-08 08:02:51 UTC
Created attachment 24595 [details]
Full IDE Log
Comment 13 vnicolici 2005-09-08 08:15:22 UTC
This is a show-stopper for me, because code completion stops working.
Comment 14 vnicolici 2005-09-08 08:27:24 UTC
After taking a second look at messages.log, I think that my code completion 
problem could also be related to issue 61102 (java.lang.Exception: 
rollback!!!).
Comment 15 Martin Matula 2005-09-08 08:47:29 UTC
Weird. From the messages.log it seems your project is broken in some way. Could
you please give us more info about your project setup? Do you keep class files
in the same directory as the sources? Code completion for which classes stops
working? Does the code completion for the JDK classes ever work?
Instead of downgrading to NB 3.6, could you try to upgrade to one of the
q-builds or dev builds of NB 5.0 (formerly 4.2), see if you can reproduce it
there and send us fresh logs if so?
Comment 16 vnicolici 2005-09-08 09:11:20 UTC
My project is a "Web Application with Existing Ant Script", the Web Pages are 
stored in the project root. The Java sources and the class files are stored in 
WEB-INF/classes.

The code completion stops working for the JDK classes, including java.lang.*, 
and also for the jars and directories from "Java Sources Classpath". However, 
it works for the methods/fields defined in the source file I'm currently 
editing.

I will try to reproduces the problem with NB 5.0.
Comment 17 vnicolici 2005-09-08 09:14:42 UTC
And after cleaning /var/cache and closing and opening the project, code 
completion works fine a few minutes, for all classes (classpath, JDK, WEB-
INF/classes).
Comment 18 Martin Matula 2005-09-08 09:19:55 UTC
Is the cleaning of /var/cache significant? Doesn't it work even without it
(after you close and reopen the project and restarting netbeans)?
Try to identify what do you do just before the problems start to occur. Could
this be related to building the project? (i.e. when all works after cleaning
/var/cache and restarting netbeans, does it break again after you do a clean
build of your project?) Or can you see some other action that seems to initiate
these problems?
Comment 19 Jan Lahoda 2005-09-08 09:24:45 UTC
Re Web freeform project problems: it seems to me that you are experiencing issue
#59031.
Comment 20 Tomas Zezula 2005-09-08 09:39:19 UTC
As far as I know there was some problem in the freeform project regarding the
platform which Honza already fixed in the NB 5.0. Can you try some NB 5.0 q-build?
Honzo can you evaluate this?
Comment 21 vnicolici 2005-09-08 11:07:59 UTC
Yes, it seems to be issue #59031 .

I didn't notice the "updates available" icon in the lower right corner of the 
IDE (I expected to see a pop-up window when updates are available), so I 
didn't have the hot-fix installed. Now I installed the hot-fix, and I hope the 
problem is gone.

Sorry for the confusion.
Comment 22 Tomas Zezula 2005-12-07 15:44:11 UTC
Works in NB 5.0
Comment 23 SignalProcedures 2017-05-12 16:07:20 UTC
It's the case in Netbeans 8.2 on Raspbian Jessie .This Fatal Error appears after install properly JDK and JavaME SDK any help on this forum? thanx
Comment 24 Tomas Zezula 2017-05-15 09:04:37 UTC
In reply to comment #23:
Please create a new issue. This issue is already invalid (it's for NetBeans 5.0) and the code in the issue is no more contained in the product.
Please create a new issue with IDE version and valid stack trace.
Thanks!