Location of the program in the JDK that opens .jar files(double-click) - jar

I would like to know the LOCATION of the .exe in the JDK that opens .jar files. What I mean is this: Which .exe in C:\Program Files\Java\jdk*version number*\jre\ opens the .jar files, so that they can be opened using a double click? I used to be able to do that, when I newly installed the JDK+JRE. Unfortunately, Nokia PC Suite has made itself the default program for opening .jar files, so that it can install them on my Symbian. Which program do I 'Open With' to get back the old functionality? I already know how to do it from the command line, but this is easier.

There is no specific program to run jar files.
It is java.exe only with the -jar option
For eg.--> java -jar "foo.jar"
Right Click on a jar file and go to its properties. Change the default opening program to java.exe.
I hope that should work.

use javaw.exe if you don't want the command window.
This convention is widely followed by others like perl/python/ruby as well.

I know how frustrating this issue is. I looked all over the internet forums before I finally found the problem...Here is the answer below :
"The root cause for the problem above is, that a program has stolen the .jar association. If you have installed the Java Runtime Environment the first time, the file type called "jar" is assigned to javaw.exe correctly. "jar" is an abbreviation for "java archive" and javaw.exe is the correct program to execute a .jar. However, on Windows any program can steal a file type at any time even if it is already associated with a program. Many zip/unzip programs prefer to do this, because a jar is stored in the .zip format. If you doubleclick on a .jar, your pack program opens the file, rather than javaw runs the program, because your pack program ignores the meta information which are also stored in a .jar."

Related

Ada 2012 and the GNAT GPS IDE Debugger Can't Find Source File

I'm working with a simple hello world single .adb file program in Ada 2012 using the GPS IDE under Windows 7/64. If I keep all the object and source files together everything works. I did have to go to the project properties Switches tab and select the Ada tab and enable the 'Debug Information' checkbox.
Now I want to organize my project a little better and put the object files in their own directory. I used the project properties Objects tab and changed the setting from . to ojb. I can build and run. Now when I go to debug and click on a line in hello.adb I get the "No source file named hello.adb. I'm guessing that it's looking in the obj directory. I tried issuing a set directory command and gave the absolute path to the parent folder. A subsequent show directories command shows that the folder containing my hello.adb file is now in the path but still no joy. I can no longer set a breakpoint. This doesn't seem like that unusual an operation, I suspect there is another higher level way to specify the source path for the debugger. Anyone know what it is, or any tips on getting this to work?
GPS itself does not do the debugging. It spawns a command line debugger named gdb for that purpose. You could try running GPS with --traceon=GVD.OUT (or alternatively, and often simpler on Windows, change the %USERPROFILE%.gps\traces.cfg file and add "GVD.OUT=yes").
This will log all communications between GPS and gdb in %USERPROFILE%.gps\log.*, which might be helpful in understanding why gdb is not outputting the correct full path for the files.
Please also double-check that "-g" is indeed passed to the compiler (perhaps after removing all files from obj)

Codelite Sample code Executable

I am just started exploring codelite. I have written a sample program hello.c to create a window and it will display "Hello World". Executable hello.exe is available under Debug directory. When i execute that from my system its working fine.
I have copied the hello.exe to my other system and tried to execute from there and i got error message "The Application was unable to start correctly. Clock OK to close the application".
Is it not possible to run the executable created in one PC to other PC? Do i need to any specific option during compilation?
Also i have installed MingW 64 bit and GTK 3.6.4 in the PC.
You are missing some information in your report, for example: when the error dialog was shown, did it say which error code or why it failed to launch?
Did you try using dependency walker to check whether you are missing some DLLs that exist on your computer but not on the other PC?
If you are building using a MinGW-64, then try to use dependency walker for 64 bit applications to see which DLLs are missing

Qt: Cannot execute '': The requested operation requires elevation

