On 5/14/12 7:07, Tayeb Cherfouh wrote:
this is all i seem to have as result!

c:\classes\tutorial\exp1>javac -classpath
D:\felix-framework-4.0.2\bin\felix.jar

javac: no source files
Usage: javac<options>  <source files>
use -help for a list of possible options

You need to do something like:

    javac -classpath d:\felix-framework\bin\felix.jar -d c:\classes *.java

But as Neil points out, you might be better of starting from a Java tutorial to understand what is going on there first before jumping into OSGi development, since your difficulty arises from not understanding how to develop with Java on the command line.

-> richard


2012/5/14 Tayeb Cherfouh<[email protected]>

thanks a lot Ken :) i ll give it a try right now


2012/5/14 Ken Gilmer<[email protected]>

Hi Tayeb,

  To compile your java program you need to tell javac where the classes
that your code references are located.  Specifically the classes that are
not part of the standard Java library, such as Felix.  If you run "javac
-help" you can see all the parameters it takes.  You'll find this line
helpful:

-classpath<path>           Specify where to find user class files and
annotation processors

So if you use this parameter to specify where the felix.jar is located,
the
"package<x>  does not exist" errors should be resolved.  You may need to
do
this for multiple jars depending on what classes your program references.

hth,
ken

On Mon, May 14, 2012 at 5:10 AM, Tayeb Cherfouh<[email protected]
wrote:
Hi guys,
i am new at this world and i ve downloaded the felix framework, jdk and
sdk... well after that i ve started the apache tutorials with N°1:
Apache
Felix Tutorial Example
1<http://felix.apache.org/site/apache-felix-tutorial-example-1.html>:
A bundle that listens for OSGi service events.
it was great i ve learned much as i was writing the code and things, but
when i went to the cmd so i can compile it i just got lost!
first off what did they mean when they say to have felix.jar in the
class
path?
second off this is what i get if i try to compile:

c:\classes\tutorial\exp1>javac -d c:\classes *.java
Activator.java:7: error: package org.osgi.framework does not exist
import org.osgi.framework.BundleActivator;
                         ^
Activator.java:8: error: package org.osgi.framework does not exist
import org.osgi.framework.BundleContext;
                         ^
Activator.java:9: error: package org.osgi.framework does not exist
import org.osgi.framework.ServiceListener;
                         ^
Activator.java:10: error: package org.osgi.framework does not exist
import org.osgi.framework.ServiceEvent;
                         ^
Activator.java:16: error: cannot find symbol
public class Activator implements BundleActivator, ServiceListener
                                  ^
  symbol: class BundleActivator
Activator.java:16: error: cannot find symbol
public class Activator implements BundleActivator, ServiceListener
                                                   ^
  symbol: class ServiceListener
Activator.java:24: error: cannot find symbol
        public void start(BundleContext context){
                          ^
  symbol:   class BundleContext
  location: class Activator
Activator.java:32: error: cannot find symbol
        public void stop(BundleContext context){
                         ^
  symbol:   class BundleContext
  location: class Activator
Activator.java:42: error: cannot find symbol
        public void serviceChanged(ServiceEvent event){
                                   ^
  symbol:   class ServiceEvent
  location: class Activator
Activator.java:45: error: cannot find symbol
                if(event.getType() == ServiceEvent.REGISTRED)
                                      ^
  symbol:   variable ServiceEvent
  location: class Activator
Activator.java:49: error: cannot find symbol
                else if (event.getType() == ServiceEvent.UNREGISTRED)
                                            ^
  symbol:   variable ServiceEvent
  location: class Activator
Activator.java:53: error: cannot find symbol
                else if (event.getType() == ServiceEvent.MODIFIED)
                                            ^
  symbol:   variable ServiceEvent
  location: class Activator
12 errors

c:\classes\tutorial\exp1>

it s obvious that i have an issue with the dependencies but how to fix
that
?
i dunno if this would help, but my tutorial java file is saved under
c:/classes/... while my felix-framework is under
d:/felix-framework-4.0.2... does this have anything to do with it? am i
supposed to have the tutorial under felix for instance or something?

cheers,



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to