wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Trouble compiling on linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trouble compiling on linux" Watch "Trouble compiling on linux" New topic
Author

Trouble compiling on linux

Gavin Jhonson
Greenhorn

Joined: Aug 04, 2010
Posts: 3
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

Joined: Jun 29, 2008
Posts: 125
You have to include the jar (Which contains org.asteriskjava.manager package) in the classpath when you compile.

Cheers
Aneesh


Cheers
Aneesh
Gavin Jhonson
Greenhorn

Joined: Aug 04, 2010
Posts: 3
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

Joined: Sep 29, 2008
Posts: 12617

It looks like you're trying to run a source file. You should run the compiled output.
Gavin Jhonson
Greenhorn

Joined: Aug 04, 2010
Posts: 3
Wow, Thanks for your speedy reply!!

That solved it! It's no quite perfect yet, but getting there!!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No problem :)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38509
    
  23
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.
 
wood burning stoves
 
subject: Trouble compiling on linux