classpath

Classpath for taskdef?

拈花ヽ惹草 提交于 2019-12-05 16:36:02
问题 I am defining a new task in Ant. I exported it as a jar and added to my buildfile: <taskdef classname="X" classpath="Y.jar"/> The problem is that this fails at runtime. It tells me it didn't find the class. By adding the jar to the classpath, it is corrected. My question is: Is there a way that I can refer to my jar from the Ant buildfile, without changing the classpath? 回答1: If you know the path of your jar, inside ant script you can define the classpath for your own task. <taskdef name=

Get Rhino JS to see Java class

≡放荡痞女 提交于 2019-12-05 15:54:14
I'm playing with Rhino , and I've had success using Java classes from the stdlib, but not from Java code I compiled here. For example, this works fine: print(new java.util.Date()); But with NanoHTTPD (single .java file, no namespace, same folder), I'm having no luck at all: js> new Packages.NanoHTTPD() js: "<stdin>", line 4: uncaught JavaScript runtime exception: TypeError: [JavaPackage NanoHTTPD] is not a function, it is object. at <stdin>:4 I'm sure it's something simple. What am I missing? EDIT : I'm launching it like this: $ CLASSPATH=. java -jar rhino.jar or this: $ java -classpath . -jar

remote jars in the classpath

情到浓时终转凉″ 提交于 2019-12-05 15:24:23
Sorry, maybe this question is too silly or already answered, but I couldn't find it out. I'm wondering if there is some known Java class-loader that is able to accept remote files in the classpath, i.e., entries like CLASSPATH="http://somewhere.net/library.jar:...". Note that I am not talking about applets or Java Web Start. Think of an application that can use different back-ends (e.g., MySQL, Oracle), I'd like to prepare the classpath in a shell script, based on the user's back-end preference and have the class-loader to download the needed jar (the jdbc driver in this example) from a

How to put eclipse jdt jar libraries in Java Build Path?

ⅰ亾dé卋堺 提交于 2019-12-05 13:27:29
I'm trying to use eclipse jdt , and I tried to import related modules in java source file. I have a bunch of errors as the jdt libraries are not in Java Build Path. I tried to open Add Libary -> Plug-in Dependencies , but it doesn't have the jdt jar files. I could use Add External JARs to point to all the jar files, but I don't think it's a good idea considering I have to do the same thing over and over again with new projects. In this case, how to put eclipse jdt jar libraries in Java Build Path? The java.util.Collection is found automatically. I guess there might be some easy way to setup so

Patching java.base results in java.lang.LinkageError

北慕城南 提交于 2019-12-05 12:44:09
I am trying to do the same thing in Java 11 that could be done with -Xbootclasspath/p:path in pre java 9. As a simple example I modified one of the valueOf methods of java.lang.Integer and compiled the project with: javac --module-source-path=src/java.base --patch-module java.base=src/java.base -d mods $(find src -name '*.java') I then ran a simple sample using: java --patch-module java.base=<pathToMyModifiedJavaBaseClasses> -p lib -m my.moduleA/my.moduleA.Main That worked an I'm seeing the modifications displayed (a simple print out I did from valueOf ). When I try, however, to do the same

how to add an xml file to the java application's classpath in eclipse?

风流意气都作罢 提交于 2019-12-05 11:21:29
问题 I need an xml file to be accessed via the classpath in a java application i am creating . how to achieve it in eclipse 回答1: I'd generate a separate resources folder, right-click it and select Build Path > Use as Source Folder . That way it's on the class path, but you're not mixing it with your Java source files 回答2: Put the directory containing the XML in the runtime classpath, then use className.Class.getResourceAsStream() to get an InputStream containing the XML. 回答3: Put it in java source

Postgres : No suitable Driver found for jdbc

心已入冬 提交于 2019-12-05 10:53:55
I know this might be a possible duplicate of question posted here. Sorry for that.Here is the code i wrote for Database connection try{ Class.forName("org.postgresql.Driver"); } catch(ClassNotFoundException e) { e.printStackTrace(); } try{ String URL = "jdbc:posgresql://localhost:5432/postgres"; String USER = "postgres"; String PASS = "postgres"; Connection conn = DriverManager.getConnection(URL, USER, PASS); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("Select * from employee"); while(rs.next()){ System.out.println(rs.getString(1)); } } catch(SQLException es){ es

“loader constraints violated when linking javax/xml/namespace/QName class” from webapp on Oracle 10g

点点圈 提交于 2019-12-05 08:45:21
We have a web application that can be deployed on many application servers, including Oracle 10g. On that platform, however, we are having classpath issues. The webapp uses JAXB 2, but Oracle 10g ships with JAXB 1, and this was causing errors. To get around those we configured Oracle to prefer classes in our webapp, but now we are getting the above error when attempting to instantiate a JAXB context. Looking up the "loader constraints violated" exception - it seems to be thrown when a class that has been loaded with one classloader attempts to access something that is package private in the

Unable to execute jar file despite having PATH and CLASSPATH set

被刻印的时光 ゝ 提交于 2019-12-05 08:42:58
My question is regarding including jar files in path. It has 2 parts. 1) I am trying to execute weka.jar jar file located in /home/andy/software/weka/weka.jar PATH variable points to this jar file (i.e. to /home/andy/software/weka/weka.jar) and so does CLASSPATH. However when I try to run the jar using java -jar weka.jar, I get an error "Unable to access jarfile weka.jar". Any ideas what is going on? I am on Ubuntu Linux. I looked around in SO and it seems like I am not doing anything that is obviously wrong (since both PATH and CLASSPATH seem to be set correctly). 2)I would like to be able to

The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app

点点圈 提交于 2019-12-05 07:46:51
This issue occurs when updating the dependencies classpath from 'com.android.tools.build:gradle:3.2.1' to *'com.android.tools.build:gradle:3.3.2' project-level build.gradle buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.2' } } allprojects { repositories { google() jcenter() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir } app-level build.gradle def