To solve some time, Ant targets can be given short cuts in the NetBeans IDE. To do this:
1. Open the build.xml (e.g. through the Files tab). Within the Navigator tab you will see the file contents (i.e., the targets).
2. RIght click on a target and select Create Shortcut. A wizard will open that lets you configure the shortcut (e.g., toolbar button or a keyboard shortcut).
Wednesday, 14 March 2012
Monday, 12 March 2012
NetBeans: Unrecognised project; missing plugin?
I recently upgraded my NetBeans to 7.1.1 from 6.8. After installation I could not open my web application projects, receiving the error: Project Name: [unrecognised project; missing plugin?].
To fix this you need to add the EAR project plugin (via Tools>Plugins). The plugin is named EJB and EAR. Once installed, the problem should no longer persist.
To fix this you need to add the EAR project plugin (via Tools>Plugins). The plugin is named EJB and EAR. Once installed, the problem should no longer persist.
Friday, 2 March 2012
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
When I ssh into a server I get this message;
To get rid of this message I opened the known hosts file on my machine;
I then removed the line for the server I am trying to ssh into and saved the file. Next time I tried to ssh into the server I got the option to add it to my list of known hosts which I accepted.
This warning can appear when Linux is reinstalled or UNIX with OpenSSH.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
[long list of characters..].
Please contact your system administrator.
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
[long list of characters..].
Please contact your system administrator.
To get rid of this message I opened the known hosts file on my machine;
vi /home/user/.ssh/known_hosts
I then removed the line for the server I am trying to ssh into and saved the file. Next time I tried to ssh into the server I got the option to add it to my list of known hosts which I accepted.
This warning can appear when Linux is reinstalled or UNIX with OpenSSH.
Wednesday, 29 February 2012
The finalize method
Before an object is garbage collected, the runtime system calls its
finalize()
method. The intent is for finalize()
to release system resources such as open files or open sockets before getting collected. Your class can provide for its finalization simply by adding a method in your class named
finalize()
. Your finalize()
method must be declared as follows: protected void finalize () throws throwable
The
finalize()
method is declared in the java.lang.Object class. Thus when you write a finalize()
method for your class you are overriding the one in your superclass. If your class's superclass has a
finalize()
method, then your class's finalize()
method should probably call the superclass's finalize()
method after it has performed any of its clean up duties. This cleans up any resources the object may have unknowingly obtained through methods inherited from the superclass. protected void finalize() throws Throwable {
. . .
// clean up code for this class here
. . .
super.finalize();
}
Monday, 27 February 2012
Run test via code
You can run your JUnit and JWebUnit tests from your own code. The class org.junit.runner.JUnitCore provides the method runClasses() which allows you to run one or several tests classes. As a return parameter you receive an object of the type org.junit.runner.Result. This object can be used to retrieve information about the tests.
http://www.vogella.de/articles/JUnit/article.html
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
class RunTests {
public static void main(String args[]) {
Result result = JUnitCore.runClasses(TestClass.class);
for (Failure failure : result.getFailures()) {
System.out.println("FAIL!: " + failure.toString());
}
}
}
public static void main(String args[]) {
Result result = JUnitCore.runClasses(TestClass.class);
for (Failure failure : result.getFailures()) {
System.out.println("FAIL!: " + failure.toString());
}
}
}
http://www.vogella.de/articles/JUnit/article.html
Thursday, 23 February 2012
Target "profile-j2ee" does not exist in the project
This is an error which you can get when attempting to Profile a project in NetBeans. A solution I found is;
"It seems that something has changed in project's build script, so the project is only partially modified for profiling, leading to the message you've provided. Probably the easiest way how to enable profiling again is to undo all project modifications and let the Profiler to integrate with the project again. To do it, perform following modifications: - in build.xml, remove <import file="nbproject/profiler-build-impl.xml"/> line - in ./nbproject directory, remove profiler-build-impl.xml file - in ./nbproject/private, remove <data xmlns=" http://www.netbeans.org/ns/profiler/1" version="0.4"/> line - (optional) remove ./nbproject/private/profiler directory to remove all Profiler settings related to the project Now after clicking the Profile (Main) Project action again, the Profiler notifies you about build script modification and profiling should work again." From: http://netbeans.org/bugzilla/show_bug.cgi?id=73742
Wednesday, 22 February 2012
copylibs doesn't support the "rebase" attribute
This can happen when a NetBeans 7.1 project opens a project with an older version of CopyLibs. The solution is;
- Tools->Libraries
- select the "Library location" that you want to fix (not the Global one)
- select the "CopyLibs Task"
- click the "Remove" button on the lower left corner
- click "Ok"
- In the project explorer right click on the "Libraries" virtual folder under
your project
- click "Add Library..."
- click the "Import" button
- select on "CopyLibs Task"
- click the "Import Library" button
- click the "Cancel" button
This can also happen the other way round i.e. when a version of NetBeans less than 7.1 opens a 7.1 project. The solution is;
- Open the file nbproject/build-impl.xml
- remove the rebase attribute and value from the line the error is coming from which is a <copylibs/> tag
Subscribe to:
Posts (Atom)