Showing posts with label netbeans. Show all posts
Showing posts with label netbeans. Show all posts

Thursday, May 22, 2014

Getting rid of "not enough memory to compile in netbeans 7"

This can be changed in the netbeans.conf file :
Navigate to /etc/ directory in your netbeans installation directory:
Open the file netbeans.conf and look for a line like this:

  1. netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

Add VM parameter's here:
-J-Xmx512M//512MB memory in this case
Like this:
  1. netbeans_default_options="-J-client -J-Xss2m -J-Xms512m -J-Xmx512M -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
Save and close the file.Restart netbeans.

Sunday, May 11, 2014

Getting rid of "java.lang.OutOfMemoryError: PermGen space" in Netbeans 7

In Netbeans 7.4 right click your tomcat server instance and choose properties in Services->Servers task pane:
Select the Platform tab and in the VM Options field set Permgen parameter.Put this code:
  1. -XX:PermSize=512m //512MB memory in this case
And click close.
If this still doesn't work.You can change netbeans.conf file :
Navigate to /etc/ directory in your netbeans installation directory:
Open the file netbeans.conf and look for a line like this:

  1. netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

Add permgen parameter's here:
-J-XX:PermSize=512m -J-XX:+CMSClassUnloadingEnabled
Like this:
  1. netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=512m -J-XX:+CMSClassUnloadingEnabled -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
Save and close the file.Restart netbeans.

Tuesday, April 22, 2014

Getting started with Google App Engine Java SDK with Netbeans 7.2 / Netbeans 7.4

Download the SDK:

1. Download app engine java sdk from https://developers.google.com/appengine/downloads:
https://commondatastorage.googleapis.com/appengine-sdks/featured/appengine-java-sdk-1.9.5.zip

extract (e.g. into /usr/local/gae/)

Install Google App Engine NetBeans Plugin:

  1. Start NetBeans
  2. Make note of NetBeans version number
  3. Click Tools -> Plugins
  4. Select the Settings tab
  5. Click the Add button
  6. Type “App Engine” (without the quotes) into the Name field
  7. Paste https://kenai.com/projects/nbappengine/downloads/download/NetBeans7.2/updates.xml (7.2 worked for me with 7.4.You can browse which packages a re available athttps://kenai.com/projects/nbappengine/downloads)
  8. Click 'OK' and navigate to Available Plugins tab.
  9. Check the plugin Google App Engine Support 1.0
  10. Click the Install button

Configure App Engine server in Netbeans:

  1. Click on the Services tab next to Projects and Files
  2. Right-click on Servers and click Add
  3. Select Google App Engine and Click Next
  4. Select the location you unzipped the Google App Engine SDK(/usr/local/gae/)
  5. Click Next
  6. Unless you have another service running on port 8080 and port 8765 leave the default port values(I would suggest using other ports like 9090 & 9765).
  7. Click Finish

Create Your App

Create your app engine application at http://appengine.google.com/start/createapp .You will be able to visit your site at 'http://yourappname.appspot.com' after you create an app and deploy your web app with App Engine.

Run the Guestbook Sample App

We are almost done! To test the install and ensure everything runs properly, let’s try running the included Guestbook sample app.
  1. Start NetBeans
  2. Click File -> New Project
  3. Under Samples, select Google App Engine -> Guestbook
  4. Click Next
  5. Enter the location in which you’d like to store this project
  6. Click Finish
  7. Now navigate to  /WEB-INF/appengine-web.xml file
  8. Simply put:
    <threadsafe>true</threadsafe>
    and set your application name in the file.
    Like this:
        <?xml version="1.0" encoding="UTF-8"?>
    <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>YOURAPPNAME</application>
    <version>1</version>
    <threadsafe>true</threadsafe>
    
  9. Don't forget to repace YOURAPPNAME with the app name you created at https://appengine.google.com/
  10. Click the Run button (looks like a green Play button in the toolbar).
  11. Observe App Engine logs on Output tab.The last line should be: [java] INFO: Dev App Server is now running
  12. You have run it locally successfully.Browse to http://localhost:8080/ or http://localhost:9090/ or http://localhost:YOURPORTNUMBER/
  13. You should see a page like this : http://mohifirstapp.appspot.com/
  14. Right click your project and choose Deploy to Google App engine.
  15. Enter your email and password.
  16. Browse to https://appengine.google.com/ to see your application status.
  17. browse to your app http://YOURAPPNAME.appspot.com

References: