java

Shaping my career.. Comments on Java for webapps..

Hello All.. This time in life.. I have the option and time to move my career into a different technology and into corporate organizations. I was doing LAMP based web programming but with no seriousness. Now I want to revamp my tech skills by learning proper enterprise technologies. J2EE was always in my mind but now I think Java is an ov...

java binary search tree

Hello. I have a question about how would I remove a child from a node (root)? Since I can't call remove, if I make the child null, will the children of that child move up? Like, would I just initialize it as null?? Or would I point to the child's child? ...

Is there a Java parser for the Java language?

I'm looking for a java library that allows me to parse a java source file and that gives me an AST representation of the code. Actually I'm only interested in the class and method definitions with their annotations. I don't need the AST of the method code. I'm using this information for code generation. This is why I can't compile the ...

What is the shortest way to get log4j initialized in your main method?

I want everything to log to the console and don't want to have to deal with creating log4j.xml files, etc. I am prototyping some libraries and want to see their full log output. I would like to keep it as pure as possible and not have to introduce unnecessary dependencies like Spring, etc. ...

PHP or Java for e-commerce

In developing a web application that will handle credit cards, purchases, digital downloads, is there any real world benefit to using Java over PHP? This will be a store that sells digital downloads. ...

Type Passing / Changing

public abstract class ASTNode3 extends ASTNode { ASTNode child1; ASTNode child2; ASTNode child3; public ASTNode3(ASTNode c1, ASTNode c2, ASTNode c3) { child1 = c1; child2 = c2; child3 = c3; } public ASTNode getChild1() { return child1; } public ASTNode getChild2() { return child2; ...

Unknown Problem with Java Generics

Hey Im trying to use generic types for the first time in Java , as I only want my constructor to accept classes that implement the "Anealable" interface. theres a problem with my code by the only error I get is "Illegal start of Type" which is not getting very far with trying to make it work here is the code for my class package simul...

Parsing JSON Object Array

Hello All, I am very new to using Jquery and Json. I have a servlet that is returning an array of JSONObject's ( basically a JSONArray object ). I am trying to parse this array within JavaScript and am running into trouble here. I have a javascript variable "var result" that gets the result from the servlet and I am trying to parse it...

Is there a way to improve this pointcut?

I have come up with the following pointcut that I use for tracing method entry/exit. It's not broken and also does what I want but: 1- I find it looks clumsy or could be more elegant; and 2- I don't know if it is bulletproof. // tracing the execution of all methods except: // - toString and descendants // - methods identified with @NotT...

What are some good plugins for developing Java in VIM?

I love vim, but not having things like IntelliSense/Code completion from Eclipse makes it pretty difficult. I know, I know, I should be able to look at method signatures and java docs for the API I am interested in using. I'd love to, but I'd like it to be accessible from my fingertips instead of having to browse the source tree manually...

How to specify a target package for ANTLR?

If I call: java org.antlr.Tool -o outdir sources/com/example/Java5.g ...with antlr-3.1.3 the parser and lexer code will be generated in the directory outdir/sources/com/example. But the generated classes don't have any package statement. I need them to life in the package com.example. Is there a way to specify the target package? ...

How do I call a permanent command prompt?

In Windows, I made a small script to compile and then run a Java application: javac helloWorld.java java helloWorld helloWorld prints "Hello, world!" and then the command prompt closes immediately. What I want to happen is for the program to execute then have a new line on the command prompt ready to go. EDIT: 1 more stipulation. It ...

How To Use ZXing C# Port

NOTE: My original question was about whether the ZXing C# port is reliable, but here, I'm trying to figure out how to use it. Thus, they are not duplicates. I'm trying to use the ZXing C# module, but I'm having trouble. Does anyone who has used ZXing before know how to do it correctly? Unfortunately, the C# documentation is quite small....

[Java] How to get rid of the flicker that appears during my animation ?

Hi, I'm learning Java by making a small game in a JApplet. I got a little problem with my sprite's animation. Here is the code : this.sprite.setBounds(0,0,20,17); this.sprite.setIcon(this.rangerDown); for(int i = 0; i< 16;i++) { this.sprite.setBounds(this.sprite.getX(), this.sprite.getY()+1, 20, 17); this.sprite.update(this.s...

Is there a possible Control for this?

I'm currently using net beans with Java to work on a senior project. Essentially the program is going to create word search puzzles. While I'm still a few weeks from needing a solution, I'm having difficulty thinking of a possible control that could display a word search puzzle (not to be mistaken for a crossword puzzle). ...

Hibernate many-to-many association with the same entity

Another Hibernate question... :P Using Hibernate's Annotations framework, I have a User entity. Each User can have a collection of friends: a Collection of other Users. However, I have not been able to figure out how to create a Many-to-Many association within the User class consisting of a list of Users (using a user-friends intermedia...

Java, Netbeans: How come the GUI looks different?

I'm a Java/Netbeans newbie learning how to make a GUI. I was following this tutorial, and I noticed that the "finished" product (first picture in that link) doesn't look like the GUI built through the steps. Why is that? I mean, when I click on the preview button, the GUI looks native (nice) as well. It's just when it's deployed that i...

Project Euler #3 Java Solution Problem

class eulerThree { public static void main(String[] args) { double x = 600851475143d; for (double z = 2; z*z <= x; z++) { if (x%z == 0) { System.out.println(z + "PRIME FACTOR"); } } } } and the output is: 71.0 839.0 1471.0 6857.0 59569.0 104441.0 486847.0 So, I assume 486847 is the...

Why are Runtime Exceptions "unchecked" in Java?

Why does it make sense to have Runtime Exceptions UnChecked (as opposed to if they were Checked)? ...

Java for J2ME mobile development

I am planning to start some Java mobile phone development. I downloaded the wireless toolkit, but it asks for the Java SE SDK. I have got to this page - http://java.sun.com/javase/downloads/index_jdk5.jsp. Is a JDK the smae as an SDK? what do they stand for? On the page I think I will need to download the "JDK 5.0 with Java EE". What doe...