Self executable Jar File not executable after installing Winrar - jar

Here's the deal, I've compiled a few classes into a jar file with a manifest pointing to the main-class. It works just fine on my computer.
I transferred the jar file onto another computer which I'm supposed to give a demonstration tomorrow on and well, here's where things went downhill.
Winrar was not installed, so I installed it in order to extract the folder I had my jar file in. I unknowingly associated winrar with jars which I fixed by changing the default open program with jre7/bin/java.exe. However, the jar file does not self-execute as it did previously. I'm thinking something's up with the registry.
Stackoverflow, what do you think?

I guess a simple solution would be reinstalling the JRE.

You need to reset file association for ".jar" files, jar files are not executed by "jre7/bin/java.exe". so what you should have done before choosing default program to "jre7/bin/java.exe" was to simply uninstall WinRAR or remove its association from the WinRAR settings. So now, open start menu, search and open regedit.exe goto HKEY_CLASSES_ROOT/.jar and delete every value excluding "(Default)" who's value data should be "jarfile". the reinstall jre and reboot pc . THAT'S YOUR SOLUTION.

Related

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.

Build script not working with HTML5Boilerplate new download

My first problem was that, though the documentation warned the JDK was required, and though I set the bin directory to that of the JDK, tools.jar was being searched for in the JRE folder. This made no sense, but I copied the tools.jar file over and it got past that problem. The next problem I had was the build script failing due to a failure to find a main.css file. I'm on a Windows 7 machine, and this is what I did to attempt the build:
Downloaded WinAnt v7 and installed it, specifying the jdk1.7.0_04/bin folder when asked for a Java directory.
Downloaded and unpacked a brand new package from HTML5Boilerplate, keeping the extra comments and such.
Downloaded the build project, unpacked it, and dropped its contents into a build folder at the root of the HTML5Boilerplate folder.
Opened a command prompt, navigated to the build directory, and ran the ant command.
The only thing I could think of that was causing the JDK/JRE problem was that this is a 64-bit system. That's just a guess, but the copied file worked OK for now.
This process performs some of the work without complaint, creating intermediate and publish directories, but then fails out, saying that it can't find a main.css file to copy. I want to stress that I didn't make any modifications at all to the files, so I'm confused as to why the build script can't find a file I didn't remove or rename. In the config/default.properties file of the build folder, on lines 74 and 80, it hard-codes main.js and main.css as file names used. I'm not sure if those are supposed to be dynamically generated, or if they must be manually created and included in the project for the build script to run. If so, why doesn't the default structure downloaded from the website have them? If they're dynamically created, I need advice on what is going wrong.
I'd really like to get this up and running so I can get started using HTML5Boilerplate, but I'm a little lost here.
-edit
After renaming the styles.css file to main.css, the build completed correctly, but the resulting files aren't correct. I read that the script would update the html file references to css and javascript files, but it didn't. For instance, I ended up with e68668b.css after the script ran, but the html file still referenced styles.css. Same for the javascript file. Help!
I found the problem. The build script is now a separate project, which I downloaded from github. I downloaded the HTML5Boilerplate zip file from the HTML5Boilerplate website, which unfortunately still has the old folder structure. I went to github and downloaded the HTML5Boilerplate template there, and that made the difference.
The HTML5Boilerplate website's link points to github's 3.0.2 version
The github's link points to version 3.0.2-69
And that's all she wrote. The names of some files changes, as well as some of the folder structure, between these two versions, and the build script I downloaded referenced the newest structures.

How do I find the packages defined in a jar?

