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.
There should be a way to change the bootclasspath of a project (or even for each Java platform...), instead of using the default one. I want to compile some Java Card code and I wanted to set the bootclasspath to its corresponding JARs, so javac doesn't compile my code if I use JSE specific classes. I think I can do it altering the compiling parameters, on the project's properties (-bootclasspath ...), but I think there should be a better way of doing it.
I agree, and I think this is important for supporting things like Android. I think this would be pretty easy to implement in j2seproject and the other project types. We'd need to: 1. Change each project type's build-impl.xsl target "-init-macrodef-javac" to include a bootclasspath option, read from some optional project property. 2. Read that property also from the BootClassPathImplementation.java. For example, the current code for o.n.m.java.j2seproject.classpath.BootClassPathImplementation.getResources() reads thusly: JavaPlatform jp = findActivePlatform (); final List<PathResourceImplementation> result = new ArrayList<PathResourceImplementation>(); if (jp != null) { //TODO: May also listen on CP, but from Platform it should be fixed. final ClassPath cp = jp.getBootstrapLibraries(); assert cp != null : jp; for (ClassPath.Entry entry : cp.entries()) { result.add(ClassPathSupport.createResource(entry.getURL())); } } This entire block should be run only if bootclasspath project property is undefined. Otherwise, just load from the property.
Created attachment 55015 [details] Proposed patch for j2seproject
Turned out to be a really small change :) With the attached patch, I can add "bootclasspath=/path/to/android.jar" to a project's nbproject/project.properties and the editor and and scripts will both do the right thing. Removing the bootclasspath definition causes the project to act the same way it did without the patch.
There is already a property called platform.<name_of_platform>.bootpath which is used for it, unfortunately there is no UI customization, maybe it will be needed. By the way there is a full featured NetBeans project type for the Android platform, I will find the site with this module and let you know.
I don't particularly care if there's a GUI for platform.<name_of_platform>.bootpath. However, even when I change the property and restart NB, the Java Platform Manager still shows the original rt.jar, etc. It looks like org.netbeans.modules.java.j2seplatform.platformdefinition.DefaultClassPathProvider doesn't take this property into account. It always gets its COMPILE classpath using GlobalPathRegistry.getDefault().getPaths(ClassPath.COMPILE). Thus, j2seproject's BootClassPathImplementation doesn't pick up on it. I may be reading this wrong, though, as I haven't done a deep dive through all the code yet.
I would like to bring some attention to this old issue. Currently no project type seems to support the customization of the bootclasspath. Everyone that attempts to provide a custom bootclasspath would have to reimplement the j2se project type it seems. Or come up with a custom java platform and a plugin that makes NetBeans recognize it. Projects like leJOS and the NBAndroid project had to build a new project type while a bootclasspath configuration would have provided the option to extend the j2se project type instead. From what I understand reading up NetBeans developer information developers should extend project types if possible. But having no control over the bootclasspath is a roadblock for customized Java platforms.
Related to https://netbeans.org/bugzilla/show_bug.cgi?id=223682 ?
(In reply to markiewb from comment #7) > Related to https://netbeans.org/bugzilla/show_bug.cgi?id=223682 ? I would say yes. But for JavaSE project type.