blob: 896b9e44f4b7ac0003f7ecdb957420550a7dc26d [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= DevFaqNetBeansPlatformManager
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqNetBeansPlatformManager
:description: Apache NetBeans wiki DevFaqNetBeansPlatformManager
:toc: left
:toc-title:
:syntax: true
=== How do I set up a NetBeans Platform in the IDE
By default, a NetBeans Platform application will use the developer's copy of the IDE as the platform. This is certainly easy, but there are also link:http://wiki.netbeans.org/DevFaqGeneralWhereIsPlatformHowToBuild[drawbacks to using the current IDE as a platform]. With that in mind, lets check out, and reference our own copy of the NetBeans source code. This way we can also use breakpoints to step through the NetBeans source code, make changes, and create patches!
At a high level the steps are as follows. First get the NetBeans source code checked out. This part is interesting because what you end up with is a complete copy of the NetBeans source repository on your local file system. The second thing you need to do is build the NetBeans platform using the source repository that you just checked out. This is important because without building the platform you will not have the dependencies required by the platform modules. The next step is to create a new platform reference. Of course the platform to reference will be the one that you just checked out and built. Then finally, in your module suite's project properties, select the platform reference that you just created.
So, in more detail then...
==== 1. Check Out NetBeans Source Code
First link:HgNetBeansSources.asciidoc[get the source code] from the Mercurial repository. In the following example the source code is checked out to a local ~/netbeans-repository/ directory. In this example the tilde is used to represent the home directory of your file system.
So far, so good, but you still need to build the source code so that you have a complete NetBeans Platform, along with all the jar dependencies.
==== 2. Build The NetBeans Source
Building the NetBeans source is very easy, and very satisfying to watch! Just open up your favorite terminal client and navigate to your local repository.
[source,java]
----
cd ~/netbeans-repository/main/
----
Set the available memory that Ant can use:
[source,java]
----
set ANT_OPTS=-Xmx256M
----
(or on Unix, `export ANT_OPTS=-Xmx256M`)
Then simply run ant.
[source,java]
----
ant -Dpermit.jdk6.builds=true
----
Note, I am choosing to build NetBeans using JDK1.6 so I have to explicitly tell NetBeans that I understand that only JDK1.5 is supported. As of NetBeans 6.9, NetBeans is built with JDK 6, and this flag is no longer needed.
==== 3. Create A New Platform Reference In NetBeans
In order to work with the NetBeans platform that you just built it needs to be added as a platform in the IDE.
1. Click Tools -> NetBeans Platforms (note that the menu item name varies slightly in older versions)
[start=2]
. Click the "Add Platform..." button in the lower right
[start=3]
. Locate the platform binary and click OK. In this example the proper path is ~/netbeans-repository/main/nbbuild/netbeans/.
[start=4]
. You can associate sources and javadoc for this platform using the respective tabs in the platform manager
[start=5]
. You can also choose which version of the build scripts you want to us on the Harness tab. You'll usually want to use the version corresponding to that platform.
==== 4. Reference The New NetBeans Platform
Now just select the platform in your module suite's Project Properties. There you will see a Netbeans Platform dropdown box where you can select the platform that you set up.
_Note: I did have to go through and resolve some of the cluster dependencies. That just means that I had to check the dependencies that Netbeans said that other modules needed. Once you get this far it will be very obvious what to do._
==== Appendix: NetBeans Platform And Using JDK1.6
In order to use JDK1.6 with the Netbeans source code we need to tell the Netbeans platform that we understand that only JDK1.5 is supported. What you need to do is create a "user.build.properties" file and put it in the nbbuild directory.
[source,java]
----
touch ~/netbeans-repository/main/nbbuild/user.build.properties
----
Inside the user.build.properties file put the following line.
[source,java]
----
permit.jdk6.builds=true
----
_This tutorial applies to: versions 6.7 and earlier of the NetBeans Java IDE. _
=== Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.
This page was exported from link:http://wiki.netbeans.org/DevFaqNetBeansPlatformManager[http://wiki.netbeans.org/DevFaqNetBeansPlatformManager] ,
that was last modified by NetBeans user Tboudreau
on 2010-01-24T05:10:20Z.
*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.