0

I have managed to get the sample projects for the JNI4NET tool working by generating some Java proxy classes with the ProxyGen.exe program supplied with it.

I am now trying to translate this working sample into a small test. So far I have created a simple Java class and compiled it into a Java class library jar file. I have done this in Netbeans using Java 1.7 Platform.

The class is below

public class Person 
{
    public String GetName()
    {
        return "Nobody";
    }
}

The output from ProxyGen simply states

Can't load class Person

Judging by the output I have to assume that ProxyGen has read the jar and recognized the class Person is present but, as it says, "can't load it". Which I am not exactly sure what that means or how its failing.

I feel like I need to supply the .class/.java file to ProxyGen, though this is not done in the sample (which is working). So does this issue possibly have to do with how the jar is compiled? Which again doesn't make sense because as I understand it you can simply unzip jar files to view the source classes?..

Any ideas?

KDecker
  • 6,928
  • 8
  • 40
  • 81

1 Answers1

1

Perhaps your JAVA_HOME points to JRE older than 1.7. That is used by proxygen.exe. The old JVM could not read the .class files ? Just guess.

Pavel Savara
  • 3,427
  • 1
  • 30
  • 35
  • I'll check to make sure, but I actually had to set the JAVA_HOME when I had started working on this. But I might have set it to an older Java 7 version. – KDecker Dec 09 '16 at 13:55
  • I have confirmed that the test jar is compiled under 1.8 and that the version reported from `java -version` is also version 1.8. I did notice that the latest version of ProxyGen might require 1.5, can you confirm that ProxyGen needs this version or should it work with later versions? – KDecker Dec 15 '16 at 21:11