creación de archivos jar
Frecuentes
Visto 162 veces
1
I am trying to create a jar file with many classes. Using the following command
C:\Users\use\Desktop\SDE_7_SSH\eclipse\new\charge\src\jar> jar cf charge.jar *.class
But it is throwing an error 'jar' is not recognized as an internal or external command, operable program or batch file.
In my jar folder (C:\Users\use\Desktop\SDE_7_SSH\eclipse\new\charge\src\jar), i am having two other folders named "f1", "f2", which inturn having classes.
3 Respuestas
1
You need to run the jar command from bin directory. For example on linux system, I would either go to my directory
cd /usr/local/java/jdk1.6.0_01/bin/
Y luego ejecutar
jar cf charge.jar *.class
or else run it with the full path of java binary
/usr/local/java/jdk1.6.0_01/bin/jar cf charge.jar *.class
Respondido 24 ago 12, 07:08
0
Use 'java -jar' Not just 'jar'
Respondido 24 ago 12, 06:08
0
Use the complete path to the jar program, which is in Java's bin directory. Like
jdk_with_version\bin\jar cvf *.class
Respondido 24 ago 12, 06:08
Since i am new to java, can you give me detailed example - BKK
Follo this link (www.cis.upenn.edu/~matuszek/cit594-2002/Pages/jar-files.html) this could help you to solve - gks
i am able to create jar file. But after adding the jar file to my project it is showing class not found errors. I checked my jar files by using the command D:\charge>D:\rrr\bkk\"core java"\software\Java\Java_1.6.0_ 04_win\jdk1.6.0_04\bin\jar xvf charge.jar. It is having the .java files, but i am getting class not found error in my project. - BKK
Extract your jar and see whether you could find the classes which your looking for? - gks
Make sure whether you have added the jar file to the classpath in run configurations and execute - gks
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas java or haz tu propia pregunta.
When i try to use the following command, i am getting the error respectively C:\Users\use\Desktop\SDE_7_SSH\eclipse\new\charge\src\jar>java -jar cf charge.jar *.class Error: Unable to access jarfile cf it is - BKK