Calling java problem

I have a simple java file, the jar is in my bundles directory

public class FirstJavaProgram4 {
  public String mytest(String[] args){
    return "Success! from mytest()";

when I dump it I can see the method: mytest()

<cfset variables.javatest = CreateObject("java", "FirstJavaProgram4", "FirstJavaProgram4", "1.0.0")>
<cfdump var="#javatest#">

However when I call it I get No matching Method for mytest() found for FirstJavaProgram4

<cfset variables.javatest = CreateObject("java", "FirstJavaProgram4", "FirstJavaProgram4", "1.0.0")>
<cfdump var="#javatest.mytest()#">

I created a manifest:
Manifest-Version: 1.0
Created-By: 1.8.0-ea (Oracle Corporation)
Main-Class: FirstJavaProgram4
Bundle-Name: FirstJavaProgram4
Bundle-SymbolicName: FirstJavaProgram4
Bundle-Version: 1.0

To create the jar I first compiled it: javac
Then the jar:
jar cmf FirstJavaProgram4.jar FirstJavaProgram4.class

jar can be found here:

I can’t see why this isn’t working, any ideas?


Try passing in a string as the argument?

already tried that…(also just tried lowercasing everything, so that doesn’t appear to be the problem)

Found the problem!!
It was expecting an array.

public String mytest(String[] args)

so this works:

<cfdump var="#javatest.mytest(['hello'])#">
1 Like