Posts

Showing posts with the label Java

JavaOne 2014

It was nice to get back to San Francisco for another JavaOne.  This year did not surprise me in any way with announcements but it did feel like a JavaOne filled with energy and enthusiasm.  I think getting Java 8 out and accepted was the primary reason but there are other significant ones. First off, being a NetBeans fan, I very much appreciated NetBeans day and sessions throughout the conference in which it was mentioned and utilized.  While I have known my way around Eclipse for years (and I have used Intellij), when I tell folks I prefer to use NetBeans I get an occasional strange look or question but that's becoming less so. If you don't know about NetBeans, I suggest downloading and giving it a serious look.  If it's the choice of James Gosling and guys who write code for NASA, how can you not check it out?   Geertjan Wielenga, the guy I consider the face of NetBeans, was very visible at JavaOne/NetBeans Day this year (as were quite a few others from t...

Five Favorite NetBeans IDE features

Image
Thinking about it earlier today, I have been using NetBeans before (or after actually) it was called NetBeans.  I say after, because I remember using Forte but it was called NetBeans before and after Forte.  To put that into some perspective, some years ago I was at a JavaOne (2002?) at a Meet the Forte Tools Experts session.  NetBeans has come along way since those days but I recall seeing a lot of promise which has been a reality for a long time now. The first thing I liked, and still like, about NetBeans was that it has a familiar look.  This may be because I was a long time Delphi and JBuilder user, both Borland IDEs, and NetBeans was, at least to some extent, inspired by Delphi's IDE style and functionality.  NetBeans feels natural to me and I think it is generally very approachable for new developers. Out-of-the-box functionality is my second reason for liking NetBeans.  I install the full version of NetBeans on OS X, Linux, and Windows and I am ...

JNLP: note to self

Java security was a hot topic in 2013 and I think it will continue to get some attention as tooling catches up to the newer requirements.  Signing the JNLP for Java Web Start programs is now required. The Java Web Start maven plugin does not yet sign the JNLP file but there is an outstanding issue which I imagine will be resolved before too much longer. In the meantime, this blog entry  and this stack overflow question and answer  may be all you need to get your JNLP signed correctly. The way I read it, you have two choices. First you can create a template file which should be named APPLICATION_TEMPLATE.JNLP in src/main/resources/JNLP-INF and wildcards are permitted.  This is nice if you have the need to deploy your application from more than one server. The second method involves creating a file named APPLICATION.JNLP also in the src/main/resources/JNLP-INF folder.  This file must match the application's jnlp file exactly. Don't forget to mo...

Glassfish JNDI settings

Image
Recently we had the need to add some configurable settings (such as user credentials) in a Java EE 7 application running on Glassfish 4.0. An example method to read the values might look like this:     private String getUserProperty(String property) {         String result = "";         Properties properties;         try {             InitialContext context = new InitialContext();             properties = (Properties) context.lookup("jndi/userinfo");             result = properties.getProperty(property);             context.close();         } catch (NamingException e) {         }         return result;     } Setting the values via the Glassfish console is achieved via Resources -> JNDI -...

NetBeans 7.4 recent projects

Image
Recently I had the need to remove one project from my recent projects list in NetBeans.  The problem was I had opened a very large project which was causing the    I found a few references to where one might find the file which contains the recent project list for older versions of NetBeans but they seemed to be a little dated.   The file I wanted to find and edit is called projectui.properties I happen to be on a Mac so that file could be found here: ~//Library/Application Support/NetBeans/7.4/config/Preferences/org/netbeans/modules I opened the file with a text editor and looked for the project name in the openProjectsDisplayNames entries.  Each of the entries include a dot followed by a number at the end to make them unique.  Once I found it, I noted the number and deleted that line.   Next I removed the corresponding entries in the openProjectsIcons and openProjectsURLs sections as well. I have a cou...

Complex JAX-RS

Working with JAX-RS to create a REST web service, I recently had the need to accept a List of a complex type as a parameter.  I was not able to find a complete example but I did read some Jersey documentation which I had not looked at in quite some time.  I read the  Jersey Parameter Annotations  section. The issue I was running into was the lack of a constructor for the complex type I wanted to pass in a list as a parameter to a REST web service method.  The documentation made me realize that I did not have a constructor which accepted a single String parameter from which an instance could be properly created. I also had some trouble with JSON marshalling/unmarshalling.  This may be a topic for another time but for now I solved it using the ObjectMapper from Jackson. Ultimately I put a trivial demo app together which is available here .  The application was created using NetBeans 7.4 as a maven web app to run on Glassfish 4.0 for convenience. ...

End of an Era

