EzDevInfo.com

netbeans interview questions

Top netbeans frequently asked interview questions

How to change file encoding in NetBeans?

I want to change encoding of file in NetBeans IDE (ver 6.9.1), let's say from ANSII to UTF-8. How can I do that?

EDIT: I will be more precise. I don't want to change the default encoding in NetBeans. I want to only change encoding of the currently edited file.


Source: (StackOverflow)

How to switch to Dark Theme in Netbeans 7.x

Is there a way to have a dark theme in Netbeans ? I've heard that it's there, but how to switch to Dark Theme ?


Source: (StackOverflow)

Advertisements

Search and Replace Entire Project (Netbeans)

Is there a way to do a project wide search and replace in netbeans? It seems like there should be, but I can not find any information on it.

Thanks


Source: (StackOverflow)

How do I get Haml to work with Rails?

I am trying to get Haml to work with my Ruby on Rails project. I am new to Ruby on Rails and I really like it. However, when I attempt to add an aplication.html.haml or index.html.haml for a view, I just receive errors.

I am using NetBeans as my IDE.


Source: (StackOverflow)

Highlight variable under cursor in Vim like in NetBeans

I worked in NetBeans and liked this feature: when you place cursor in a variable name all occurences of the variable are highlighted. This is very useful for quick searching all occurences of the variable. Is it possible to add this behavior to Vim?


Source: (StackOverflow)

Any netbeans features that will make my day?

I've recently gotten quite fond of netbeans for my php work because of the XDebug integration. It has made me all but forget about textmate (which imho still beats netbeans for the little things)

What do you think is the one awesome netbeans feature I should know about, and more importantly why and how do I use it?

I'm asking this to optimize my skills in the use of the IDE and based on the idea that what works well for others might just work for me (and hopefully others).


Source: (StackOverflow)

Code cleanup in netbeans

Is there something similar to the Eclipse cleanup rules (Preferences > Java > Code Style > Clean Up) in NetBeans?

The cleanup rules in eclipse will allow you to clean things up like organizing imports, removing unnecessary casts, adding missing override annotations etc.

Also can you do that on a whole set of classes/packages instead of individual classes?


Source: (StackOverflow)

JAX-WS client : what's the correct path to access the local WSDL?

I suppose this is a trivial question but after spending a lot of time on trying all the paths I've given up.
The problem is I need to build a web service client from a file I'm been provided. I've stored this file on the local file system and, while I keep the WSDL file in the correct file system folder, everything is fine. When I deploy it to a server or remove the WSDL from the file system folder the proxy can't find the WSDL and rises an error. I've searched the web and I've found the following posts yet I'm not been able to make it work:
JAX-WS Loading WSDL from jar
http://www.java.net/forum/topic/glassfish/metro-and-jaxb/client-jar-cant-find-local-wsdl-0
http://blog.vinodsingh.com/2008/12/locally-packaged-wsdl.html

I'm using NetBeans 6.1 (this is a legacy application I've to update with this new web service client). Below is the JAX-WS proxy class :

    @WebServiceClient(name = "SOAService", targetNamespace = "http://soaservice.eci.ibm.com/", wsdlLocation = "file:/C:/local/path/to/wsdl/SOAService.wsdl")
public class SOAService
    extends Service
{

    private final static URL SOASERVICE_WSDL_LOCATION;
    private final static Logger logger = Logger.getLogger(com.ibm.eci.soaservice.SOAService.class.getName());

    static {
        URL url = null;
        try {
            URL baseUrl;
            baseUrl = com.ibm.eci.soaservice.SOAService.class.getResource(".");
            url = new URL(baseUrl, "file:/C:/local/path/to/wsdl/SOAService.wsdl");
        } catch (MalformedURLException e) {
            logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/local/path/to/wsdl/SOAService.wsdl', retrying as a local file");
            logger.warning(e.getMessage());
        }
        SOASERVICE_WSDL_LOCATION = url;
    }

    public SOAService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public SOAService() {
        super(SOASERVICE_WSDL_LOCATION, new QName("http://soaservice.eci.ibm.com/", "SOAService"));
    }

    /**
     * 
     * @return
     *     returns SOAServiceSoap
     */
    @WebEndpoint(name = "SOAServiceSOAP")
    public SOAServiceSoap getSOAServiceSOAP() {
        return super.getPort(new QName("http://soaservice.eci.ibm.com/", "SOAServiceSOAP"), SOAServiceSoap.class);
    }

    /**
     * 
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
     * @return
     *     returns SOAServiceSoap
     */
    @WebEndpoint(name = "SOAServiceSOAP")
    public SOAServiceSoap getSOAServiceSOAP(WebServiceFeature... features) {
        return super.getPort(new QName("http://soaservice.eci.ibm.com/", "SOAServiceSOAP"), SOAServiceSoap.class, features);
    }

}


This is my code to use the proxy :

      WebServiceClient annotation = SOAService.class.getAnnotation(WebServiceClient.class);
