File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes The .class file compiled in Windows does not work in Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "The .class file compiled in Windows does not work in Unix" Watch "The .class file compiled in Windows does not work in Unix" New topic
Author

The .class file compiled in Windows does not work in Unix

Pankaj Poshirkar
Ranch Hand

Joined: Dec 31, 2009
Posts: 52
Dear All,

I am facing a weird problem. I can run a .java file named ReconcileCashPoint_10.java (with a main() function in it) on my workspace on my local pc which runs on Windows. The IDE I am using is RAD 7.
But when I send the corresponding .class file to people to get it run on an Unix machine, it throws me this exception:

Exception in thread "main" java.lang.NoSuchMethodError: nl/somebank/cpi/manager/CPIMessageManager.getRowcount(Ljava/lang/Class;)I

at nl.somebank.someservices.request.ReconcileCashPoint_10.processMessages(ReconcileCashPoint_10.java:92)

at nl.somebank.someservices.request.ReconcileCashPoint_10.main(ReconcileCashPoint_10.java:224)

I am amazed by the fact the the same class file works on my Windows machine but it doesn't work in Unix. Java is known for being Platform Independent language for its bytecodes to work on any platform, then why such an exception?

Just for your information, when I try decompile (through jad) the above .class file (i.e ReconcileCashPoint_10.class) on my local machine, the generated .jad file shows a weird signature for the statement: CPIMessageManager.getRowcount(nl/somebank/cpi/bean/CPIMessageDTO);

The actual statement in the .java file is CPIMessageManager.getRowcount(CPIMessageDTO.class);

Is this issue related to OS-JVM incompatibility? I am not able to figure out what the problem is.

Does anyone have any idea about it? Everybody is waiting for me to solve this problem.

Thanks,
Pankaj
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16681
    
  19


Generally, these types of errors are caused by having different versions of classes in the classpath. And sometimes, even a different ordering of classes in the classpath.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: The .class file compiled in Windows does not work in Unix
 
Similar Threads
Java Virtual Machine
Strange Problem in Running Jar!
Working with Java in UNIX
NoClassDefFoundError
Running a Java Class from a Unix Shell Script