I have created a text editor using Java, and have it packed in a jar file using Netbeans.
Now I created a text file, with an extension of “.text”.
I’m on Windows 7, so using it’s property window I changed the default opening program to my text editor’s jar file.
Now when I double click the file with “.text” extension, windows shows a dialogbox saying “{file name} is not a valid win32 application”.
Please help me out of it..
Thanks.
The problem is that a JAR file is selected as the “default application”. However, JAR files are normally not executable. That is, a JAR file is not a valid Windows application. It doesn’t matter if the JAR extension itself has a default application associated with it, because the “Open verb” is not used recursively in other “Open verb” definitions.
Instead,
java(orjavaw, as appropriate) and use that executable wrapper as the “Open with” program. (This will have an annoying intermediate console window if using a batch file.) Or,java(orjavaw).In the end, either form should look similar to:
javaw -jar TheJarFile.jar "%1%". (Note thatjavawis an executable, whileTheJarFile.jaris not an executable.)See java – the Java application launcher for how to use java/javaw.