Blog

NetBeans IDE is a free and open source integrated development environment.
“Quickly and easily develop desktop, mobile and web applications
with Java, JavaScript, HTML5, PHP, C/C++ and more.”

Netbeans IDE is often just called Netbeans.

Note: If you can, install the latest executable Netbeans IDE, which will give you the option to keep the program auto updated.

But if due to your company’s security policies, you are not be able to update to the latest required NetBeans or even install the NetBeans executable (exe), you can often download and use the portable versions of programs, often distributed as zip, tar, or gz files.

Or maybe you just want a portable and easy to backup version of the NetBeans.

Download the latest version of Netbeans.

Note: Netbeans used to be developed by Oracle, but is currently moving to Apache.
Either download the latest stable version from Oracle, or the latest beta from Apache (as of this post)

Netbeans 8.2 (Oracle)
https://netbeans.org/downloads/

Be sure to switch the Platform dropdown to OS Independent Zip
Then download the appropriate environment
If in doubt, All will suffice.



Netbeans Beta 9.0 (Apache)
http://netbeans.incubator.apache.org/download/nb90/nb90-beta.html
http://netbeans.incubator.apache.org




Extract either download to a directory, such as 
C:\Portable\Netbeans

Note: BandiZip is a good free archive (zip) program

To run Netbeans, you must have a Java JRE installed or a portable copy.
Note: This Blog post will show you how to create a portable copy of the Java JRE
Portable Java


If using a portable version of the Java JRE, 
Edit the Netbeans configuration file to tell Netbeans where your portable version of Java JRE is located.

Open the file
C:\Portable\Netbeans\etc\netbeans.conf




Note: Notepad++ is a good free text editor, which can also be used portable
just download the zip or 7z version.


Find the string (CTRL F or scroll and read)
#netbeans_jdkhome="/path/to/jdk"

And change it to where you installed/extracted the Java JRE
Such as
netbeans_jdkhome="C:\Portable\jre1.8.0_161"
Or
netbeans_jdkhome="C:\Portable\jre-10.0.1"

Note the removal of the comment tag #

Save and close and try to run Netbeans

Create a shortcut to the Netbeans executable, which is in 
C:\Portable\Netbeans\bin\




Choose netbeans64.exe if you are using a 64bit OS (most likely)
else choose netbeans.exe

Netbeans should be up and running.

Program away!




Additional information

If your company policy locks down your installation options, more than likely you are on ‘less than optimal’ hardware. If your laptop or desktop only has 4gb memory, this change can help the performance of Netbeans

Edit the Netbeans configuration file again
C:\Portable\Netbeans\etc\netbeans.conf

Find the string 
netbeans_default_options

Place a comment mark # in front of it, so you can reset the configuration if need be
#netbeans_default_options

And create a new entry
netbeans_default_options="-J-client -J-Xss8m -J-Xms256m -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Djava.net.preferIPv4Stack=true -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled"

-J-Xss8m -J-Xms256m allows Netbeans to start up a little faster, and caps it’s memory usage.

Further details of options
https://performance.netbeans.org/howto/jvmswitches/

Additional ideas
https://stackoverflow.com/questions/229763/how-to-improve-netbeans-performance

With two semi-obvious ones being
Disable the Netbeans plugins you are not using.
Close the projects you are not working on (Netbeans keeps an index on every project opened)

End of document. Thanks for reading.

Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program; such as Netbeans and DBeaver
[Wikipedia]

Note: If you can, install the latest executable JRE, which will give you the option to keep the Java JRE auto updated.

But if due to your company’s security policies, you are not be able to update to the latest required Java JRE or even install the Java JRE executable (exe), you can often download and use the portable versions of programs, often distributed as zip, tar, or gz files.

Or maybe you just want a portable and easy to backup version of the Java JRE.

To run Java programs with the latest Java JRE, download the Java Platform, Standard Edition (Java SE), Runtime Environment.

Download the latest version of Java JRE




Java SE Runtime Environment 10 Downloads
http://www.oracle.com/technetwork/java/javase/downloads/jre10-downloads-4417026.html
Download the jre-10.0.1_windows-x64_bin.tar.gz file (as of this post)

Note: If you are on a 32bit OS, you will have to download the Java JRE version 8, as versions 9, 10 and later no longer support 32bit OSes.

Java SE Runtime Environment 8 Downloads
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Download the jre-8u172-windows-i586.tar.gz file for 32bit OSes or 
Download the jre-8u172-windows-x64.tar.gz file for 64bit Oses

Extract the tar.gz file to a directory, such as
C:/Portable/Java/jre1.8.0_161/
Or
C:/Portable/Java/jre-10.0.1/

Note: BandiZip is a good free archive (zip) program






As an alternative, and if you can install exe files, you can try jPortable.
jPortable allows you to create a full-featured Java Runtime Environment





Run the downloaded
jPortable_8_Update_161_online.paf.exe




Choose an installation directory, which may be a USB drive.
The default installation directory is 
C:\PortableApps\CommonFiles\Java



And wait for the program to download the actual Java JRE.



You now have a portable version of Java. 
But to use it, you will often have to configure your programs to point to your portable Java directory.
So remember where you installed the Java JRE

C:/Portable/Java/jre1.8.0_161/
Or
C:\PortableApps\CommonFiles\Java

Note: You can also add these paths to your Environment Variables
Details can be found in this Stackoverflow post
https://stackoverflow.com/a/1672536


Configure portable Netbeans to use portable Java JRE

Configure portable DBeaver to use portable Java JRE



End of document. Thanks for reading.

Simple PHP console output helper.

While using PHPUnit, you may want to output or debug your tests.

Normal echo/print_r/dump only outputs after PHPUnit's output, if at all.

Using ConsoleOutput will echo inline with PHPUnits output,

giving you a better context of your output/debugging.

Usage:

$this->consoleOutput = new ConsoleOutput();

$this->consoleOutput->showWarning('test showWarning');

test showWarning

View on GitHub

Simple PHP formatter for bytes

Usage:

$this->formatSize = new FormatSize();

$bytes = 4398046511104;
$decimals = 2;
$formatted = $this->formatSize->formatBytes($bytes, $decimals);
$this->assertEquals('4.00 TB', $formatted); 

View on GitHub