NetBeans Development - Windows 7 64-bit ... modules appear to not be loading - windows-7-x64

Being new to NetBeans 7 (this is running on Windows 7 64-bit Ultimate Edition) I found it extremely interesting that I can't get any POC (proof of concept applications) to be "viewable." Allow me to explain.
Going through the tutorials - about as simple as anything can ever be in software dev:
1) I create may NetBeans Development application ... but using a product location other than the default. NetBeans wants to use C:\Users{user_name}\Documents\NetBeanProjects as the root path to your projects, then create project folders underneath. Reasonable, but I have dedicated "development drives" where all my development happens, which is not where NetBeans wants to put it.
2) Create a Module for the application. Here I created an Installer and placed a System.out.println() in an overriden restored() method .... you never see this in the Output windows of the IDE. I also added a new Window with a button and textArea, and set the new Window's properties to be shown on application startup and in the Editor location .... you never see these either.
Long story short, I uninstalled NetBeans v7.0 from the computer, and reinstalled it again, but this time allowing the IDE to use the location it wants for project folders. Though, I still do not get the System.out.println() text in the Output window, I do get my new Windows with the button and TextArea.
I've added this post because I did a bunch of seaches trying to find an answer to all this to no avail. I certainly don't have the real answer, but if someone else is strugling with the same problem you'll at least have a "partial answer" if you've changed default project locations and your applications "don't seem to run or be visible."
If anyone knows the real answer to these questions PLEASE advise.
EDIT #1 ... thinking this might be a security or privilege issue I tried running the IDE "as Administrator" and this didn't make any difference. I do not see any prompts or anything in the OS' logs that indicate a problem either, so I'm assuming it's NetBeans.
EDIT #2 ... Found it. Finally discovered where all my System.out.println()'s are ending up. Not in the IDE's Output Window as I would have expected (pretty sure I'm not the only one) but in a "message.log" text file located at
C:\Users\{User_Name}\Documents\NetBeansProjects\{Project_Name}\build\testuserdir\var\log
That was fun - Not! I am assuming that this probably means the System.out is currently set to do this in a property somewhere. But at least I know it's not disappearing off into space somewhere now.

re. the System.out "Not in the IDE's Output Window", have you tried to instantiate a logger instead?
Directly after the class declaration, paste in the following field definition:
private static final Logger logger = Logger.getLogger("thePackageName.andYourClassNameHere");
import the import java.util.logging.Logger; library.
then simply log what ever you want to trace on the output console.
ie: logger.info(" ... " + ....);

Related

Eclipse Plugin-Development Debugger out of Sync

for some internal development I currently customize a Eclipse Plug in. The Plug in I use is deployed as .jar File. Now I extracted the Content and imported it as Eclipse Plug in project. Everything works fine until is start to add some Code.
For testing the new functionality I like to debug my code. Therefore I run the Eclipse Plug in project in Debug mode. I've got a Debugging connection but the line of code highlighted in the editor doesn't match with the code.
1 private void a(){
2 doSomething();
3 }
4
5 private void b(){
6 doSomethingElse();
7 }
For example the Debug view says I am in the Method b(). But the Highlighter, in the Text-Editor, point to line 3.
I tried several things like Cleaning and searched nearly everywhere in the Debug-Configurations but nothing helped me.
If the displayed code doesn't fit what the debugger tells you it is executing, then you are simply not debugging the code that you see in the editor (but probably still the version without your modifications).
There are a lot of potential reasons for this. For the most easy failure please check your debug configuration. On the plugins page of the debug configuration there are plugins shown as living in your workspace and being provided by the Eclipse installation. Make sure that for your plugin the checkbox is at the workspace version, like the first checkbox in this image:
The debugger highlights the code that is just about to be executed. When the debugger says you are in method b() it is simply telling you that it is about to debug method b()

Eclipse doesn't provide details on file search

I'm having a baffling problem with Eclipse on one of my machines, and it's driving me nuts. When I use File Search, I no longer get the details of each hit within the files. It used to do that, and at some point it stopped. I can only assume that I either installed some plugin that goofed it up or fat-fingered some obscure keyboard shortcut that caused it to stop working. My home machine, which has roughly the same setup (since I work on most of the same projects on it) does not have that issue. Here's a quick screen shot of my home machine, which does have the details that I would like:
And here's what it looks like on my other machine, with the lack of line context:
I'm totally baffled here. Can anybody help out?
Judging by past items...
...closing Eclipse and then running it with the -clean parameter (e.g. eclipse.exe -clean) might do the trick. Or it might not.
One more suggestion. This is not a nice or pretty suggestion and it doesn't tell you why you have a problem, but it just may work.
in your good machine, File -> Export... -> Preferences
in your bad machine, create a new empty workspace
import all of the preferences from your good machine.
If search is now working properly, then import all of your old projects to the new workspace.
This just might work.
This is identical to this comment thread on bugs.eclipse.org -> https://bugs.eclipse.org/bugs/show_bug.cgi?id=47136#c44
Unfortunately, the recommended solution is to reinstall Eclipse
You might try looking in the logs, to identify if there's a specific incompatibility with a Plugin.
From http://www.eclipse.org/eclipse/platform-core/documents/3.1/debug.html
Generally in Eclipse when you get an error, a message and stack trace
is logged to your workspace log. This is great but can easily be
missed unless you are looking for it. And some plug-ins silently log
entries to the log file. Tsk tsk. In order to never miss entries being
logged, we use the -consoleLog command-line argument. This basically
means "anything you log to the log file should be logged to the
console as well".
eclipse -consoleLog
So, try running eclipse -consoleLog, and see if you get an error when running the search. Do the same thing on both computers, to compare and contrast.
There are different kinds of searches in Eclipse. It looks like the first search is a "File" search. I am not sure what kind of search the second one is, but it looks quite different. Make sure you are doing a "File" search on the second machine.
CTRL-h (or CMD-h on Mac). Select the "File search" tab. If you don't see it, then click on "Customize..." on the lower left and ensure that "File search" is shown.

