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 83714 - Loading JAR files from BlueJ into classpath for Netbeans doesn't work
Summary: Loading JAR files from BlueJ into classpath for Netbeans doesn't work
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: BlueJ (show other bugs)
Version: 5.x
Hardware: All Mac OS X
: P2 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-29 17:28 UTC by jmorin3
Modified: 2007-02-20 10:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot of my path (56.70 KB, application/pdf)
2006-08-29 20:35 UTC, jmorin3
Details
screenshot of my path (56.70 KB, image/png)
2006-08-29 20:35 UTC, jmorin3
Details
JAR library for student programs - KarelJRobot.jar (free) (157.50 KB, application/octet-stream)
2006-08-30 04:00 UTC, jmorin3
Details
Sample BlueJ project that requires the JAR library (2.90 KB, application/octet-stream)
2006-08-30 04:01 UTC, jmorin3
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jmorin3 2006-08-29 17:28:14 UTC
Under BlueJ, JAR files can be added by putting them in the default directory. 
On Mac OS X, it is /Applications/BlueJ-2.13/Contents/Resources/Java/userlib. 
Netbeans indicated in Preferences -> BlueJ that it will load those JAR files
into the classpath from the BlueJ root directory.  However, when trying to
compile a class that requires code from a JAR file library(like KarelJRobot or
Objectdraw), the code works in BlueJ but not in Netbeans.

Thanks for looking into this, as it may be something that could have been easily
forgotten in testing.  I can't get JAR file libraries to load in the classpath
for *Empty BlueJ Projects* (which is all I tell students to use).

Basically a project that compiles in BlueJ will not compile under Netbeans with
no changes to the source **if** a JAR file is required for class definitions. 
If there is any other way to use a JAR with a BlueJ project (not a Netbeans
project), please indicate how as the documentation left that out.
Comment 1 Milos Kleint 2006-08-29 19:46:32 UTC
what directory have you entered into the Netbeans preferences page?
Comment 2 jmorin3 2006-08-29 20:35:16 UTC
Created attachment 33377 [details]
screenshot of my path
Comment 3 jmorin3 2006-08-29 20:35:32 UTC
Created attachment 33378 [details]
screenshot of my path
Comment 4 jmorin3 2006-08-29 20:59:56 UTC
The path is /Applications/BlueJ-2.1.3/BlueJ.app/Contents/Resources/Java/userlib.
 That is the standard path for Jar files in BlueJ on a Mac, though I added the
hyphen in the BlueJ folder so there are no spaces.

I have JAR user libraries there for BlueJ, like apcslib.jar, chnutil.jar, and
others.  On some machines we also have KarelJrobot.jar and objectdraw.jar in
that location.     

To try to reproduce the error:

1.  you'll need to get a JAR user library of any kind.  There are a ton on the
web out there for education. KarelJrobot.jar is free and sample code is
available.  Look for it using any search engine.
2.  Get that user library working under BlueJ by putting it in the default
location for user libararies. 
/Applications/BlueJ-2.1.3/BlueJ.app/Contents/Resources/Java/userlib.
  
3.  Most websites that provide user libraries also post sample code too. 
Compile and execute it on BlueJ first.
4.  Have Netbeans point to the directory where the JAR file exists in BlueJ.  In
netbeans, go to prefences->bluej and tell it the path where BlueJ keeps "userlib"
5.  Open the project you just tested in BlueJ, but now open it under Netbeans. 
Netbeans opens BlueJ projects.  The code you open needs to depend on a user
library of some kind.
6.  The code that worked on BlueJ (step 3), won't work on Netbeans.  It can't
find the file, even when I point to it carefully.

Hope this helps.  I am impressed by your fast response!
Comment 5 jmorin3 2006-08-30 04:00:21 UTC
Created attachment 33385 [details]
JAR library for student programs - KarelJRobot.jar (free)
Comment 6 jmorin3 2006-08-30 04:01:02 UTC
Created attachment 33386 [details]
Sample BlueJ project that requires the JAR library
Comment 7 jmorin3 2006-08-30 04:04:39 UTC
I just attached a sample test case so that you can try to reproduce what I am
seeing.

The last two attachments includes a zipped folder of (a) source code in BlueJ
for a introductory student programming assignment that requires a JAR library,
and (b) the KarelJRobot JAR file. (also attached).  
 
1.  Download the JAR file and install it into the directory of BlueJ where
"userlib" is stored.  On a Mac you need to ctrl-click the BlueJ.app and hit
"Show package contents".  Navigate to "userlib" and drop the JAR file there. 
Restart BlueJ if it is running.
2.  Download the sample source codeand open it on BlueJ.  The source code
requries the JAR file is installed to run.  BlueJ can execute the file sample
source code.
3.  Open Netbeans and under Preferences -> BlueJ, have it point to the BlueJ
root directory for the classpath.  Restart Netbeans.  (Note: I renamed my BlueJ
directory with a hyphen so there would not be anymore spaces in folders.)
4.  Open the project you just had working on BlueJ, but now do it in BlueJ.  Try
compiling it on Netbeans BlueJ edition. 

I imagine the absolute hardest part of software testing is reproducing a user's
problem, so I am just trying to help out by providing these files as examples. 
Hopefully you can see what I am experiencing with these instructions.

Thank you.
Comment 8 jmorin3 2006-08-30 04:06:37 UTC
On step #4 of the last comment, where I said, "but now do it in...", I meant to
say Netbeans.  Sorry, and thanks again.
Comment 9 Milos Kleint 2006-08-30 07:15:20 UTC
"a screenshot speaks as thousand words"

What is meant to be entered in the preferences page, is only the location of the
Bluej app. Eg. in my case /Application/BlueJ, in your case
/Application/BlueJ-2.13/BlueJ I suppose.

However I figured that if the project is already opened and you change the
preferences value afterwards it won't influence the opened projects.
Closing/opening helps for compilation, but Code completion is still wrong. A
sure shot is to restart the IDE after changing the bluej home location.

i'll see what can be done, we probably can push the fix out through the update
center.
Comment 10 Milos Kleint 2007-02-02 11:36:09 UTC
both issues should be fixed now in cvs trunk (6.0 compatible). The build script
updated correctly and also the classpath.

could be backported to 5.0/5.5 if necessary.
Comment 11 Milos Kleint 2007-02-20 10:18:08 UTC
merged to release55bluej branch.