Package does not exist - error - jar

I am trying to compile a .java file (TransformRTDE.java) that uses several import statements. These statements import .class files present in five external JAR files: dataextract.jar, jna.jar, JRI.jar, JRIEngine.jar and REngine.jar. I have read documentation on how to deal with these import statements while trying to compile your .java file from the command line. However, I do not seem to succeed.
I set up the directory in the command line to be the folder in which my .java file resides. In that same folder, I have put the JAR files. When I try to compile the code using java -cp dataextract.jar jna.jar JRI.jar JRIEngine.jar REngine.jar TransformRTDE.java, I get a package does not exist error. I have set up the class path to include the folder in which all my .java and .jar files reside.
I have searched for hours on this without success. Any ideas what I'm doing wrong?
Thanks in advance!
EDIT: I forgot to mention I also get an error related to annotation processing.
Picture can be found here: https://www.dropbox.com/s/p9ul0olydzmkl6s/error.png

Related

How to convert jar file to eclipse project

I want to convert my jar file to eclipse project, so that i can make changes in the existing code. Can anyone help me with this. I tried extracting jar using jar xf myjar.jar command through command prompt but it gave me only .class files and i want to generate .java files of my project through it.

ClassLoader not recognizing programmatic jar file

I have a program that creates java source code files, compiles them to create class files and “jars up” the classfiles into a jar using java.utils.jar. When the resulting jar is placed in a lib directory in another application, the classes are supposed to be recognized. Except the created classfiles are not being recognized. So I used WinZip to zip the same class files, renamed the “zip” a “jar”, placed the new jar in the lib directory and the files are recognized fine. Used WinZip to look at the first (programmatically-produced) jar and the WinZip-created jar and they look identical. Same paths, same original size, same compressed size. Also tried creating a zip via java.utils.zip and renaming it. Same problem. Does anyone know of any reason why the programmatic zip/jar files could not be recognized by the Java class loader?
Solved. Maybe this will help others. The argument to ZipEntry (and JarEntry) must use forward slash ("/") as the name separator in order for the ClassLoader to correctly recognize the included files. In particular, other separators, such as those returned by File.getAbsolutePath(), while seemingly happily accepted by java.utils.jar and WinZip, will not be recognized by the ClassLoader.

jar file not found iexpress

I am using iexpress to make my .jar files into .exe files
for this I add the jar file(myjarfile.jar) and in run command box I type : java -jar myjarfile.jar
but after creating the .exe the cmd that is flashing says cannot find the jar file myjarfile.jar
can any body help me find what I am doing wrong
To test this, I built a simple HelloWorld.jar file (using these instructions) and tested it like so:
java -jar HelloWorld.jar
Then I made an IExpress package with it. The Install program was exactly the command I used above. This worked exactly as it should.
Two possible causes of the error:
In the IExpress wizard, there's a checkbox Store files using Long File Name inside Package. You should definitely select this option; ignore the warning that appears, as it applies to Windows 95/98. In the .sed file, this is:
UseLongFileName=1
Check that the .exe actually contains myjarfile.jar. 7-Zip will open the .exe and show you the archive contents. (IExpress .exe files are just a CAB file with a wrapper.) If the file is missing, then you'll need to check your .sed file to see what went wrong.

jar file is not including in build.xml

What could be the reasons for a jar file not to include in build, even everything was given correctly. I tried the same syntax with other jar files which worked. But when i am using it for protocol buffers jar file, it is not being included.
Thanks !

Creating a JAR file which contains other library files

I want to create one executable JAR file which contains other JAR libraries. But when I execute the JAR, it gives an error of class path problem.
How do I solve the class-path problem?
I think you can try it like this;
Here is a simple example for you question. First, we assume we have a project directory like D:\javademo. In this working directory we then create a main class HelloWorld.java and thtat contains our other JAR files, like commons-lang.jar. Now, we must archive our main classes HelloWorld and commons-lang.jar into test.jar file.
First we must edit our manifest file so that we can specify our class-path and main-class
like this:
Manifest-Version: 1.0
Created-By: tony example
Class-Path: test.jar commons-lang.jar
Main-Class: org.tony.java.HelloWorld
We named this file test.mf. Now we use the jar command to generate our JAR file like this:
jar -cvfm test.jar test.mf -C ./ .
Then it will generate the JAR file test.jar. You can use this command to run this main class using java command:
java -jar test.jar
That is my solution. I hope it give you something helpful...
You should use third-party libraries for it. For example, OneJar. You'll have to build the final JAR file using the OneJar tool (like Ant task) instead of standard JRE's tools.
On running such a JAR file, OneJar's service class is launched instead of yours. This class then loads JAR files packed inside, as well as your classes, and run your main class.
There are similar questions and answers already. For example: Stack Overflow question Easiest way to merge a release into one JAR file.

Resources