classpath

Adding a Third Party Library to Java Applet

情到浓时终转凉″ 提交于 2019-11-28 01:28:26
I have a Java Applet that needs a 3rd party library, but how do I add the jar to the classpath and reference it to the Java Applet? My third party library is org.apache.commons.lang.StringUtils Do you want to embed your applet into a website / HTML with the applet tag? <applet code="de.package.AppletClass" archive="apache-commons-lang.jar"> </applet> Deploying With the Applet Tag To compile it in console use: javac -classpath C:\dev\YourClass.java C:\dev\3thParty.jar Compiling the Example Programs Put the other jars in the Class-Path property in the manifest.mf and build an index to the other

Java: NullPointerException from class.getResource( … )

安稳与你 提交于 2019-11-28 01:16:40
I was writing a small application and when I tried to create an ImageIcon I always got an exception. The exception was caused by this line of code: prayerLevel.setIcon(new ImageIcon(getClass().getResource("/icons/icon_prayer.png"))); Now within my program, the folder /icons/ does exist. I don't know if it makes the difference but the class file is within a package, where as the icons folder is within the project folder (when you would see the bin and src folder). I have looked around for a bit and I couldn't find a solution that could help me solve the problem. Perhaps any of you guys could

ColdFusion: about using custom “own written” Java classes

牧云@^-^@ 提交于 2019-11-28 01:11:15
I need to use my own java class in a cfml page. This entry in the documentation sounds great but does not explain which files I have to create. I tried to create a test.cfm page under my website root. Then placed TestClass.java + TestClass.class in the same path. But that results in an error "class not found"!. Can you please help me? a TestClass.java + TestClass.class in the same path. You cannot just place .class files anywhere. When the CF server starts, it only checks specific locations for classes/jars. Those locations are referred to as the "CF class path". Your compiled .class file must

java.lang.ClassNotFoundException / NoClassDefFoundError for com/fasterxml/jackson/databind/ObjectMapper with Maven

爱⌒轻易说出口 提交于 2019-11-27 23:50:26
问题 I get the following error when trying to run a java program that uses jackon's ObjectMapper class: Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at com.inin.dynamotransfer.DynamoTransfer.importData(DynamoTransfer.java:133) at com.inin.dynamotransfer.DynamoTransfer.main(DynamoTransfer.java:67) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

In Eclipse, what is the difference between modulepath and classpath?

ε祈祈猫儿з 提交于 2019-11-27 21:57:53
In Eclipse, what is the difference between modulepath and classpath, and which one should I use to add a jar in the lib folder? And why does the JRE System Library appear in modulepath? The module system has mainly the following impact on the code: A package can only be accessed from one module (Nested packages are treated as separate, so even though the package java.util is in the module java.base , the package java.util.logging can be in the module java.logging ) You can only access public fields and methods of code in exported packages of other modules. This is true even with reflection (i

How do I increase the /proc/pid/cmdline 4096 byte limit?

北战南征 提交于 2019-11-27 20:22:58
For my Java apps with very long classpaths, I cannot see the main class specified near the end of the arg list when using ps. I think this stems from my Ubuntu system's size limit on /proc/pid/cmdline. How can I increase this limit? You can't change this dynamically, the limit is hard-coded in the kernel to PAGE_SIZE in fs/proc/base.c: 274 int res = 0; 275 unsigned int len; 276 struct mm_struct *mm = get_task_mm(task); 277 if (!mm) 278 goto out; 279 if (!mm->arg_end) 280 goto out_mm; /* Shh! No looking before we're done */ 281 282 len = mm->arg_end - mm->arg_start; 283 284 if (len > PAGE_SIZE)

In JShell, how to import classpath from a Maven project

天大地大妈咪最大 提交于 2019-11-27 20:16:14
I have a local Maven project under development. How can I launch jshell with the project class path with all the dependencies, so that I can test project or dependency classes inside JShell. You can use the jshell-maven-plugin: mvn com.github.johnpoth:jshell-maven-plugin:1.1:run which will fire up a JShell session with your project's runtime path. If you want to include your test dependencies just add -DtestClasspath to the command. Source code: https://github.com/johnpoth/jshell-maven-plugin ; contributions are welcome :) full disclaimer: I wrote the plugin. Enjoy! Jianwu Chen I wrote a

Is it possible to have Ant print out the classpath for a particular target? If so, how?

做~自己de王妃 提交于 2019-11-27 20:01:56
问题 I'm trying to get a target to build that has quite a long list of <pathelement location="${xxx}"/> and <path refid="foo.class.path"/> elements in its <path id="bar.class.path"> element (in the build.xml file). I keep getting "package com.somecompany.somepackage does not exist" errors, and I'm having a hard time chasing down these packages and making sure I've synced them from our repository. I'm new to this team so I'm unfamiliar with the build, but I would prefer to figure this out myself if

Include a library while programming & compiling, but exclude from build, in NetBeans Maven-based project

情到浓时终转凉″ 提交于 2019-11-27 19:39:17
问题 In NetBeans 8, in a Maven-based project, how does one use a jar while programming but omit from build? I need to access some specific classes in a specific JDBC driver in my Vaadin web app. But in web apps, we normally do not bundle JDBC drivers within our build (the .war file). Instead, the JDBC drivers belong in a folder controlled by the Servlet container (the runtime environment). So, I need the JDBC driver (a jar file) to be on the classpath while I am editing my code and compiling. But

Updating a JAR whilst running

狂风中的少年 提交于 2019-11-27 19:24:00
Given a jar runs within a JVM would it be possible to unload the current running Jar and remove it from the system. Download a new version and rename it with the same name of the last Jar and then initialise the new Jar, creating a seamless update of the Jar within the JVM. Is it even possible to instruct the JVM to perform this action? Is it even possible to update a Jar whilst its running? Download a new version and rename it with the same name of the last Jar and then initialise the new Jar, creating a seamless update of the Jar within the JVM ... Is it even possible to update a Jar whilst