Maven dependency for org.netbeans.* (AbsoluteLayout) in a Swing application

December 11, 2011

Just a quick post about how to resolve dependency errors in Netbeans when setting up Maven for a Swing application. I struggled to find any information on which repositories to use so thought I would post in case other people had the same issues as me.

If you create a Maven project and add existing Swing .java files then you may find errors such as:

Error package org.netbeans.lib.awtextra does not exist ...

This package resides in the AbsoluteLayout.jar that is normally automatically supplied by Netbeans. In order to add this dependency to your Maven pom.xml you need to add the following lines:

<repositories>
  <!--These are needed for Swing/Netbeans -->
  <repository>
    <id>maven2-repository.netbeans.maven2</id>
    <name>Netbeans Maven Repository</name>
    <url>http://bits.netbeans.org/maven2/</url>
    <layout>default</layout>
  </repository> 
</repositories>

This should be added somewhere above the opening tag.
Then add:

<dependency>
      <groupId>org.netbeans.external</groupId>
      <artifactId>AbsoluteLayout</artifactId>
      <version>RELEASE701</version>
</dependency>

You can check for the latest version of AbsoluteLayout.jar here.

0

Adding a Custom Configuration in CMake

September 20, 2011

To add a custom configuration to a CMake build (which only applies to multi-generators such as Visual Studio):

list(APPEND CMAKE_CONFIGURATION_TYPES DEBUGX64)
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
 
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
    "Semicolon separated list of supported configuration types [Debug|Release|MinSizeRel|RelWithDebInfo|Debug-x64]"
    FORCE)
 
set(CMAKE_C_FLAGS_SUPERDUPER "-flagone -flagtwo" CACHE STRING
    "Flags used by the compiler during debugx64 builds")
set(CMAKE_CXX_FLAGS_SUPERDUPER "-flagone -flagtwo" CACHE STRING
    "Flags used by the compiler during debugx64 builds")
 
set(CMAKE_EXE_LINKER_FLAGS_SUPERDUPER "-flagone -flagtwo" CACHE STRING
    "Flags used by the linker for executables during debugx64 builds")
set(CMAKE_SHARED_LINKER_FLAGS_SUPERDUPER "-flagone -flagtwo" CACHE STRING
    "Flags used by the linker for shared libraries during debugx64 builds")
set(CMAKE_MODULE_LINKER_FLAGS_SUPERDUPER "-flagone -flagtwo" CACHE STRING
    "Flags used by the linker for loadable modules during debugx64 builds")
 
mark_as_advanced(CMAKE_C_FLAGS_DEBUGX64 CMAKE_CXX_FLAGS_DEBUGX64
                 CMAKE_EXE_LINKER_FLAGS_DEBUGX64 CMAKE_SHARED_LINKER_FLAGS_DEBUGX64 CMAKE_MODULE_LINKER_FLAGS_DEBUGX64)
0

Installing vsftpd on an Amazon EC2 Ubuntu instance

August 21, 2011

Just a quick tutorial on the basic steps to get ftp setup and running on an Amazon EC2 instance. I assume you have already launched an ubuntu instance and have configured it for shell access (ssh).

Server Setup

First things first,  lets open some ports for FTP. You can do this one of two ways:

Assuming you have a valid environment set up you can use the following two lines on the command line:

ec2-authorize default -p 20-21
ec2-authorize default -p 50000-51000

This assume the default security group, if you have a different security group then replace ‘default’ with it’s name.

If you’re not comfortable with the command line you can do it from your AWS management console.

  • Just log in, go to EC2 and click the Security Groups link.
  • Then choose the default group and switch to the inbound tab (at the bottom of the page)
  • Add the port ranges as above (20-21 and 50000-51000) and apply the rule changes

Next log in (ssh) to your instance and execute:

sudo apt-get install vsftpd

Once that’s installed you need to run:

sudo vim /etc/vsftpd/vsftpd.conf

Now you need to uncomment the following lines (a comment begins with a ‘#’):

write_enable=YES

and add the following lines at the bottom:

pasv_max_port=51000
pasv_min_port=50000
port_enable=YES
pasv_enable=YES

This allows us to use PASV mode in our FTP program.

Now you probably want to add an FTP user to log in with. Since the default Ubuntu instances on EC2 usually require you to log in with your Private Key you need to add a user with a password. Luckily this is easy to do:

sudo adduser YOUR_USER_NAME

Then just follow the instructions on screen – including adding a password.
All that’s left to do is restart the FTP server:

sudo service vsftpd restart

FileZilla Setup

Assuming you were going to use FileZilla (as this is what I use – instructions should be reasonable similar for WinSCP or any other program) go to File->Site Manager-Add New Site.

Host: YOUR_EC2_PUBLIC_DNS
Port: 21
Protocol: FTP
Encryption: Use plain FTP

Logon Type: Normal
User: USERNAME_YOU_CHOSE_IN_ADDUSER
Password: PASSWORD_YOU_CHOSE_IN_ADDUSER

Transfer Settings Tab:
Transfer Mode: Passive

Hopefully this should then log in!

0