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.
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.
what directory have you entered into the Netbeans preferences page?
Created attachment 33377 [details] screenshot of my path
Created attachment 33378 [details] screenshot of my path
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!
Created attachment 33385 [details] JAR library for student programs - KarelJRobot.jar (free)
Created attachment 33386 [details] Sample BlueJ project that requires the JAR library
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.
On step #4 of the last comment, where I said, "but now do it in...", I meant to say Netbeans. Sorry, and thanks again.
"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.
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.
merged to release55bluej branch.