Archive for the 'java' Category

GetResource().getPath() FileNotFoundException while running from jar

I have some code that works correct when run from Eclipse, but throws FileNotFoundException when run from jar. Even more this code properly worked before but stopped after… I don’t know. May be after some Windows update? Here is the code   1: String path = Thread.currentThread().getContextClassLoader().getResource("stopwords.txt").getPath(); 2: System.out.println(path); 3: BufferedReader input = new BufferedReader(new [...]

The most [java] advanced country

Today i downloaded from sourceforge some java library and occasionally looked on statistics. The first place with 20% from all downloads  takes … China. USA on the second place. India – 3. Spain – 4. And so on.

Component doesn’t fill container on resize

  I have [custom] component that change its width  but not height  on resize. Cause is probably a bug in SWT Designer.  This code was auto generated and produce a problem GroupLayout gl_shell = new GroupLayout(shell); gl_shell.setHorizontalGroup( gl_shell.createParallelGroup(GroupLayout.LEADING) .add(composite, GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE) ); gl_shell.setVerticalGroup( gl_shell.createParallelGroup(GroupLayout.LEADING) .add(composite)//problem here ); that looks like: changing code to : [...]

How to program bots in Java?

  So, what about writing bots in Java? Question only looks hard but have very simple answer: Use: HtmlUnit; Selenium; Using HtmlUnit to writing bots pretty good described.   What is Selenium? Selenium is testing framework that consist of Firefox plugin that can record user’s actions in browser and Java (several another languages as well) [...]

The biggest(30!) list of project hosting sites

I looked for some project hosting site to store my projects. So, I made small research and find several sources already containing such collections. Besides of this I googled for “project hosting” and founded sites also added to result list: Assembla Asynchrony BerliOS bitbacket.org Bounty Source code.google.com codeplex.com/ CodeSpaces freepository GBorg GForge 2 github.com gna.org/ [...]

Sad history of Twitter follow software

There are many Twitter follow-unfollow applications available. Some of them simply the bots that parse and interact with Twitter pages but some used Twitter API. Long time Twitter was very soft with his follow unfollow automation policy and only last days his politic was changed. Follow-Unfollow automation fully prohibited. Accounts that used some third party [...]

How to set hand cursor to all buttons

In nowadays web oriented world users expectations are that desktop application behave like web application. And part of this that cursor must be changed when moving over button and checkbox controls. Next code snippet satisfied needs:

How to create hyperlink in desktop application

Suppose, we need link (hyperlink) in our desktop swing application, and clicking it should open specified page in default browser. Try this code:

How to create underlined label

Suppose, we need underlined label in our swing application. java.awt.Font doesn’t have this option. But next code solves the problem: JLabel clickItLabel = new JLabel(“<html><u>Click It</u></html>”)

How to start desktop application with Netbeans

Netbeans is great software. But sometimes very confusing. Netbeans have great java swing GUI editor with drag and drop palette. Use it. It is very helpful. Netbeans have also Java Desktop Application option: File -> New Project -> Java -> Java Desktop Application – don’t use it. It seems to be helpful but creates more [...]

How to make multilined label

I want text on my JLabel object displayed in two lines. Next code does do the work: label.setText(” <html> first line <br> second line </html>”);

How to remove component from container

Suppose we have JPanel with name panel and JButton with name button on it. Try this code:

How to refresh PHP project in Netbeans

I used to use netbeans for php development. Sometimes it more simple to enter new files directly to project folder without using IDE. But these files is not viewable in IDE. There is a lack of refresh button for netbeans php project menu. Workaround is very simple: right click on -> Properties -> Ok. This [...]

Another stone in the hornet’s nest of java haters

Below is Google Software Engineer job description. Morality in the narrow sense: you can’t be GOOGLE software engineer without knowledge of Java. Morality in the broad sense: you can’t be GOOD software engineer without knowledge of Java.

Java os.name property values

Java os.name property values Below are list of all Java os.name property values in alphabetical order. AIX Digital Unix FreeBSD HP UX Irix Linux Mac OS Mac OS X MPE/iX Netware 4.11 OS/2 Solaris Windows 2000 Windows 95 Windows 98 Windows NT Windows Vista Windows XP

Build errors in Netbeans editor but Maven build successful

I get build errors in netbeans editor and project view now, although when I Clean Build the project I get Build successful in the output log. Whose fault is it? I don’t know. What to do? Open <your project> properties –> Sources and ensure that source format is the same as jdk you use. Press [...]

The plugin does not exist or no valid version could be found

Maven says: “The plugin does not exist or no valid version could be found”, but plugin present in your local repository. Whose fault is it? I don’t know. What to do? Try to delete plugin from local repository in order to enforce Maven to download it again.

Sequence of learning Java programming

1. Java Core or Java Basics (syntax, collections, threads, i/o etc.). 2. HTTP basics. 3. HTML, CSS and JavaScript basics. 4. JSP and Servlets. 5. Spring MVC, Spring IoC and Hibernate. 6. Persistence code generation and Domain Driven Frameworks.

Java persistence code generation tools

Java DAO generators review I need DAO generator (tool for persistence code generation). For what? I have third party application with database backend and I want to write my own application for insert/browse data to/in database. So i need framework that can create whole application or possible only DAO level from database schema. I prefer [...]

Inversion of Control (IoC) in few simple words

What does IoC means?


Wordpress Seo Plugin