Installing XPath Explorer on NetBeans for Mac OSX

24 12 2008

I have only found this documentation on installing xpath explorer on netbeans, therefore I’ll give a little more info for mac osx (it’s easy but you have to search a little).

1. download the xpe-netbeans.jar file (from the xpe project download page).

2. place the xpe-netbeans.jar file in your NetBeans module lib dir, the following worked for me:
/Applications/NetBeans/NetBeans 6.5.app/Contents/Resources/NetBeans/platform9/lib

3. restart NetBeans and you should see the following menu option: Tools > XPath Explorer.

Adapt these instructions for your NetBeans installation path and version number if different.





Installing netbeans 6.5M1 on ubuntu error:/usr/share/themes/Human/gtk-2.0/gtkrc:43: error: lexical error or unexpected token, expected valid token

6 08 2008

problem:

I get the following error when trying to run the linux netbeans 6.5M1 installer (netbeans-6.5_m1-php-linux.sh) on ubuntu 8.04:

/usr/share/themes/Human/gtk-2.0/gtkrc:43: error: lexical error or unexpected token, expected valid token

and then the installer window shows a blank screen.

(I’m guessing this post may relate to other versions of netbeans and ubuntu)

solution:

the problem was the jvm 1.5 I was running under, updating to jvm 1.6 solves the problem… I installed the sun-java6-jdk and the jvm dependencies then when executing the installer I specified the java home as follows:

./netbeans-6.5_m1-php-linux.sh --javahome /usr/lib/jvm/java-6-sun





eclipse.ini -vm option

26 03 2008

Note to self when configuring the “-vm” option in eclipse.ini… Place the path to your jdk on a new line i.e.

...
-vm
C:\programs\Java\jdk1.6.0\bin

...

and not:
...
-vm C:\programs\Java\jdk1.6.0\bin
...

Also to see what configuration options stuck goto menu item: Help -> About Eclipse Platform, then click Configuration Details button.





java & struts file download

31 01 2008

Your file POJO will look somthing like this:
public interface MyFile
{
public int getAppraisalFindingsFileId();
public void setAppraisalFindingsFileId(int appraisalFindingsFileId);
public int getAppraisalId();
public void setAppraisalId(int appraisalId);
public String getFileName();
public void setFileName(String fileName);
public int getFileSize();
public void setFileSize(int fileSize);
public Calendar getUploadedDate();
public void setUploadedDate(Calendar uploadedDate);
public String getUploadedBy();
public void setUploadedBy(String uploadedBy);
public byte[] getFileData();
public void setFileData(byte[] fileData);
}

Once you have your file data do something similar to this in your Forms Action class execute method:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
//...
// do something like this...
response.setContentLength(myFile.getFileSize());
response.setContentType("application/x-file-download");
response.setHeader("Content-disposition",
"attachment; filename="
+ URLEncoder.encode(myFile.getFileName(), "UTF-8"));
response.setHeader("Cache-Control",
"max-age=600");
ServletOutputStream outStream = response.getOutputStream();
outStream.write(myFile.getFileData());
outStream.flush();
//...
}





Installing and configuring tomcat on Mac OS X

13 01 2008

Follow the excellent instructions on the apple developer connection site:

Java and Tomcat on Mac OS X, Part I
Java and Tomcat on Mac OS X, Part II
(Alternately search for tomcat on the developer connection site).

I’ve decided to go with tomcat-5.5.25 available for download here.

NOTE: you can follow the entire instructions and build the example apps if you like however I recommend just reading to the part were you test the example servlets and jsp pages. Once we have an application server up and running we can focus on building a web application using Maven.

NOTE: The articles above don’t include instructions on configuring the correct user access to run the manager and admin applications. Like me, you might have thought the default passwords for the tomcat manager application may be configured but they are not (probably for security reasons?) well here’s how (note that currently the manager app is included in the tomcat download but the administrator app IS NOT and must be downloaded separately):

Edit the tomcat-users.xml file at $CATALINA_HOME/conf/tomcat-users.xml and add the admin and manager roles, then add your user to those roles:

<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>

<user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

Once you restart tomcat you will have access to the manager application (and the administration app if installed).