Hey Guys im trying to call a Java-Object in Octave. The Javaclasspath and everything else is set.
When i try to call a own created function like this:
First, double check that the .jar or .class file is in Octave's java path. Use this Octave command:
javaclasspath
It should output something like this:
STATIC JAVA PATH
./path/to/your_file.jar
./path/to/your-other-file.class
DYNAMIC JAVA PATH
- empty -
If you don't see your .jar or .class file here, you can add it to either your static or dynamic path. There are known issues with dynamic path, so I'd recommend using the static path. One way to do that is to create a javaclasspath.txt. The format of that file is one line per classpath. Example content:
./path/to/your-file.jar
./path/to/your-other-file.class
(Be sure to include ".jar" or ".class" in the filenames.)
Here's where Octave looks for that file, in order:
More info here.
Since your Server_Client class is part of the server_console package, I'm guessing you might be using a .jar file. Let's make sure it's packaged correctly. Run
jar tvf path/to/your-file.jar
Since you're trying to access the class server_console.Server_Client, you'll want to see something like this in the output:
0 Wed Sep 30 08:11:58 EDT 2015 server_console/
1893 Wed Sep 30 08:11:58 EDT 2015 server_console/Server_Client.class
You can also test your .jar file with this command:
java -cp ./path/to/your-file.jar server_console.Server_Client
If your .jar file is not packaged correctly, you'll see this output:
Error: Could not find or load main class server_console.Server_Client
If your .jar file is packaged correctly and you have a main method, the main method will be run.
If your .jar file is packaged correctly and you don't have a main method, you'll see this output:
Error: Main method not found in class server_console.Server_Client, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application