0

I am in a very very upset situation. My program worked 100% fine when it is in netbeans, but when I build it it has some issues. That is, in my program, there is an one interface and 10 implementation classes. Program calls correct correct implementation class based on how the user save the file (eg: if user save it as game.yellow, it will call "YellowImpl.java", if saved as game.red, then "RedImpl.java" likewise).

But when it is built, it is calling everything fine, instead YellowImpl!! Which means, if the user saves it as game.red, it will call "RedImpl" correctly and same to all other implementations instead YellowImpl. When the user save the file as game.yellow, the program do nothing!!! But this is not happening when it is inside the netbeans! I tried clean and build too, still not good! What is causing this ? Please help!

However, I am unable to provide the code, because it has lot of codings

PS: I am using some libs too

PeakGen
  • 21,894
  • 86
  • 261
  • 463

3 Answers3

1

It's difficult to understand exactly what issue you are having with your explaination and no code. However I assume you are having issue with implementation naming conventions.

Perhaps the below link can help.

Java Interfaces/Implementation naming convention

Community
  • 1
  • 1
Rhys
  • 2,807
  • 8
  • 46
  • 68
0

I am agree with @Rhys: it is hard to understand what happens in your application. Just let me give you an advice: do not think (even for 1 second) that there is a bug in java compiler, JVM etc. It is definitely your bug.

How to find it? I suggest you to use remote debugging. Run your application outside IDE (NetBeans in your case) with enabled remote debugger, connect to it with net beans and debug your application. I believe you will fined the problem within minutes.

How to enable remote debugging? Add the following long string to your java execution command line:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

If something happens in very beginning of your program execution use suspend=y.

Now connect to this application from NetBeans. It is simple, just configure it to port 8000 according to the configuration of your application.

That's it. Good luck.

AlexR
  • 114,158
  • 16
  • 130
  • 208
0

Thanks a lot for the replies guys. However, I managed to find the issue. That was a simple, capital case!! I have a package called "kolor" and all the implementations are inside that. In my "YelloImpl" class, I have mentioned the package as "Kolor" (Note that "K" is capital). It was fine in netbeans, but outside it wasn't. After clearing this out, everything went fine. Thanks all for the replies again.

PeakGen
  • 21,894
  • 86
  • 261
  • 463