I have a bunch of JAR files (from a maven2 project) and maven reports some package could not be found (org.openanzo.client.jena to be exact). I want to dig into the JAR files downloaded as the result of maven dependency resolution and find what packages are thus available from these JAR files. Insights?
UPDATE: Apparently, the only good solution to inspect insides of a jar file is the "jar" utility or one can use the facilities of their IDE to do so.
jar tvf filename.jar will show you the contents of a jar file without requiring you to extract it.
But I think that maybe what you are really trying to do is find the right coordinates for the dependency that you are missing, since obviously none of the ones you have right now are supplying the package you are looking for (in other words, checking their contents is not likely to help you).
I confess that the first place I would suggest to check is Sonatype's public Nexus instance. A search for your example turns up nothing, though. Usually that means the project is not trying to get their stuff into Maven Central or other major repositories (which is okay), so you have to resort to a web search. Usually the first two sections of the package tell you where to look (openanzo.org in your case).
If you are on Linux or a Mac, you could go to the terminal at the root of the folder containing your JARs and type:
# grep -ri "org.openanzo.client.jena" *
It will return a recursive list of all JAR files that contain that package name. If it returns 0 results, then none of those JARS contain that package.
If you wanted to do a more exhaustive search, you could unJAR the JAR files. The directory structure and .class files will be organized by packages in folders.
# jar xvf filename.jar
If you are on Windows, you can unJAR a JAR file using a tool such as 7Zip.
#Carsten
you do not have to rename a .jar file to .zip. You can directly open the jar file in winzip/or other zip utility (assuming windows OS)
#ashy_32bit
try using "jar class finder" eclipse plugin from IBM. Simple plugin for finding classes (if you know the class name)
OR
as carsten suggested... set the jar files as lib files and manually look it up
OR
create a batch file called a.bat (where you have all your jar files directly under a single folder) and paste the following 4 lines
#ECHO OFF
dir /b *.jar > allJarFilesList.txt
FOR /F %%A IN (allJarFilesList.txt) DO jar -tf %%A > list_of_packages.txt
FOR %%B IN (list_of_packages.txt) DO FIND /I "com/sun" %%B
NOTE the "com/sun" in the last line.. it is hard coded, you can pass as argument as well...
I know this is very basic form and can be improved "a lot" like looking up in various sub directories.
hope this helps :-)
.jar files are just ZIP compressed archives, rename it to zip, open it with your favourite unzip programm, and traverse through the directory.
If you add the jar file to a eclipse project, you can traverse through the lib in th project explorer.
HTH
Assuming maven downloaded the jar files,the files will be loaded in to a local repository.
You could use maven browser that comes packaged with Eclipse to browse and search for artifacts in your repository.(usually in userdir/.m2/repository)
Note:You can explore your repository directly if you want. You will understand the packages that were downloaded. But I suggest using the plugin.
If you are using Intellij IDEA, each project contains a tree called External Library that allows you to search and explore your libraries.

Qmake does not support build directories below the source directory

I have created an application that compiles and runs like a charm on OS-X. I would now like to start getting it to work on Windows. To start, I copied the project to a windows machine and just tried to compile, but got this error:
:: warning: Qmake does not support build directories below the source directory.
Any ideas?
Set the shadow build directory to some folder on the same level of your project directory:
folder/
project/
project-shadow-build-release/
project-shadow-build-debug/
You can do this in the "Projects" view, via the toolbar on the left. To me, this warning was just an annoyance, a project never failed to build because of it.
Don't copy your project.pro.user file when you are copying a project from one machine to another, or from one directory to another. When you open the project, Qt Creator will offer to create a new build directory in the proper place.
Andref gave the correct answer to resolve this warning, but you may want to understand why this requirement exists.
In fact, the build directory must be at the same folder level as the project (i.e. it can't be above or below). The reason why is that the linker is called from the build directory. Hence, any relative paths to library files will be different than what you entered in your project file.
It kinda sucks. I like to put all intermediate files in their own folder. But you simply can't with qmake.
.pro.user are generated files by Qt Creator. They are unrelated to qmake and should not be touched (and not put into a VCS for that matter)
Just remove the files with the pro.user extension , worked for me
I also got this, trying to compile a project created on linux.
Another way to solve it is to change the paths in the .pro.user file (in the directory of your project)
Right Click on a project: Set As Active Project
Click on the Projects button (The one with the spanner image)
Edit build configuration : Debug / Profile / Release / and change the default directories, OR just uncheck the Shadow build check box.
The Build directory path should now change to black, from red

Missing file [Qt]

I'm successfully going through proccess of building an application in Qt but when I try to run .exe file by double clicking on it (outside of qt) I'm getting an error saying:
"The program can't start because mingwm10.dll is missing from your computer. Try reinstalling the program to fix this problem."
I checked for this file and I found it, so I think there is some path to be set in qt, but I don't know neither where and how to do it. Could anyone explain to me how to do it?
Thank you.
I think you need to add the directory containing mingwm10.dll to your PATH environment variable. I am surprised this was not configured correctly when you installed Qt/MinGW.
Control Panel -> System -> Advanced -> Environment Variables -> PATH
This isn't something that should be set in Qt. Your application is looking for a DLL it can't find, mingwm10.dll. You can either copy the DLL (and it's dependencies if there are any) near your .exe, or add the directory it's in to the environment variable PATH.
You can go to the location where your Qt application is installed and then navigate to "..\Qt\5.11.3\mingw53_32\bin" directory. The search for the missing .dll files, copy them to the location where your .exe file is situated and then re-run the application. If more than one files are missing try the same for them.

Resources