LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   I need some help understanding some java results. Fedora14 (https://www.linuxquestions.org/questions/programming-9/i-need-some-help-understanding-some-java-results-fedora14-871368/)

rmknox 03-27-2011 10:49 PM

I need some help understanding some java results. Fedora14
 
I need some help understanding some java results. I am not a java expert.

I am trying to run antelope from a download. Antelope is a java ant buildfile editor. I have run into a problem and would like to learn from solving it.

My understanding of the traceback below is that java complains that it can not find org.apache.tools.ant.input.InputHandler
. Maybe I don't interpret the trace-back correctly – my how complex they have become since the introduction of thrown exceptions.

I find the class Input.InputHandler in a number of ant.jar files. I have tried in various ways to point to these jar files – no result. In this case I extracted the class file from one of the jar files, put it in the same directory as the antelope.jar file and gave option -cp InputHandler – and still I get the same error.

Can someone give me some suggestions?

Dick

Code:

## here is what is in the directory

[knox@knox AntelopeApp_3.5.1]$ ls

AntelopeApp.jar  ChangeLog.txt  InputHandler.class  install.txt  javad  license.txt  preftool.preferences  run.xml


## here I invoke java

[knox@knox AntelopeApp_3.5.1]$ java -cp InputHandler -jar AntelopeApp.jar


## here is what it says to me

ANT_HOME: /usr/share/ant/lib

JAVA_HOME: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre

Antelope debug log: /home/knox/antelope_debug.log

java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:616)

        at ise.antelope.launcher.SubJarClassLoader.invokeMainClass(Unknown Source)

        at ise.antelope.launcher.Launcher.runApp(Unknown Source)

        at ise.antelope.launcher.Launcher.main(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: org/apache/tools/ant/input/InputHandler

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:480)

        at ise.antelope.launcher.SubJarClassLoader.findClass(Unknown Source)

        at ise.antelope.launcher.SubJarClassLoader.loadClass(Unknown Source)

        at ise.antelope.launcher.SubJarClassLoader.loadClass(Unknown Source)

        at ise.antelope.app.Antelope.init(Unknown Source)

        at ise.antelope.app.Antelope.<init>(Unknown Source)

        at ise.antelope.app.Antelope.main(Unknown Source)

        ... 7 more

Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.input.InputHandler

        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)

        at ise.antelope.launcher.SubJarClassLoader.loadClass(Unknown Source)

        at ise.antelope.launcher.SubJarClassLoader.loadClass(Unknown Source)

        ... 16 more

[knox@knox AntelopeApp_3.5.1]$


paulsm4 03-27-2011 11:32 PM

Just a shot in the dark, but try this:
Quote:

java -cp . -jar AntelopeApp.jar InputHandler
or, better:
Quote:

java -jar AntelopeApp.jar

rmknox 03-28-2011 09:40 AM

paulsm4

tried your "shot" and got the same result - both times

for what its worth, when I run javap on the InputHandler in the directory I get
Code:

[knox@knox AntelopeApp_3.5.1]$ javap -c InputHandler
Compiled from "InputHandler.java"
public interface org.apache.tools.ant.input.InputHandler{
public abstract void handleInput(org.apache.tools.ant.input.InputRequest)  throws org.apache.tools.ant.BuildException;

}

no bytecode and an abstract sub class - so as I understand it it requires an implementation of handleInput - but I dont know where to go with this

paulsm4 03-28-2011 10:05 AM

Hi -

Please look at this link about Java "packages":
http://www.jarticles.com/package/package_eng.html

Two suggestions:
1. Try this syntax:
Quote:

java -cp . -jar AntelopeApp.jar org.apache.tools.ant.input.InputHandler
2. If that doesn't work, you might actually have to create a subdirectory "org/apache/tools/ant/input/" and copy your InputHandler.class file into it.

'Hope that helps .. PSM

rmknox 03-28-2011 10:21 AM

PSM

I tried the syntax and also the sub directories - exactly the same result.

thanks for the suggestions

dick

i will spend some time with the tutorial - it deals with issues i dont fully understand yet.


All times are GMT -5. The time now is 03:25 AM.