Bug 24164 - Cannot use a specif rt.jar for a specific Java project
Summary: Cannot use a specif rt.jar for a specific Java project
Status: RESOLVED DUPLICATE of bug 22754
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-26 17:35 EDT by Gary Gregory CLA
Modified: 2002-09-27 13:49 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Gregory CLA 2002-09-26 17:35:39 EDT
Build 2.1 M1.

I have one project that I only want to compile and run with JRE 1.3.1_04 and 
one other project that I only want to compile and run with JRE 1.4.0_02.

I cannot do this without much effort:

I created a new project "Test on 1.4.0" and added C:\Java\j2sdk1.4.0_02
\jre\lib\rt.jar to that project's class path. When I run a program, I get:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

If I change the classpath to remove the rt.jar and instead add JRE_LIB AND my 
default JSDK to 1.4.0 (in eclipse/Preferences/Java/Installed JREs then 
everything works fine.

Same song and dance with a project called "Test on 1.3.1"

This is obviously no good since it forces me switch the default JRE to get a 
given project working.

(I am running e on top of 1.4.1_02)

Thank you,
Gary
Comment 1 Philipe Mulet CLA 2002-09-27 05:08:42 EDT
The JRE_LIB variable is a global variable of the workspace, it is bound to the 
default JRE (checked JRE in Installed JRE preference page).

In 2.0, we added a new concept which can address your issue: a classpath 
container. A classpath container can be used to denote a set of entries (e.g. 
multiple JARs) and can have a custom value for each project.

JRE containers are provided, you simply need to use them on your project build 
path, instead of using JRE_LIB variable entries. You will find containers under 
the library pane of the Java build path preference page, press [Advandced], 
then select option "Add Container" --> JRE System, you can then select which 
flavor you want to use (Default, or a custom one). 

Is it ok to close?
Comment 2 Philipe Mulet CLA 2002-09-27 10:08:53 EDT
Closing, please reopen if necessary.
Comment 3 Philipe Mulet CLA 2002-09-27 10:09:08 EDT
Closing
Comment 4 Philipe Mulet CLA 2002-09-27 10:09:57 EDT
Dup
Comment 5 Philipe Mulet CLA 2002-09-27 10:10:21 EDT

*** This bug has been marked as a duplicate of 22754 ***
Comment 6 Gary Gregory CLA 2002-09-27 13:49:17 EDT
Thank you for the tip! That did it. IMHO, this was not clear at all from the 
UI. Please consider changing this bug report to UI or docs such that e points 
out how to do this task. I, of course, have never looked at the e docs so 
perhaps the UI could be improved.

Please consider: 

Yes, this feature is generally speaking in the exact place I would look for it: 
in the Properties dialog of the Project I am working on under "Java Build 
Path", so far so good. The problem comes when I see THREE buttons called "Add 
xxx" that could all do the job that I want. 

After all, is it not a sensible thing to click the "Add External Jars..." 
button and then add the rt.jar file from a given JSDK? 

When I do that and I get a ...
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
... I get confused! How do I know that the solution is to add a "Container" 
under "Advanced..."? 

From a UI stand point, I think that the feature to use "Properties/Java Build 
Path/Advanced/click radio/Choose drop down/click ok button/choose JDSK in list 
box" to way too DEEP: 7 steps! Let be fair and start at "Java Build Path": 5 
steps.

Suggestion: I would like the e team to consider the following. Make 
the "Advanced" dialog better by adding radio buttons for "Add JRE System 
Library" and whatever else comes with e out of the box. Then under the radio 
button for "Add JRE System Library", you can have the drop down list of JREs. 
Much more compact, less UI steps in fewer UI components:

Example "improved" Advanced dialog:

o Create New Class Folder
o Add Existing New Class Folder
o Add JRE System Library
   [ListBox] "Add..." button
(other choices?)
o Add Container...
   [ListBox]

Now I have access to the feature, right THERE in THAT dialog. Pow. I can SEE it.

When I first opened that dialog, the list box was disabled, which grayed out 
the text and made it hard to notice that the feature was there. I did not.

If adding a JRE lib with add external Jar is not how to do that, then do not 
let me do it. That is what really makes things confusing!

Thank you for considering this, 
Gary