jar

Solution to the Scala jar class file is broken error

I just ran into the following Scala jar (class) is broken error:

How to add a new jar file to the Scala REPL classpath (interactive command line)

Scala REPL FAQ: How do I add a Jar file to the Scala REPL classpath? (The Scala REPL is the interactive command line you get if you just type "scala" at your command line.)

To add a new jar file to the Scala REPL classpath (interactive command line classpath), use the ":cp" command at the command line, like this:

scala> :cp myjar.jar

After you do this, you should see a reply from the REPL like this:

How to search multiple jar files for a string or pattern

Here's a shell script that I use that search Java jar files for any type of pattern. You can use it to search for the name of a class, the name of a package, or any other string/pattern that will show up if you manually ran jar tvf on each jar file. The advantage of this script -- if you're a Unix, Linux, or Cygwin user -- is that this script will search through all jar files in the current directory.

Where are Java WebStart files kept on Mac OS X 10.6?

Mac Java WebStart FAQ: Where are Java WebStart files (Jar files) kept on Mac OS X systems? And how can I delete WebStart apps on a Mac?

Java WebStart Jar files are kept below this directory on Mac OS X 10.6:

/Users/al/Library/Caches/Java/cache

More than likely you're asking because you want to delete these Java WebStart files on your Mac. The easiest way to delete them is:

A JRuby jar include tip

Ever need to include a Java jar file in a JRuby script? As I work to convert my Mac speech recognition server to JRuby, the first task I need to tackle is to include the Sphinx-4 jar files in my JRuby path. You can include one Java jar file in your JRuby script path very easily, like this:

require 'lib/sphinx4.jar'

where the jar file 'sphinx4.jar' is in a local subdirectory named lib, which is cool. But if you need to include many Java jar files into your JRuby script at one time, here's a very cool way to do that:

Java, Mac, and the Dock: How to handle drop events to a Mac OS X Dock icon

Lately I've been doing a lot of Java programming on Apple's Mac OS X platform, and my most recent effort has been to handle drag and drop events in my Java Swing application. Not satisfied to handle "simple" drag and drop events, I decided I wanted to take my application even farther, and let users drag files and images to my Java application icon in the Mac Dock.

Eclipse build path - How to add a new jar file to your Eclipse build path

When you're working with a Java project in Eclipse and you need to add a new jar file to your project, you don't need to close down Eclipse or your current Eclipse project (as I've seen a few people do). In fact, here are all the steps you need to take to add a new jar file to your Eclipse build path:

Java: How to handle drop events to your Mac OS X Dock icon (Part 2)

In Part 1 of this tutorial I shared the Java source code you need to handle drag and drop events on Mac OS X. But as I mentioned in that tutorial, the recipe to handle files that are dropped onto your Dock application icon requires a little more work, in particular an Ant build process that uses the JarBundler task. So here in Part 2 of this tutorial, I'm sharing my Ant build script that completes this recipe.

Java - How to create a Jar file in an Ant target

Here's an example of an Ant target that creates a jar file. This Ant target creates a jar file for a Java Swing application I've created named "WikiTeX".

Here's the source code for my Ant target:

Ant compiling - How to reference the jar files in your lib directory during your Ant compile process

Here's a quick snippet of code from an Ant build script that demonstrates how to create a classpath variable in an Ant script, where the classpath is built from all of the jar files in your project's lib folder:

Syndicate content