//trying to replicate proxy settings
               URL baseUrl = com.ibm.eci.soaservice.SOAService.class.getResource("");//note : proxy uses "."
               URL url = new URL(baseUrl, "/WEB-INF/wsdl/client/SOAService.wsdl");
               //URL wsdlUrl = this.getClass().getResource("/META-INF/wsdl/SOAService.wsdl"); 
               SOAService serviceObj = new SOAService(url, new QName(annotation.targetNamespace(), annotation.name()));
               proxy = serviceObj.getSOAServiceSOAP();
               /* baseUrl;

               //classes\com\ibm\eci\soaservice
               //URL url = new URL(baseUrl, "../../../../wsdl/SOAService.wsdl");

               proxy = new SOAService().getSOAServiceSOAP();*/
               //updating service endpoint 
               Map<String, Object> ctxt = ((BindingProvider)proxy ).getRequestContext();
               ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
               ctxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, WebServiceUrl);

NetBeans put a copy of the WSDL in web-inf/wsdl/client/SOAService, so I don't want to add it to META-INF too. Service classes are in WEB-INF/classes/com/ibm/eci/soaservice/ and baseurl variable contains the filesystem full path to it (c:\path\to\the\project...\soaservice ). The above code raises the error:
javax.xml.ws.WebServiceException: Failed to access the WSDL at: file:/WEB-INF/wsdl/client/SOAService.wsdl. It failed with: \WEB-INF\wsdl\client\SOAService.wsdl (cannot find the path).

So, first of all, shall I update the wsdllocation of the proxy class? Then how do I tell the SOAService class in WEB-INF/classes/com/ibm/eci/soaservice to search for the WSDL in \WEB-INF\wsdl\client\SOAService.wsdl?

Thank you in advance.

EDITED: I've found this other link - http://jianmingli.com/wp/?cat=41, which say to put the WSDL into the classpath. I'm ashamed to ask: how do I put it into the web application classpath?


Source: (StackOverflow)

Debugging php-cli scripts with xdebug and netbeans?

I have managed to initiate php-cli script debug session from the IDE itself, but I need to start the debugging session from the shell / command line. These are rather complex maintenance PHP scripts which take a lot of input parameters, so entering arguments from within Netbeans is a bit cumbersome.

I have done it before with Zend studio http://kb.zend.com/index.php?View=entry&EntryID=130 but now I need to get it working with Netbeans.

Thanks in advance.


Source: (StackOverflow)

Highlighting modified lines in Eclipse

In netbeans, if I open a file which is under version control the lines which are modified are highlighted in the left. (green for new lines and blue for modified lines)

Is it possible to get a similar effect in Eclipse?


Source: (StackOverflow)

Failed to allocate memory: 8

From today, when I tried to run an app in NetBeans on a 2.3.3 Android platform, it shows me that:

Failed to allocate memory: 8

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

and the Emulator doesn't want to start.

This is for the first time when I see it, and google has no asnwers for this, I tried even with 2 versions of NetBeans 6.9.1 and 7.0.1, still the same error.


Source: (StackOverflow)

How to Select Columns in Editors (Notepad++, Kate, VIM, Sublime, Textpad,etc) and IDEs (NetBeans, IntelliJ IDEA, Eclipse, Visual Studio, etc)

How to select columns in Editors and IDEs to columnar delete, insert or replace some characters ?

Editors:

  • Notepad++
  • Kate
  • VIM
  • Sublime
  • Emacs
  • Textpad
  • Emerald Editor
  • UltraEdit
  • MCEdit
  • jEdit
  • Nedit

IDEs:

  • NetBeans
  • Eclipse
  • Visual Studio
  • IntelliJ IDEA
  • Flash Builder
  • Aptana Studio

Source: (StackOverflow)

Which NetBeans projects files should go into source control?

We normally use Eclipse for a particular Java project, but recently I imported the project into NetBeans to use its dialog building features.

Since I'll probably come back to this, I wanted to store the NetBeans project files into version control. However, I don't want to commit files that are "mine" versus "project", i.e., files with my own settings that would conflict with another user's.

NetBeans created the following structure in the top-level project area:

nbbuild
nb-build.xml
nbproject
    <various files>
    configs
    private

Clearly nbbuild is build output, so that won't go in. The nb-build.xml file seems likely, as does most of nbproject. However, nbproject/private suggests it's "mine". Peeking at "configs", it's not clear to me if that's mine or project...

Anyone have some guidelines?


Source: (StackOverflow)

How to clear the Cache in NetBeans

I created a project in Netbeans and I would like to clear the netbeans Cache.

I'm running NetBeans 7.0.1 on a Windows 7 machine.

How do I do this?


Source: (StackOverflow)

How can I configure NetBeans to insert tabs instead of a bunch of spaces?

When I hit Tab for indenting code, I like to get a real tab. Meaning that when I select that, I only have one large thing selected. NetBeans inserts 5 spaces instead of a tab when I hit Tab. Is there a way I can change that?


Source: (StackOverflow)