Archive

Archive for the ‘Articles’ Category

Execute external process from within JVM using Apache Commons Exec library

Executing external command from within JVM often causes problems- be it in terms of the code to write and manage or in the ease of implementation. I had similar requirement in my Major project for my Under Graduate Degree, where in I had to launch a C program from the Java code. I ran into different issues like- the Main thread getting blocked, the GUI freezing, or reading the output streams and so on. Finally I had to give up the idea and stick with launching the external command externally ūüėõ Had I found the Exec library from Apache Commons then, my work would have been lot easier. Anyways better late then never. I will quickly go through how one can use Exec library to launch external programs from JVM- Its a wrapper over Java’s ProcessBuilder, Runtime.getRuntime().exe(). Read more…

Advertisements

Working with Java Enumerated types (Enums)

December 1, 2009 10 comments

In this post I would like to explain about Enums in Java. Though in my 2 years of coding in Java I have seldom used Enums but they do provide a lot of features when we are required to create a say limited instances of certain type. In this post I have made use of an example written out of inspiration from the example program given in “A Programmer’s Guide to Java SCJP certification” by Khalid A. Mughal and Rolf W. Rasmussen. The example is given in the Section Enumerated Types. I will be developing the Enum as we go through the article.

What is an Enumerated Type or Enum tpye? Enum Type defines a finite set of symbolic names and their values. Suppose we have to define 3 constants- LOW, MEDIUM and HIGH to denote the 3 speeds of Rotation. We can do it by declaring static final variables as follows-

class Speed{
   public static final int LOW=1;
   public static final int MEDIUM=2;
   public static final int HIGH=3;
}

Read more…

Core Java Refcardz by Cay S. Horstmann

November 12, 2008 Leave a comment

This refcard gives you an overview of key aspects of the Java language and cheat sheets on the core library (formatted output, collections, regular expressions, logging, properties) as well as the most commonly used tools (javac, java, jar).Core Java

Features include Java Keywords, Standard Java Packages, Character Escape Sequences, Collections and Common Algorithms, Regular Expressions, JAR Files and more.

To download the Refcardz click here.

Categories: Articles Tags: , , ,

JavaFX Important Links

General:

  1. JavaFX Homepage: http://javafx.com/ 
  2. OpenJFX’s Homepage: https://openjfx.dev.java.net/¬†
  3. The JavaFX Community: http://jfx.wikia.com/wiki/The_JavaFX_Community 
  4. Useful Links from PlanetJFX: http://jfx.wikia.com/wiki/Tutorials 
  5. Downloads for JavaFX: http://java.sun.com/javafx/downloads/ 
  6. JavaFX Script Language Support for NetBeans IDE: http://javafx.netbeans.org/ 
  7. JavaFX Technology Screencasts: http://java.sun.com/javafx/screencasts/index.jsp 
  8. SDN JavaFX Site: http://java.sun.com/javafx/index.jsp 
  9. JavaFX Script Overview: http://www.sun.com/software/javafx/script/index.jsp 
  10. JavaFXPad: http://www.javafxpad.com/

Articles:

  1. Creating Rich Internet Applications With Compiled JavaFX Script Technology: http://java.sun.com/developer/technicalArticles/scripting/javafx/ria_1/
  1. JavaFX FAQ’s: http://java.sun.com/javafx/faqs.jsp
  1. FAQ’s at the Home page: http://javafx.com/¬†
  2. Creating GUIs using JavaFX: http://java.sun.com/javafx/reference/creating_guis/ 
  3. Using Java Objects within JavaFX Programs: http://java.sun.com/developer/technicalArticles/scripting/javafx/javafx_and_java/

Blogs:

  1. James Weaveer’s JavaFX Blog: http://learnjavafx.typepad.com/weblog/
  1. Chris Oliver’s Weblog: http://blogs.sun.com/chrisoliver/category/JavaFX¬†
  2. JavaFX Blog: http://blogs.sun.com/javafx/
  3. Kirill Grouchnikov’s Blog: http://www.pushing-pixels.org/¬†
  4. Silveira Neto’s Blog: http://silveiraneto.net/

Tutorials:

  1. The JavaFX‚ĄĘ Script Programming Language Reference (Draft): http://openjfx.java.sun.com/current-build/doc/reference/JavaFX-Language.html¬†
  2. Learning Curve:
    Part 1: http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part1/
    Part 2: http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part2/
    Part 3: http://java.sun.com/developer/technicalArticles/scripting/javafx/lc/part3/
  1. JavaFX Script Programming Language Migration Guide: https://openjfx.dev.java.net/migration.html
  1. Sang Shin’s Tutorials: http://www.javapassion.com/javafx/#JavaFX_Technology_Overview

Code Samples:

  1. JavaFX Code Samples and Apps: http://java.sun.com/javafx/reference/samples/ 
  2. Simple Calculator Example: http://www.ibm.com/developerworks/java/library/j-javafx/
Categories: Articles Tags: , ,

Using Notepad++ to Compile and Run Java Programs

I had been using Notepad– The one that comes with Windows for a long time for writing Java programs and then running it through command line, though i had Notepad++ installed on my system. But then it just flashed to me that “Why can’t i try Notepad++ for compiling and interpreting the Java programs“. I searched in the FAQs under “Running External Tools” and found useful information which has helped me to compile and run the Java programs right from the “Notepad++” application itself. Here’s how it can be done:

Running External Tools in Notepad++:
External tools can be executed by passing the current edited document as argument. For doing this the “environment variable” is used
Read more…

Java vs.NET – Articles by Bruce Eckel

There are two articles by Bruce Eckel in which he has spoken in brief about C# / .NET and Java. These two are pretty old articles but i feel they are worth reading once, pretty small write ups. Bruce Eckel is the author of famous Thinking in sreis- Thinking in C++ and Thinking in Java.

Article 1- Java vs. .NET

Article 2- C#, Java and Joshua Bloch

Note: The articles are pretty old, written some 5 years back. Anyone with more interesting articles can share them as comments. I stumbled across these when i was going through Bruce Eckel’s Old and new Weblogs. They are a pretty interesting to read.

Categories: Articles Tags: , , , , ,

C Programming VS. Java Programming

June 28, 2008 1 comment

I wanted to know how C and Java differ from each other. So i just googled for “C Versus Java” . The first Link itself led me to an interesting Description. I thought of sharing it with my readers. Pretty good Comparision of C and Java. One can read the comparision here.

PS: If anyone has similar links disscussing the differences between C and Java or C# and Java or C++ and Java, do share it as a comment.

Categories: Articles Tags: , ,