I am not able to run the application the Qt creator. It complains the following error:
Cannot execute '': The requested operation requires elevation
My .exe file has a Windows administrator shield symbol on it. Do I need to make a project settings changes? I am extensively using Qt File library for doing some file operations.
What's your executable's file name? Without an embedded manifest, windows tries to be smart and wants to run executables with "install", "update", "setup", "patch", etc. in the file name as administrator. It even checks for those names within words such as "autoupdate".
The problem is that qmake/mingw doesn't embed those manifests, while MSVC does. If someone has a clean solution to that problem, I'd be interested to learn about it.
If application you develop require administrator privileges, you cannot simply run it from Qt creator, started under non privileged account.
You can run your Qt creator as Administrtor.
Or you can start your application from QtCreator using runas utility.
But in this case you would not be able to see debug output in QtCreator console window and debug application.
If the name of the exe file has some words (update, patch, ...), the Windows UAC ask for admin privilegies. The only solution is that the project generates an exe without these words.
See this: Qt Creator create exes with admin privilegies

Run BAT file from Adobe AIR?

To package an .air file into a native installer you have to use a batch program called adt.
The command on Windows will look something like this:
C:\Users\jisaacks>"C:\Program Files
(x86)\Adobe\Adobe Flash Builder
4\sdks\4.1.0\bin\adt" -package -target
native "D:\DEV\Flex4\Workspaces\AIR
Native Packager\AIRNIP\AIRNIP.exe"
"D:\DEV\Flex4\Workspaces\AIR Native
Packager\AIRNIP\AIRNIP.air"
I am trying to author a program in AIR that does this for you. Basically you drag/drop an .air file into it and it packages it into a native installer.
Well It gave me an Error #3219 error, which I looked up and found this:
AIR on Windows does not allow you to
run .bat files directly. Windows .bat
files are executed by the command
interpreter application (cmd.exe).
When you invoke a .bat file, this
command application can interpret
arguments passed to the command as
additional applications to launch. A
malicious injection of extra
characters in the argument string
could cause cmd.exe to execute a
harmful or insecure application. For
example, without proper data
validation, your AIR application may
call myBat.bat myArguments
c:/evil.exe. The command application
would launch the evil.exe application
in addition to running your batch
file.
If you call the start() method with a
.bat file, the NativeProcess object
throws an exception. The message
property of the Error object contains
the string "Error #3219: The
NativeProcess could not be started."
I am wondering if there is a possible work around or if I have hit a brick wall?
I believe you have hit a brick wall, at least with trying to do this in Adobe Air. Executing batch files can be a huge security hole, as your post claimed.
Are you trying to do this in Air for portability, or would you be able to use some other language?
I suggest trying to code this in python. Using the subprocesslibrary can help a lot.
http://docs.python.org/release/2.5.2/lib/module-subprocess.html
Serge Jespers (Adobe Evangelist) (http://www.webkitchen.be/) has done exactly this,
I think you should try to contact him for the details.
I helped him build a first solution by creating a windows executable which executed any bat file you specified, later he changed it by calling the java application (adt) directly which works fine as well.
He'll be very happy to help you.
UPDATE:
You can download the Package Assitant Pro right here: http://www.webkitchen.be/package-assistant-pro/

Problem running Java application

I have developed a Java swing application, then I have deployed it through a .jar package.
I run my application on my PC double-clicking over the .jar file and everything goes fine, everything goes fine from command line (dos prompt) too.
Here my problem.
I have tried to run my app on another PC:
same OS (Windows XP)
same JRE (1.6.0_U13)
but Oracle JInitiator 1.3.1.18 installed (this is the only difference with my PC)
The app works fine only from command line, but not from gui!
Double-clicking over the .jar file I get this error:
`Could not find the main class. program will exit!`
Can this error be due to some conflict between JRE and JInitiator?
Does anybody had the same trouble?
Thanks
edit:
executing .jar files from gui is associated to the "javaw" command
It is probably a conflict with JInit, which changes the association between jar files and the java command used to launch them.
See this thread.
Re-installed java and the problem has gone away.
A quick description might be - jinitiator installs as a fully implemented JRE with some additional features for cached downloads when dealing with applets.
As all the JRE installers I've seen lately do, regardless of if they are new or old, they replace several entries in the registry to become the active JRE. Whatever you installed last will be run unless you provide a full path to java.exe or change the registry to re point at a different JRE.
examine:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
and see if the path to javaw.exe is correct. (or even included)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\java.exe and javaw.exe and javaws.exe to check the path there also.
Have you checked your PATH/CLASSPATH/JAVA_PATH variables. It is possible that Jinitiator has installed the wrong version at the front.
Possibly check your manifest entries. See if the MANIFEST.MF in the jar contains the Main-Class attribute set correctly to the class that is supposed to be invoked, if not try setting it.

Resources