classpath

java.lang.NoClassDefFoundError: Could not initialize class sun.nio.ch.FileChannelImpl

こ雲淡風輕ζ 提交于 2020-01-03 17:03:02
问题 I am working on an application that executes a Jython 2.5.3 script from JAVA 1.6.027 . The script just open a file using codecs library and it looks like this: try: from codecs import open as codecs_open except ImportError: print 'ERROR', 'Could not import.' CODECS_LIST = ['latin-1', 'utf-8', 'utf-16', '1250', '1252'] def open_file(filename, mode): ''' DOC ''' for encoding in CODECS_LIST: try: f = codecs_open(filename, mode, encoding) f.read() f.close() print 'INFO', "File %s supports

H2 driver not found when try to connect

删除回忆录丶 提交于 2020-01-03 10:05:05
问题 I have gone through some other answers, but cannot get the solution to my problem. I am using NetBeans 7.0.1 and the latest version of the H2 DB on Win7. I successfully use the H2 console tool and I have also added the driver in NetBeans and am able to connect (i.e. see the DB, tables, issue commands, etc). However from within my Java code when running it, I get the message: "java.lang.ClassNotFoundException:org.h2.Driver". My code is: Class.forName("org.h2.Driver"); Connection conn =

H2 driver not found when try to connect

蹲街弑〆低调 提交于 2020-01-03 10:01:49
问题 I have gone through some other answers, but cannot get the solution to my problem. I am using NetBeans 7.0.1 and the latest version of the H2 DB on Win7. I successfully use the H2 console tool and I have also added the driver in NetBeans and am able to connect (i.e. see the DB, tables, issue commands, etc). However from within my Java code when running it, I get the message: "java.lang.ClassNotFoundException:org.h2.Driver". My code is: Class.forName("org.h2.Driver"); Connection conn =

Regarding automatic recompilation, I can't spot the difference between javac's -classpath and -sourcepath options

不打扰是莪最后的温柔 提交于 2020-01-03 06:25:08
问题 I'm trying to understand the difference between javac's -classpath and -sourcepath options, regarding automatic recompilation of source code files. I read the Java documentation on the subject of javac, and for its -sourcepath option it stated - Note: Classes found through the class path may be subject to automatic recompilation if their sources are also found I also looked at this webpage (idevelopment.info), to learn more about javac's -classpath and -sourcepath options. In their example,

How does JRE installation work?

孤人 提交于 2020-01-03 03:07:15
问题 I was working on packaging my software and wondering how does the installation of JRE work. Does it simply copy the binaries on the local system and set the classpath accordingly or any other steps are done by the installer? For windows the JRE binaries are stored in C:\Program Files\Java\jre7 can I copy this folder into some other machine(with same processor 32bit or 64bit) to make JRE work. If that is so then what are the environment variables that are needed to be set? 回答1: can I copy this

Java NoClassDefFoundError with Ant

放肆的年华 提交于 2020-01-03 03:00:28
问题 I have a third-party .jar file in a res/lib folder. The ANT build.xml looks like this: <?xml version="1.0"?> <project name="my.project" basedir="." default="build"> <property name="src.dir" value="src"/> <property name="build.dir" value="build/classes"/> <path id="master-classpath"> <fileset dir="res/lib"> <include name="*.jar"/> </fileset> <pathelement path="${build.dir}"/> </path> <target name="build"> <mkdir dir="${build.dir}"/> <javac destdir="${build.dir}" optimize="true"> <src path="$

Java NoClassDefFoundError with Ant

…衆ロ難τιáo~ 提交于 2020-01-03 03:00:06
问题 I have a third-party .jar file in a res/lib folder. The ANT build.xml looks like this: <?xml version="1.0"?> <project name="my.project" basedir="." default="build"> <property name="src.dir" value="src"/> <property name="build.dir" value="build/classes"/> <path id="master-classpath"> <fileset dir="res/lib"> <include name="*.jar"/> </fileset> <pathelement path="${build.dir}"/> </path> <target name="build"> <mkdir dir="${build.dir}"/> <javac destdir="${build.dir}" optimize="true"> <src path="$

Cannot reference jdbc.SQLServerDriver in Eclipse (ClassNotFoundException)

时光毁灭记忆、已成空白 提交于 2020-01-02 08:46:30
问题 I am trying to use the MSSQL driver for JDBC. I have followed the instructions on how to add an external JAR file to the Eclipse Windows IDE as follow: - Download the installation from here http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx (Microsoft JDBC Driver 4.0 for SQL Server) - Extract the zip to a file location I have extracted it here (c:\MsJDBCforSqlDriver) - In Eclipse Package Explorer right click your project -> Build Path -> Configure Build Path -> Java Build Path ->

How to set up classpath of JavaCompiler to multiple .jar files using wildcard

只谈情不闲聊 提交于 2020-01-02 08:03:27
问题 I am using JavaCompiler of javax.tools to compile some java code and I am trying to use wildcard in my classpath in order to include all the .jar files but I fail. Here is my code: String classpath = "C:\tomcat6\webapps\myapp/WEB-INF/lib/javax.ws.rs-api-2.0-m10.jar;" + "C:\\tomcat6\\webapps\\myapp/WEB-INF/lib/javax.persistence-2.1.0.jar"; Iterable<String> options = Arrays.asList("-d", classesBaseDir, "-classpath", classpath); JavaCompiler.CompilationTask task = compiler.getTask(null,

remote jars in the classpath

妖精的绣舞 提交于 2020-01-02 05:32:09
问题 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