Issue in jar -xvf command - java

C:\Users\sunka\Desktop\CS DEPT\fall 2k16\information structures>jar
-xvf week2.zip
java.io.FileNotFoundException: week2.zip (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.tools.jar.Main.run(Main.java:307)
at sun.tools.jar.Main.main(Main.java:1288)
When I am trying to unzip using jar -xvf, I am getting file not found exception. I used the same command in my office, it was working. I made sure that zip file and jar file are present in the directory.

Check if you in same directory where you have zip file placed.
Because if JAVA path is set properly and your are giving right zip file name with correct path it works fine.

Related

how can i solve this error in schemaspy

at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
ERROR - mssql08 (The system cannot find the file specified)
java.io.FileNotFoundException: mssql08 (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
You're probably running a version without support for mssql08.
Verify by
java -jar schemaspy.jar -dbhelp
You can get the latest snapshot at
https://github.com/schemaspy/schemaspy/blob/master/README.md#latest-build

Writing output of dex2jar to other folder

I am trying to write a batch file that writes the classes-dex2jar.jar to some other folder.
I tried the following:
d2j-dex2jar %arg1% -o %arg2%
Here, arg1 is the path to classes.dex and arg2 is the folder where I wish to store the generated classes-dex2jar.jar file. (E:\new\)
Now, I am getting FileNotFoundException for the second argument. It says
java.io.FileNotFoundException: E:\new" (The filename, directory name,
or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:77)
at com.googlecode.dex2jar.v3.Dex2jar.to(Dex2jar.java:250)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java
:110)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:174)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:34)
Please tell me what am I doing wrong?
Instead of passing the folder as an argument, pass it the jar filename.
d2j-dex2jar classes.dex -o "E:\new\classes.jar"
Also make sure E:\new directory exists. Dex2jar does not create a new directory. Create a directory and then pass d2j-dex2jar the full path to the directory plus the jar file name you want.
java.io.FileOutputStream.open - looks like you'are trying to open directory with FileOutputStream , which should be not possible.

How to create a jar archive using cmd?

how do I create an archive "classes.jar" which should contain 2 files ".class" (named as MyFirstClass.class and MySecondClass.class) using file I created "manifest.mf".
This must be done using the program javac, program jar and cmd.
2 files .class I already got using javac program.
This is all located in the folder C:\Task7
MyFirstClass.class file located in the folder C:\Task7\myPackage (because it is in the package "myPackage")
MySecondClass.class file located in the folder C:\Task7\myPackage\myfirstpackage (because it is in the packages myPackage and myfirstpackage)
myManifest.mf file located in the folder C:\Task7
My attempts to:
1) C:\Program Files\Java\jdk1.7.0_51\bin>jar cvfm classes.jar C:\Task7 manifest -C C:\Task7 myPackage.MyFirstClass.class myPackage.myfirstpackage.MySecondClass.class
cmd answer:
java.io.FileNotFoundException: C:\Task7 (Mbp4p3m r •meCesix)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
2) C:\Program Files\Java\jdk1.7.0_51\bin>jar cvfm classes.jar C:\Task7 manifest C:\Task7\myPackage\MyFirstClass.class C:\Task7\myPackage\myfirstpackage\MySecondClass.class
cmd answer:
java.io.FileNotFoundException: C:\Task7 (Mbp4p3m r omeCesix)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
3) C:\Program Files\Java\jdk1.7.0_51\bin>jar cvfm classes.jar C:\Task7 manifest C:\Task7\myPackage MyFirstClass.class C:\Task7\myPackage\myfirstpackage MySecondClass.class
cmd answer:
java.io.FileNotFoundException: C:\Task7 (Cbpgrosm r omeCegx)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at sun.tools.jar.Main.run(Main.java:171)
at sun.tools.jar.Main.main(Main.java:1177)
What am I doing wrong?
Keep all the file in a folder and Go to that location and use the following command-
jar -cvf abc.jar abc
if your folder name is abc.
If you run jar out of dir your class hierarchy is located, you shoud use -C option before the list of files. In your case it should be: -C C:\Task7

java.io.FileNotFoundException: C:\firemonitor\build\web\images\2.jpg (The system cannot find the path specified)

i have a error while running java project in netbeans
java.io.FileNotFoundException: C:\firemonitor\build\web\images\2.jpg (The system cannot find the path specified)
this is a image processing project i think their is problem in ij.jar or comm.jar file
is their is any file comm.jar-1
"\" can't used as the file seperator.Because it is the starting if escape characteres.replace it with double "\" or "/"

Jar file: load configuration files in jar

I exported a project that reads 2 configuration files. However, when I execute the jar, it gets this error:
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.smart.ets.services.ConfigErrorException
... 3 more
mickey91#mickey-espiritu:~/Documents/Dropbox$ java -jar ETS.jar
Error: java.io.FileNotFoundException: config/dbConnection.config (No such file or directory)
Error: java.io.FileNotFoundException: config/test.config (No such file or directory)
com.smart.ets.services.ServiceException: com.smart.ets.services.ConfigErrorException
at com.smart.ets.services.TransactionServiceImpl.getConfigData(TransactionServiceImpl.java:30)
at com.smart.ets.controllers.Simulator.getTransactionSimulationResults(Simulator.java:41)
at com.smart.ets.controllers.Simulator.main(Simulator.java:26)
Caused by: com.sm
art.ets.services.ConfigErrorException
... 3 more
Any way to fix this? It works if I run the project(not the jar file of the project)
You neglect to mention how you're accessing the files, but from the error it looks like you're trying to access them as files--but they're not, they're resources on the classpath.
As such, you should be using getResourceAsStream. The name of the resource would be the package-relative path.

Categories

Resources