Home > other >  How to set java.exe as the default application for .class files?
How to set java.exe as the default application for .class files?

Time:10-09

How to set java.exe as the default program for opening .class files, such that I can open them by double clicking? I tried in Windows Commad Prompt (as administrator):

assoc .class=classfile
ftype classfile="path to java\java.exe" -cp %1

By mistake, previously, I had set Notepad as the default app. Now if I try to set java using "open with" or Control Panel> Default programs > set defaut programs, and the other two options that were there. Nothing worked, It wasnt even showing that java was selected as the default app. What should I do?

CodePudding user response:

I use a free program called "default programs editor" to fix file type associations, change icons, etc. To make a class run with java.exe is bit tricky, because it doesn't accept a class file as an argument. To do that, you'd need to launch a custom program instead (possibly from a .bat file) which then extracts information, changes the CLASSPATH, etc.

  • Related