• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble compiling on linux

 
Gavin Jhonson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use a script found on: http://asterisk-java.org/development/tutorial.html#The%20Manager%20API

It reads as follows (with default info back in place):




When I compile like so: javac -cp asterisk-java.jar HelloManager.java


I get these errors:

HelloManager.java:2: package org.asteriskjava.manager does not exist
import org.asteriskjava.manager.AuthenticationFailedException;
^
HelloManager.java:3: package org.asteriskjava.manager does not exist
import org.asteriskjava.manager.ManagerConnection;
^
HelloManager.java:4: package org.asteriskjava.manager does not exist
import org.asteriskjava.manager.ManagerConnectionFactory;
^
HelloManager.java:5: package org.asteriskjava.manager does not exist
import org.asteriskjava.manager.TimeoutException;
^
HelloManager.java:6: package org.asteriskjava.manager.action does not exist
import org.asteriskjava.manager.action.OriginateAction;
^
HelloManager.java:7: package org.asteriskjava.manager.response does not exist
import org.asteriskjava.manager.response.ManagerResponse;
^
HelloManager.java:11: cannot find symbol
symbol : class ManagerConnection
location: class HelloManager
private ManagerConnection managerConnection;
^
HelloManager.java:17: cannot find symbol
symbol : class AuthenticationFailedException
location: class HelloManager
public void run() throws IOException, AuthenticationFailedException,
^
HelloManager.java:18: cannot find symbol
symbol : class TimeoutException
location: class HelloManager
TimeoutException
^
HelloManager.java:14: cannot find symbol
symbol : class ManagerConnectionFactory
location: class HelloManager
ManagerConnectionFactory factory = new ManagerConnectionFactory();
^
HelloManager.java:14: cannot find symbol
symbol : class ManagerConnectionFactory
location: class HelloManager
ManagerConnectionFactory factory = new ManagerConnectionFactory();
^
HelloManager.java:20: cannot find symbol
symbol : class OriginateAction
location: class HelloManager
OriginateAction originateAction;
^
HelloManager.java:21: cannot find symbol
symbol : class ManagerResponse
location: class HelloManager
ManagerResponse originateResponse;
^
HelloManager.java:22: cannot find symbol
symbol : class OriginateAction
location: class HelloManager
originateAction = new OriginateAction();
^

Other info:

java -version:
java version "1.7.0"
IcedTea Runtime Environment (build 1.7.0-b21)
IcedTea Client VM (build 1.7.0-b21, mixed mode)

fedora release 8

I am sure I am over looking some small thing, any input is appreciated. Thanks in advance!!




 
Aneesh Vijendran
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to include the jar (Which contains org.asteriskjava.manager package) in the classpath when you compile.

Cheers
Aneesh
 
Gavin Jhonson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You!! That fixed it

Now I am trying to run my script, and I am getting an error:

Rx << verbose "Failed to execute '/var/lib/asterisk/agi-bin/HelloManager.java': Exec format error" 1

This is running in an Asterisk dialplan, but my java script is the problem

Could someone please help me solve this? Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you're trying to run a source file. You should run the compiled output.
 
Gavin Jhonson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, Thanks for your speedy reply!!

That solved it! It's no quite perfect yet, but getting there!!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem :)
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please find the Code Button; I have edited your original post, since you are new, so you can see how much better it looks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic