jar

How to delete file which is used/locked by windows in java

I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of that? Thanks a lot....

What to do in build.xml to add parameters in java command in the execution of the program?

I can only execute an application i made, with the following command in the command line: java -jar -Djava.net.preferIPv4Stack=true P2P_network.jar I would like to know, how can i put this in the jar file, so i can execute it automatically, without needing to go to the command line. The IDE used is netbeans. ...

Downloading JAR files at runtime in Java

I am wondering if it is possible to have a Java desktop application, on startup, look to some URL, to see if it needs an update, and if so download necessary JAR files, and add them to classpath for the running program. If the old jars are there, they shouldn't have been loaded into the classloader yet, at this point should they? Is ...

How do I find out what jar files are actually used when compiling a java project.

I'm currently passing a very large classpath to javac to compile a java project. I know that a number of those jar files aren't needed. Is there a simple way of finding out which files aren't needed? ...

Running a Java Class from a Jar thru a command line

I have a jar file with several classes which have static main methods. Can I execute them inside the jar from the command line? If not, can I execute them one by one? ...

Nested Class In Signed Java Applet

I'v been playing with java applets recently. In the one im writing now I have a static nested class. It works fine in the viewer, but when I compile it I get 2 class files. classname.class and classname$nestedclassname.class. I've never encountered anything like this (started java a week ago) and I don't how I would jar/sign them. Also, ...

Running jar from different directory cannot find required dependency

I'm trying to run a jar ec/mobat/MOBAT.jar which depends on some jars located in ec/mobat/lib/. It works if I do: ec/mobat/$ java -jar MOBAT.jar However I want to be able to run the jar from another directory ec/$ java -jar mobat/MOBAT.jar But I get an exception java.lang.NoClassDefFoundError: ibis/io/Serializable ... I tried to...

replace rebuilded module JAR in the EAR (Maven2 project)

Hello. During the development time I'm iteratively rebuilding some modules of my project. Rebuilding resulting ear-project gets a huge amount of time. If there is a way allowing to rebuild only jar file of changed module and then replace this jar in resulting EAR then it could reduce build time and accelerate development process. So qu...

What can I do to make jar / classes smaller?

I'm developing a Java Applet, and reducing the size of the binary code will make the applet open faster and will improve the user experience. Is there anything I can do to reduce the size of classes and / or jar files? I want to be sure I'm not missing obvious tricks. I know that in the C++ world compiler options for e.g. stripping deb...

How do you enforce dependencies among java folders in Netbeans?

Hi I am new to Netbeans. I am wondering if someone can help me with project setup in netbeans. I am moving half million lines of Java code from a different IDE to Netbeans. I was able to get the code build and run in Netbeans easily. I have a project with many folders with dependencies among those folders. They have to be built in specif...

What does Tool/Bundle-Name/Export-Package etc. mean in a jar manifest

I'm looking at the manifest.mf for some apache libraries. While I can guess what Export-Package means, I can't find any documentation for these attributes ? Could anyone point me in the right direction. Here.s an example: Manifest-Version: 1.0 Created-By: 1.6.0_07 (Sun Microsystems Inc.) Built-By: pemben Implementation-Title: Commons Be...

how to use java jar in c/c++?

i am a new developer of java swing. i want to pack the GUI program. With the help of neatbeans, i get a file of java jar. But i want to convert the jar to exe file, although i know exe4j, but i need the exe file include the jar and other files. Maybe using jar in c/c++ is a solution ? ...

CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?

Hello all, I recently switched to J2EE from .NET, and am confused about where to put JAR files. I know that the CLASSPATH, WEB-INF, and Eclipse's Java Web Path are all places where JARs can be stored, but I'm confused about which folder to use, when, and why. First off, we have the CLASSPATH. I usually set this by going into "Environ...

Creating a bundle jar with ant

I'm using Ant to build some Java projects. In some, I've got a lib/ directory, which contains external dependencies, in the form on JAR files. During the build, I create a bundled jar, that contains the project's code, alongside the dependencies, by adding to the bundle jar file a zipfileset for each of the jars in the lib/ directory. ...

what is the OSGi bundle package structure?

i am new to OSGi standard. i want to know more about the structure of bundle package file. find there is this OSGi-INF folder, the specification mentioned about l10n and permission, i wonder where defined the use of OSGI-INF folder? can i put other stuff into it? where to store the jar files referenced by the bundle? besides OSGi-INF a...

Error when running maven generated executable jar

Hi, I'm having (a strange) problem when executing a maven generated executable jar: user@host$ java -server -jar MyJar.jar Error (and nothing more than this!!!) Do you have any idea what this king of error comes from ? In my pom.xml, I copy all the dependencies to a lib folder with: <plugin> <artifactId>maven-dep...

Java: edit and recompile .jar?

I downloaded JGraphT, and I want to make some changes to the core files. I'm using Eclipse. It wants a .jar or .zip to attach source files to the .class file. I have the .java file, but I'm not sure what I should do. Do I edit it, then recompile the jar? ...

How do I run a class in a WAR from the command line?

I have a Java class which has a main and I used to run as a standalone app from the command line e.g. java -jar myjar.jar params I needed to repackage the code to run under apache and all my code, including the entry point class from the old jar, has ended up in a WAR file for easy deplyment into the web server. However, I still want...

Bundling native dll with jar

Hi, I need to include native lib (jnotify but I think that it does't matter) to my jar. I wont to do it with NetBeans. I added Bundle-NativeCode: /lib/jnotify.dll; osname=win32 to my manifest.mf file and added jnotify.dll to projektHome\src\lib\ folder. But unfortunately NetBeans is overidning manifest.mf file. How can I fixed? Can I ...

Java: When a program is .jar 'ed, it no longer reads the images in the jar file?

I need it to run without having the files exported to the computer. At the moment, my code for storing the images is: ImageIcon icon = new ImageIcon("images\\images2.gif"); It can't just be an image since I'm adding it to a JLabel. When I jar the entire program, it stores the image files in the jar. When I go to run the actual problem...