Eclipse PyDev completion hangs (yet again)

I'm using PyDev in Eclipse as my Python editor. It's fine in terms of feature set. Everything works fine except for one very annoying thing:
Code completion itself works fast. When I press Alt+Space, the window pops out almost instantly and all the options are there. The option at the top is selected. Then comes the trouble. The detailed description won't appear until about 5-10 seconds. All this time CPU is working at maximum load and the interface is not responding. All the processor is consumed by the Eclipse Java process (the spawned Python process seems idle). Then a yellow window pops up, and all it contains is just a Python code of a selected function/variable. All consecutive details are displayed instantly. The procedure repeats when I close the completion window (for example by accepting one of the options and asking for completion again). This drives me crazy.
I've tried so far:
creating a whole new workspace,
creating an Eclipse/PyDev project from scratch,
tweaking JVM to make sure it has loads of memory,
making sure the right JVM is chosen (the latest Oracle JVM available),
making sure Python process communicates freely with the Java instance (I read about possible problems with that, but it seems not to be the issue).
making sure all the installed plugins are up to date.
The version I use is Eclipse Helios, because the last time I checked certain extensions weren't yet ported to the latest one.
Has anyone observed a similar issue? Was anyone able to get around it? General ideas on how to debug it and file a sensible bug report possibly? Other things worth checking for.
Any workaround less drastic than turning completion off completly?
Thanks!
EDIT:
I've also noticed a problem with a similar popup window in HTML/CSS editor. It looked somewhat similar (a yellow window, with some text inside) and it also took ages to display. Don't really know if that is related, but could be.
EDIT(2):
Ok, No I've started with a fresh install of the newest Eclipse Indigo, without any additional plugins apart from PyDev and the issue remains. Seems like I'll have to look for a new IDE.
What version of Java are you using?
If you are on Windows 7, later versions of Java (I think 6+) will default to IPv6.
This is probably causing the problem as Python maybe wanting IPv4.
Anyway, since I had this problem I tried disabling
PyLint
Code Analysis
but it was still hanging.
Pal's answer about "ipv4 utilization" triggered my memory about another problem I had solved by "preferring" IPv4.
See http://docs.oracle.com/javase/1.4.2/docs/guide/net/ipv6_guide/
What you want to do is to edit your eclipse.ini and add "-Djava.net.preferIPv4Stack=true" in the vmargs section
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
...
-vmargs
-...
-Djava.net.preferIPv4Stack=true
...
I no longer get hangs.
Is there any chance you can provide the code that's making that happen (and add it to a bug report see: http://pydev.org/about.html for links)?
I use PyDev daily with some very large projects and don't have that problem, so, it may be some specific construct or scenario in your code -- or maybe you just haven't given Eclipse enough memory (which would make the garbage collector work much more), in which case, take a look at: What are the best JVM settings for Eclipse? (in specific, raise your -Xmx flag, although you can probably use the other tips there too).
If you can't provide a reproducible scenario, the other choice would be getting a profiler (i.e.: YourKit java profiler has a 15 days free which would help in this case), running that use-case in the profiler and passing a snapshot of what's happening in this situation (if that's the case, please open a bug report at pydev.org and I can help you there).
I got this from pydev.org FAQs and it works fine for me.
When I do a code-completion, PyDev hangs, what can I do?
PyDev does most of its things in the java side, but some information can only be gotten from the python side (mainly builtins), so, in order to get that info, PyDev creates a shell and communicates with it through sockets.
The main problems when that happens are:
There's a firewall blocking the communication to the shell
In Linux, some kernels do not allow ipv4 utilization, which may make PyDev fail.
To enable it, do: echo 0 > /proc/sys/net/ipv6/bindv6only
The timeout to connect is too smal.
It depends upon the "Timeout to connect to shell" in the code-completion preferences (window > preferences > PyDev > Code completion)
If nothing works, please report a bug (also, check if there is anything on the error log (window > show view > PDE Runtime > Error log) and on the eclipse '.log', which is located at the .metadata folder of the workspace location.

Deploying my Japplet in Netbeans

I'm banging my head against the wall trying to figure this out.
I'm using NetBeans 6.9.1 and I have a project of type "Java Application." This project contains no Main method, but instead a Japplet named AlarmClock.java. When I right-click and run AlarmClock.java, it runs correctly with no problems. What I can't figure out is how to get this applet to run on a website (or even locally on my computer for that matter). I've tried building it and opening up ProjectDirectory/dist/launch.html which starts up launch.JNLP which opens up a webpage with a space for my applet, but this space just contains an error message.
I'm not sure if it's something wrong with my project settings, and I don't know what a "codebase" is or whether "Web Start" should be on. Do I need a main method that opens up my applet, and how would I do that? Some advice would be hugely appreciated.
That is a typical situation where a full IDE is too much. To understand the background is better to take a simple text editor and let you guide by a Java Applet Tutorial.
Once you feel good with applets make the same exercise with your preferred IDE. If not you have to learn Applets + "How my IDE handles Applets" at the same time.

Setting breakpoint w/Eclipse PDT

I am SOOOOO discouraged. This seems so simple, but being a complete novice in Drupal and Eclipse PDT I have absolutely no idea where to look. My DAYS of searching seems to indicate that I am the only person on the planet with this problem.
Eclipse IDE for PHP Developers (1.2.1.20090918-0703)
WampServer Version 2.0
Apache 2.2.11
PHP 5.2.9-2
MySQL 5.1.33
Drupal 6.15
xDebug php_xdebug-2.0.5-5.2.dll
I setup my project in Eclipse to point to my Drupal directory (C:\wamp\www\drupal-6.15). I start the debugger (xdebug) and I stop at the first line of code. I can step through the code line by line -- so I think I am in the debugger, and when I terminate the app, I see the xdebug termination message in the tab heading.
But I cannot set a breakpoint in any of the PHP code files -- specifically a new .module file.
When I right click in the breakpoint column on the left in index.php (main) I see "toggle breakpoint" and the little blue circle next to the line of code...so I think I know how to set a breakpoint. But when I try to set a breakpoint in my .module, I see a menu that asks me to "add a bookmark" and no option to set a breakpoint.
Why can I not set a breakpoint in this file? Is my project path not set up correctly? Do I need to amend my include path? I can't get Eclipse to recognize even core modules not just site/all modules. I've seen posts about "importing" files into the project, and making sure the correct php.ini file is used for configuring xdebug. I'm lost.
There are so many posts about using Eclipst PDT and xDebug and they all end with "have fun debugging" or "just set some breakpoints and off you go" -- but what if you CAN'T set a breakpoint? Any ideas about where Eclipse is lost? Where in Eclipse can you get a list of files it has included in its build?
I think I just need to know understand why Eclipse cannot find these modules within the project (i.e. drupal application) path to allow me to set breakpoints. Then I think I can carry on. So discouraging...
Thanks to anyone listening.
Thanks for the tip. I think I had seen your similar response in another post somewhere.
Actually, the solution for me was to make sure to include all of the standard Drupal file extensions in the Eclipse file associations preferences: Preferences->General->Content Types->Text->PHP Content Type. The defaults are various *.php, *.phpX, *.phtml extensions, but not the extensions used in Drupal modules -- *.info, *.inc, *.module, *.install, etc.
Simple and obvious once you figure it out. I'm surprised with all the Eclipse-xDebug-Drupal setup instructions out there that this had not shown up. Lots of details about matching project paths with server paths, but nothing about this.
I hope my struggle helps someone. I did learn a lot about Eclipse PDT along the way :-). Good luck.
Breakpoints are tricky in PDT projects:
for php files, you need to be careful
One thing that gets me a lot is that there a lot of "invalid" places where you set breakpoints. You can put the dot there in the IDE, but the debugger won't stop at it:
blank/non-code lines
on switch statements
in some types of callbacks (for example, preg_replace)
But for breakpoints in .module files, this should be related to a setup issue.
I made the following changes to my setup:
Upgraded from php 5.2.1 to php 5.2.3
Installed the Zend debugger client in Eclipse/PDT (theoretically not necessary from what I understand, but I decided to give it a try)
Made sure that the Drupal files were fully imported into my project, not just referenced as include libraries.
I did that last step after I created a tiny test case and discovered that I could get the debugger to stop on a breakpoint in an externally included file only if that file was imported into the project, not if it was referenced as part of an include library directory.
To my mind this seems like a bug - the debugger could certainly see that the files in the include library directories were source files and it let me set breakpoints in them, so it seems that it should stop on them.
(For comparison from a separate (java) IDE, IntelliJ will let you define breakpoints in jar files as long as you tell it where the source is. Once you've defined it, it will stop on it.)
I think it was principally that last step that did the trick, so I'd suggest that anyone else with a similar problem make sure that isn't an issue in their setup first, and then try the other steps.
check whether you opened your java file in java editor mode.
ie ctrl+shift+R, in this popup check the button beside OPEN option and select java editor.
The problem of not being able to set a breakpoint can occur if you have recently created a file. You must close and re-open the file for it to be recognised as a source file that can be debugged, and to enable the code highlighting.