Given that I have been staying up a bit later than usual in recent weeks to watch my Red Sox successful quest to win another title, my schedule has been slightly off. Among other items, I almost missed the fact that Roger Brinkley recorded his last episode of the Java Spotlight Podcast . The episode, number 150, is a particularly good one IMHO because it's an interview with James Gosling.  Certainly some of what was asked and answered is not necessarily news but it is a very nicely done casual interview with one of our industry greats.  Hearing his perspective and knowing he is happily coding mostly Java using NetBeans made me smile.  Being a positive guy and wanting relative peace and harmony in our field, not to mention the world in general, I really appreciated hearing James say that he feels Oracle has been a good steward of Java. While I agree with the sentiment, I think because many, including James, did not expect it, the FUD-effect has lingered.  When J...

Now THAT's cool

I really do enjoy my job (for the most part) and staying current with technology, while certainly not totally attainable, is something I enjoying trying to achieve. SOA, NoSQL databases, new(ish) mobile development are a few of the technology spaces that grab my regular interest these days.  Every now and then something comes along that literally makes me fire off a positive email, tweet, blog entry, or comment to colleagues. I am very much aware of the future potential of cloud IDEs and codenvy is not something that's been off my radar.  A short while ago I got an email from codenvy that made me say "wow, now that's cool." Check it out...codenvy will now let you create an app, from a template, instantly, and without even signing in. They have built technology which creates an app, from a template, in a temporary workspace faster than some folks can get their favorite IDE to (fully) load.  In my case that may well depend upon how many projects I tend to leave ...

ClassCastException: JAXB

Image
A particular Java application I co-developed leverages both SOAP/WSDL and REST web services.  We use maven to manage the build process of this application which has been in production for a few years now.  It's been around long enough to have moved from Java 5 to Java 6 and now Java 7 (with limited testing using Java 8).  We have also had the experience of initially including JAXB jar files with our application and dealing with the "endorsed" directory because JAXB versions were a bit of a moving target for a while. Now that JAXB is neatly included with Java as it should be so we no longer include it.  I thought all of this was behind us (and unfortunately somewhat forgotten) until recently when we added Jersey 1.17 to the application to call some newer REST services. When trying to connect to the server, my stack trace included this: Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bin...

JDeveloper on OS X

Image
When I have time I try to keep up with a variety of IDEs.  JDeveloper is one I have mentioned before (and encountered OS X installation difficulty before as well).  I don't disklike it although it still seems a bit bloated to me but I have not yet tried to tweak the settings. This time ADF was my main reason to give JDeveloper another look.  I downloaded the Generic version because I intended to run it on a Mac (running OS X 10.8.3).  Being a command-line guy my first attempt was a simple java -jar jdevstudio11123install.jar Unfortunately after the initial splash screen, this resulted in a small dialog box with a Exit button.  I could not maximize it to complete the installation process. Next I tried to launch the jar file via the GUI which gave the same results.  Looking around the web, I did find several solutions for this problem but some seemed complicated while others did not address this particular issue.  [My own previous soluti...

Dropwizard and some memories

Not too long ago I was catching up on some Java Posse episodes and I came across the Dot War (what is it good for?) episode. This episode, recorded live at the Roundup, was not what I expected.  Maybe I was not paying attention before I started listening but I thought a Java/.Net discussion was coming.  Instead I was pleasantly surprised to hear the guys talk about container-less application development. Initially I was not so much interested in using any particular technology among those discussed.  It was the idea that we should not necessarily build software using a specific pattern, framework or technology because it's popular or because we know it (insert "hammer-nail" analogy here).  We should, as we once said, do some analysis and design work (a little learning is not a bad idea). What first came to mind was that portion of the software development heritage which took us from single user applications to the internet.  Roughly speaking the single u...

Talking to Swing

We recently saw the need to create an interface to an older Java Swing application.  We don't have access to the backend and currently there is no standards-based interface (e.g. web services) or immediate plans to create one. The application in question was designed for and is delivered with Java 1.3.  This fact limited the possibilities of using off-the-shelf or even pieces of other open source solutions such as Swing testing code. Ultimately we decided to create Swingomatic .  The code is still in development but it is working well enough to consider it viable.  The architecture involves the use of an older release of the  Java Accessibility  and a mini HTTP server which accepts a string of component instructions as an XML string. The project is maven based.  It includes a client library which allows a Swingomatic client to be built in a current version of Java.
Proguard on the Mac... In trying to do a maven build on OS X which includes the proguard plugin for obfuscation we ran into an issue. Three jar files which are included in the runtime library in the Sun, I mean Oracle, Java version are not found. The solution we chose was to create three symbolic links like this (from JAVA_HOME/lib): sudo ln -s ../../Classes/classes.jar rt.jar sudo ln -s ../../Classes/jsse.jar . sudo ln -s ../../Classes/charsets.jar . If you don't know where your JAVA_HOME is, run this command: /usr/libexec/java_home