classpath

Adding jars to classpath, Eclipse, Android

风格不统一 提交于 2019-11-29 21:08:37
问题 Currently, I go to properties-> build path-> libraries -> and then add external jars to my classpath, I know this is the correct way to do this, for java at least. However, the issue is I am running it on the Android SDK 2.1. When I run the program, I do not think the android emulator can "find" the .jars in the classpath. Is this possible? If so, which folder do I put the jars before adding them to my classpath? 回答1: You can try doing it in eclipse by Right Click the jar --> Build Path -->

Adding a non-jar file to the Java class path

喜夏-厌秋 提交于 2019-11-29 20:24:04
问题 I'm trying to make a .txt file available to my application via the class path. In my startup script--which is co-located in the same folder as the .txt file--I've set the following: set CLASSPATH=%CLASSPATH%;%CD%\sample.txt java -classpath %CD%\sample.txt In my application, I've tried the following: getClass().getResource("sample.txt") getClass().getResource("/sample.txt") getClass().getResource("classpath:sample.txt") None of the above work. Any help would be appreciated. 回答1: You must pack

How to set the java path and classpath in windows-64bit

杀马特。学长 韩版系。学妹 提交于 2019-11-29 19:57:15
问题 I have installed java on windows-64bit OS. but when I execute javac, it is failing with the error message no such command is available". I have created following environmental variable CLASSPATH C:\Program Files (x86)\Java\jdk1.6.0_05\lib 回答1: Add the appropriate javac path to your PATH variable. java.exe will be found under the bin directory of your JDK. E.g. SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0_05\bin 回答2: Before answering your question, just wann ans this simple question :

List of dependency jar files in Maven

余生颓废 提交于 2019-11-29 19:36:08
Using Maven 2, is there a way I can list out the jar dependencies as just the file names? mvn dependency:build-classpath can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the copy-dependencies goal copied). So the list I need would be something like activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc... ideally as a maven property, but I guess, a file such as build-classpath can generate will do. What I am trying to achieve is writing a Bundle-ClassPath to

Java classpath - Linux

随声附和 提交于 2019-11-29 18:26:34
问题 I am trying to understand how classpath really works. After searching around the web this is where I have reached so far: I have added export CLASSPATH="/home/foo:/home/foo/Java_code/my_code" at /etc/environment . I am running Ubuntu by the way. Java finds the path and compiles without problem. The problem is that if I change the CLASSPATH and then I do: source /etc/environment , the new CLASSPATH is not applied. It is applied if and only if I restart the system. For example if I delete the

Adding jar to classpath when running from command line

落花浮王杯 提交于 2019-11-29 18:01:18
问题 Ok I know this question has been asked many many many times before, but I've googled it and looked at examples and looked at questions on SO for the past month, and I seriously cannot get this to work. I think the problem is that I want to be able to run the program from both Eclipse and the command line. I'm also using OSX and I think a lot of the examples I'm reading are for Windows/Linux. If I have a simple program compiled in Eclipse that I want to run from the command line I do this:

Scala REPL in Gradle

六眼飞鱼酱① 提交于 2019-11-29 17:47:11
问题 At the moment Gradle's scala integration does not offer REPL functionality. How to ergonomically run a Scala REPL from Gradle with the appropriate classpath? 回答1: Minimal build.gradle : apply plugin: 'scala' repositories{ mavenCentral() } dependencies{ compile "org.scala-lang:scala-library:2.11.7" compile "org.scala-lang:scala-compiler:2.11.7" } task repl(type:JavaExec) { main = "scala.tools.nsc.MainGenericRunner" classpath = sourceSets.main.runtimeClasspath standardInput System.in args '

Convert a classpath filename to a real filename

旧巷老猫 提交于 2019-11-29 17:23:04
问题 How would I convert the name of a file on the classpath to a real filename? For example, let's say the directory "C:\workspace\project\target\classes" is on your classpath. Within that directory is a file, such as info.properties . How would you determine (at runtime) the absolute file path to the info.properties file, given only the string "info.properties" ? The result would be something like "C:\workspace\project\target\classes\info.properties" . Why is this useful? When writing unit tests

how to add java classpath in netbeans

寵の児 提交于 2019-11-29 16:43:44
I'm writing a java program in netbeans. But I need to add a classpath something.jar. In netbeans how can I do that? I compile with command: java -classpath .:something.jar MyCode.java In NetBeans Project Properties Window, you click Libraries in the left panel, and in the right panel are 4 categories of classpath you can configure. Take a look at this article, it's back from 2006, but this part of Netbeans remained pretty much the same: http://javahowto.blogspot.com/2006/06/set-classpath-in-eclipse-and-netbeans.html Here are the steps with image description :) How to add jar file in Netbeans

Java Manifest file's class path and how it determines relative dirs

孤人 提交于 2019-11-29 16:32:03
How does the Class-path in the MANIFEST.MF file determine the relative location? 1) Say I have a JAR with a jar inside lib/somejar.jar and ofc the manifest file is inside META-INF/MANIFEST.MF . How would I set the classpath....? Would it be Class-path: lib/somejar.jar or ../lib/somejar.jar ? 2) Let's say the somejar.jar also has other jars inside of it that the main jar depends on. And of course somejar.jar also has its own MANIFEST.MF file with a correctly set Class-path field. Now lets then say that the original main jar file, during run-time, needs to access one of those JAR files, will it