I want to use Scribe within my Codename One project.
Copied the scribe jar file into the library folder. IDE used is eclipse.
When compiling, I get below error :
[javac] D:\Vasanth\eclipse_workspace\Testing\src\com\goTime\goTimeVideo\Vimeo.java:19: error: package org.scribe.builder does not exist
[javac] import org.scribe.builder.ServiceBuilder;
[javac] ^
[javac] D:\Vasanth\eclipse_workspace\Testing\src\com\goTime\goTimeVideo\Vimeo.java:20: error: package org.scribe.builder.api does not exist
[javac] import org.scribe.builder.api.VimeoApi;
How can I get this issue fixed ?
You can't just place JAR into the classpath of Codename One: http://www.codenameone.com/3/post/2013/07/jaring-and-libraries.html
You need to use the sources or use native interfaces http://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html which support embedding a platform native jar.
Related
I am trying to set up an automatic build system with command line ant.
Using glassFish 4.1 and Netbeans 8.0.2
My command line build I have the following command:
C:\java\NetBeans 8.0.2\extide\ant\bin>ant -f \Java\Temp\myproject\build.xml -Dnb.internal.action.name=build -DforceRedeploy=false -Dbrowser.context=\Java\Temp\myproject\ -Duser.properties.file=C:\Users...\AppData\Roaming\NetBeans\8.0.2\build.properties -Dj2ee.server.home=C:\java\glassfish4\GLASSFISH\ dist
And this is the last part of my output:
[javac] C:\Java\Temp\crmparts\src\java\freedom\bytecode\service\CrmPartsServiceA.java:10: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.Consumes;
[javac] ^
[javac] C:\Java\Temp\crmparts\src\java\freedom\bytecode\service\CrmPartsServiceA.java:11: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.HeaderParam;
[javac] ^
[javac] C:\Java\Temp\crmparts\src\java\freedom\bytecode\service\CrmPartsServiceA.java:12: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.OPTIONS;
[javac] ^
[javac] C:\Java\Temp\crmparts\src\java\freedom\bytecode\service\CrmPartsServiceA.java:13: error: package javax.ws.rs.core does not exist
[javac] import javax.ws.rs.core.Response;
[javac] ^
[javac] C:\Java\Temp\crmparts\src\java\freedom\bytecode\service\CrmPartsServiceA.java:14: error: package javax.ws.rs does not exist
[javac] import javax.ws.rs.GET;
I have no experience with the "Ant", so I have searched and found a lot about it, but I cannot seem to figure out how to get this library added so that the project gets properly build on ant.
I do not use maven or jenkins. My problem is only in those libraries, and the library is already added to projects/libraries.
My question is: how do I my that the Java "ant" compiler does not complain about missing packages (i.e. missing jar files)?
The problem was in my Dj2ee.server.home parameter. I made the correction and it worked.
New-bee in java here.
I'm on an ubuntu 12.04 machine.
I am trying the Twilio API using java to make voice calls from an uiautomator test case and following the instructions provided at https://www.twilio.com/docs/java/install. I downloaded both twilio-java-sdk-3.4.2-with-dependencies.jar and twilio-java-sdk-3.4.2.jar from http://search.maven.org/#browse|1260284827 (pre-built).
I am using Twilio API in an uiautomator java project. I am able to build and run that uiautomator java project without implementing the Twilio API code. But if I try to use the Twilio API library, I get a compile time errors that it could not find the package.
Steps I'm doing:
1-> Open the java project in eclipse
2-> Add the Twilio java library twilio-java-sdk-3.4.2-with-dependencies.jar OR twilio-java-sdk-3.4.2.jar via BuildPath->Configure Build Path->Add External JARs.
I have following line of code to test if I can make the TwilioRestClient object. I have other test functions with the uiautomator and they work fine without this piece of code. Consider the following method in addition to other test methods.
test.java
//Assume all other required libraries are imported
import com.twilio.sdk.TwilioRestClient;
public class testClient extends UiAutomatorTestCase {
public void testMethodGetClient(){
try{
TwilioRestClient client = new TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN");
log.info("client: " + client.getAccountSid());
}catch(Exception e){
log.info(e.toString());
}
}
}
I do not get any reference errors in my code before the comiple/build command. To believe that, if I do client. ,eclipse shows me all the methods available for the client object. So, can I assume here that my import was successful?
Then I go the terminal and execute below command to create the build.xml file:
ubuntu terminal
$> android create uitest-project -n JARNAME -t 1 -p <PATH-TO-PROJECT>
$> ant clean build
Buildfile: <PATH-TO-PROJECT>/build.xml
-check-env:
[checkenv] Android SDK Tools Revision 22.3.0
[checkenv] Installed at <ANDROID-SDK-PATH>
-pre-clean:
clean:
[delete] Deleting directory <PATH-TO-PROJECT>/bin
-check-env:
[checkenv] Android SDK Tools Revision 22.3.0
[checkenv] Installed at <ANDROID-SDK-PATH>
-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.0
[echo] Resolving Build Target for <PACKAGE-NAME>...
[getuitarget] Project Target: Android 4.2.2
[getuitarget] API level: 17
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: <PATH-TO-PROJECT>/bin
[mkdir] Created dir: /<PATH-TO-PROJECT>/bin/classes
-pre-compile:
compile:
[javac] Compiling 33 source files to <PATH-TO-PROJECT>/bin/classes
[javac] <PATH-TO-PROJECT>/test.java:15: package com.twilio.sdk does not exist
[javac] import com.twilio.sdk.TwilioRestClient;
[javac] ^
[javac] <PATH-TO-PROJECT>/test.java:42: cannot find symbol
[javac] symbol : class TwilioRestClient
[javac] location: class <packagename>.Telephony
[javac] TwilioRestClient client = new TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN");
[javac] ^
[javac] <PATH-TO-PROJECT>/test.java:42: cannot find symbol
[javac] symbol : class TwilioRestClient
[javac] location: class <packagename>.Telephony
[javac] TwilioRestClient client = new TwilioRestClient("ACCOUNT_SID", "AUTH_TOKEN");
[javac] ^
[javac] 3 errors
BUILD FAILED
<ANDROID-SDK-PATH>/tools/ant/uibuild.xml:183: Compile failed; see the compiler error output for details.
Total time: 1 second
The above command would create the .jar if I did not have the testMethodGetClient method. So, I serached for the articals for package not found errors, but most of them suggesting to add the library either via 'Add External Jars' or 'provide the class path'. I tried both and I get the same error. So, I came here and posting it as a new question.
Any help is greatly appreciated.
Regards,
Rumit
The default location for third party jars is normally the libs folder at the base of your project, i.e. <PATH-TO-PROJECT>.
bgossit's answer did help me going to the right direction. However, that alone was not enough. So, answering my question by my self explaining a little extra step I had to do.
My first bottle neck is resolved, that is to compile the project successfully. However, I am still not able to run the project on an Android device. I am marking this comment as an answer as the question was for the complie error. I am puting a new question for the runtime error.
I found that the uiautomator's 'android create project' command creates a 'build.xml' which internally calls '<ANDROID_SDK>/sdk/tools/ant/uibuild.xml' to build the project and create the final jar. By default, the 'compile' target in this 'uibuild.xml' does not have a 'classpath' inlcuded for the jar. This seems to be the bug with Android as mentioned on couple of other StackOverflow questions/answers.
Solution that worked for me:
Create the 'libs' directory at the same level as your 'src' directory and put your external jars into 'libs' directory. Note: This is just a good practice. Ideally you can give any name to the 'libs' directory and put it wherever you want.
Add the 'classpath' attribute to the 'compile' target in <ANDROID_SDK>/sdk/tools/ant/uibuild.xml.
<classpath>
<fileset dir="${jar.libs.dir}" includes="*.jar" /> <!-- path to 'libs' -->
</classpath>
PLEASE NOTE: Although, above solution worked to compile and build my project, I'm still not able to run it on the Android device as the Android device would not have Twilio API jar. I am looking for the ways to build the final project jar with Twilio jar/classes. java.lang.ClassNotFoundException for package com.twilio.sdk
Regards,
Rumit
I'm on Windows.
I downloaded the source to a java project (Plovr) and I can build it with ant using cygwin.
But just opening it in Eclipse means it will never build again. If I open it in Eclipse and then close it again, it will no longer build. I also can't add files that were written in Eclipse.
Output:
javacc:
compile:
[javac] Compiling 7 source files to C:\Users\Bryana\plovr\pulled\plovr-master\build\classes
[javac] C:\Users\Bryana\plovr\pulled\plovr-master\closure\closure-stylesheets\build\genfiles\java\com\google\common\css\compiler\ast\GssParserCC.java:345: error: cannot access Type
[javac] public CssBooleanExpressionNode buildBoolExpressionNode(CssBooleanExpressionNode.Type type,
[javac] ^
[javac] bad class file: C:\Users\Bryana\plovr\pulled\plovr-master\build\classes\com\google\common\css\compiler\ast\CssBooleanExpressionNode$Type.class
[javac] bad signature: ▒3i
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
BUILD FAILED
Using: jdk1.7.0_40 , Apache Ant(TM) version 1.9.2 , Eclipse Juno Service Release 2
Found this: http://suneelgv.wordpress.com/2011/02/17/java-lang-classformaterror-invalid-constant-pool-index-63-bad-class-file/ referring to that http://mail-archives.apache.org/mod_mbox/cayenne-user/200804.mbox/%3C0JZC008038T159#mail.uni-rostock.de%3E.
In your case the filterset or similar on-the-fly modification during copying - accidentally including class files - might not do any harm with Unix but convert line endings on Windows.
[javac] symbol : method setDocumentFromString(java.lang.String)
[javac] location: class org.xhtmlrenderer.pdf.ITextRenderer
[javac] renderer.setDocumentFromString(html);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
Im getting this error .im using itext jars with ant build
de.huxhorn.lilith.3rdparty.flyingsaucer.core-renderer-8RC1.jar /
itext-2.0.8.jar
This works fine with PSVM ...And no complie errors shown in the ide..
but when i runnig the ANt build this error is appearing..
Why is this happening ??
The dependent jar may not be added correctly to your build classpath and your IDE has it in the build path.
It looks like the org.xhtmlrenderer.pdf.ITextRenderer class in the jar that is resolved by Ant build doesn't include the method 'setDocumentFromString'
Can you please take a look on your jar and ensure that the method is really there?
I am using Lucene 3.4.0, hibernate (hibernate-all.jar), ANT and TestNG to run some test...
Most of all works right now, but since I have implemented my lucene part nothing seems to work when I use ant command... I'm kind of lost here.
Because everything works perfectly locally. I can run my test, compile, etc. As soons as, I try to build with ant, I get this error "cannot find symbol" for contructor StandartAnalyzer(version.), etc...
But like I said, everything works on eclipse... At first, I had an method not found error, but fixed it because hibernate is not compatible with the latest version of lucene. So I upgraded hibernate... but now, I get this.
Thank you. If you need more information plz ask.
$ ant explode
Buildfile: c:\DuplicateBugFinder\dbf\build.xml
init:
groovy.compile:
groovy.copy:
compile:
[javac] c:\DuplicateBugFinder\dbf\build.xml:156: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=l
st; set to false for repeatable builds
[javac] Compiling 27 source files to c:\DuplicateBugFinder\dbf\exploded-archives\dbf.ear\dbf_jar
[javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
6: cannot find symbol
[javac] symbol : constructor StandardAnalyzer(org.apache.lucene.util.Version)
[javac] location: class org.apache.lucene.analysis.standard.StandardAnalyzer
[javac] Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
[javac] ^
[javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
2: cannot find symbol
[javac] symbol : constructor QueryParser(org.apache.lucene.util.Version,java.lang.String,org.apache.lucene.analysis.Analyzer
[javac] location: class org.apache.lucene.queryParser.QueryParser
[javac] new QueryParser(Version.LUCENE_34, "title", analyzer)
[javac] ^
[javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
9: cannot find symbol
[javac] symbol : constructor IndexSearcher(org.apache.lucene.store.Directory,boolean)
[javac] location: class org.apache.lucene.search.IndexSearcher
[javac] searcher = new IndexSearcher(index, true);
[javac] ^
[javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
00: cannot find symbol
[javac] symbol : method search(org.apache.lucene.search.Query,org.apache.lucene.search.TopScoreDocCollector)
[javac] location: class org.apache.lucene.search.IndexSearcher
[javac] searcher.search(q, collector);
[javac] ^
[javac] 4 errors
BUILD FAILED
c:\DuplicateBugFinder\dbf\build.xml:156: Compile failed; see the compiler error output for details.
It's probablly a difference in the classpathes used by Eclipse and by Ant respectively. Check what jars are you exactly using inside Eclipse (what libraries are added to the project) and then what jars you use in your declared Ant classpath when you build with that. Also check that you're using the same JDK in Eclipse and Ant. If either of the two differ, change Ant ones to be like Eclipse (since that's the environment that does work)
Check the ant classpath for multiple versions of Lucene library. Do ant -diagnostics to check the ant environment.
Ok fixed it. I needed to add the jar file in my lib/test (I'm using seam framework). In eclipse, everything was working because I was pointing to the jar in my run configurations for TestNG. When I was running the command "ant test" no jar was found...
So thanks to everyone.
Plus, for those of you who wants to make use of lucene and seam make sure too have no version incompatibilty. I had this problem for a long time. Finally, I found out that I had to use an older version of lucene (2.4.1) to work with seam 2.2. I didn't check yet for lucene 3.4 and seam 3...