Showing posts with label portable applications. Show all posts
Showing posts with label portable applications. Show all posts

Friday, 19 August 2011

Another way to be portable - part II

So, NetBeans stack (with servers) portable through DropBox - sounds quite possible. After all PortableApps can be used this way. But what's to consider first? Here's the list (it's not long at all):
  • Will the free account's box size suffice? Yes, it will, even for a full install (with the two app servers). And I guess there'll be a little bit more space for some small projects, etc.
  • What if utilize multiple platforms (Windows at work, Linux at home, and Mac on the move)? Well fortunately the IDE still has the "OS independent Zip" on the download page, but as you can see there, this option comes without the servers. The servers are completely different story, for another post.
  • And should I put the JDK also in the DropBox? If so, should it also be platform independent? Hm, friend, this is Java you know! And I think, we've already been through this :)
Maybe these are all of the preliminary considerations, so I dive in ....

Downloaded the OS independent ZIP for the latest (currently 7.0.1) version (242 MB archived, and around 470 MB extracted to a DropBox sub-folder). With my connection, it uploaded to the central server for around half an hour.
For further examinations lets name the path to the DropBox folder as DB. So if the IDE is extracted to DB/netbeans, the adventure starts from the DB/netbeans/bin folder (I believe you can easily figure out the corresponding Windows paths). In this folder there are only two files - the executables for the two major platforms. Since the IDE is configured by default to search for the java installation existing on the system, if such exists, the IDE will run. If only JRE is installed, it might run, but it surely won't compile your projects and it will complain about it. Of course, the access to a java installation can be configured, but I don't think there is a point in repeating myself. Everything said in that post still applies.
I would only add that if you use a portable JDK, you might tweak it, to make it slimmer. This means that bin, jre and lib folders will suffice. Another detail is that you might have to gather the executable files from different platforms in their corresponding sub-folders in order to be fully portable. Actually it is all a matter of taste and context. All environments that I have DropBox on are Linux, so I don't need portable JDK. In that case I only have to take care that on every environment I use compatible JDKs. For example if on Env1 I have installed JDK 1.7, the Env2 which has by default (from repositories) JDK 1.6 the projects might become in conflicted state. This might not happen for different updates of the same version of the JDK, but for a different versions of used application servers the conflict is certain. So the journey continues.

I don't know how close, but this installment looks to me similar to an IDE on the cloud. I accept every suggestion that might reduce the distance between the reality and the idea.

Sunday, 13 April 2008

Portable NetBeans - part II

Of course just placing NetBeans on USB drive and running it from there doesn't make it really portable. Why?
As most of the serious contemporary applications the IDE uses some deal of system awareness. That means it not only scans the host system (during installation) for where your Java is but it also takes account on the user's home directory, where the service information have to be stored.
So when the installer is started, if you monitor the contents of your user's directory in Windows, you'll see a new one created - '.nbi'. It stores the logs and configurations that let the installer, when started again, know what exactly have been installed on the previous occasions(s). That's not bad at all. On one hand you have a host environment that may serve you as a dock for your portable IDE. But on the other, it restricts the portability. This folder may be moved on the USB drive, but NetBeans installer will still search for it in the current user's home directory. That's not a catastrophe so far - you successfully installed the IDE already and most probably it won't happen again up till the next version.
Anyway, another and more important directory is created into the user's home the first time NetBeans is started - '.netbeans'. This is the actual configuration center for the IDE - updates are downloaded here, the current state of the application is preserved here, etc. In time this folder may become quite big in size. What's worse - this directory could leave a trace of your presence on the host system! Oops! That would be so unportable.
I feared so, that's why I made a test. I ran the IDE on a fellow's laptop. Before that I had been moved the '.netbeans' folder in a place such as 'X:\tools\netbeans\conf' on my USB memory. When started the update center I expected the '.netbeans' folder to be regenerated into the user's home. Nothing like this. I installed a module and the trace for this was written exactly where it had to be - in '
X:\tools\netbeans\conf\.netbeans\6.1\update-tracking' and the module was downloaded into 'X:\tools\netbeans\conf\.netbeans\6.1\modules'. It is still a mystery to me how this happened, because it is dumb to believe that things happen this way. On a second try it didn't work. Of course.
So, what is the right way? Well, I just opened the right file: 'X:\PortableApps\NetBeans 6.1\etc\netbeans.conf' and provided the correct value to the
netbeans_default_userdir variable on the second line:
netbeans_default_userdir="X:/tools/netbeans/conf/.netbeans/6.1"

Now with everything in place NetBeans starts and updates very portably.
Yet another 'prankster' always appears during the NetBeans startup - the '.netbeans-registration' directory. It regenerates anytime, anywhere. And always leaves a trace. It isn't much - just a small XML status file, but this is a trace after all. I don't mind to register my IDE, but no more than once is appropriate, I think.

Well, all these 'hacks' are just on the go. We can hardly ever expect an official version of Portable NetBeans from the community or SUN. If you're smart enough (and I bet you are) and you chase the Portable conditions then the sky is the limit, like they say. Not only the IDE but the Java itself can alway be made thinner and slimmer and encapsulated. It is only a matter of little effort and plenty of free time. And of course limitless imagination.